From patchwork Sun Mar 4 22:57:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 10257897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6735360365 for ; Sun, 4 Mar 2018 22:57:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A7B2237F1 for ; Sun, 4 Mar 2018 22:57:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F81F27B81; Sun, 4 Mar 2018 22:57:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB54C237F1 for ; Sun, 4 Mar 2018 22:57:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932088AbeCDW5y (ORCPT ); Sun, 4 Mar 2018 17:57:54 -0500 Received: from mx2.mailbox.org ([80.241.60.215]:52122 "EHLO mx2.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932497AbeCDW5t (ORCPT ); Sun, 4 Mar 2018 17:57:49 -0500 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id E376D40EA5; Sun, 4 Mar 2018 23:57:47 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id kIKEMe_o6FGo; Sun, 4 Mar 2018 23:57:46 +0100 (CET) From: Hauke Mehrtens To: backports@vger.kernel.org Cc: johannes@sipsolutions.net, Hauke Mehrtens Subject: [PATCH 07/14] header: debugfs.h: add DEFINE_DEBUGFS_ATTRIBUTE Date: Sun, 4 Mar 2018 23:57:10 +0100 Message-Id: <20180304225717.20890-8-hauke@hauke-m.de> In-Reply-To: <20180304225717.20890-1-hauke@hauke-m.de> References: <20180304225717.20890-1-hauke@hauke-m.de> Sender: backports-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: backports@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP DEFINE_DEBUGFS_ATTRIBUTE and debugfs_create_file_unsafe() were introduced in mainline commit c6468808149 ("debugfs: add support for self-protecting attribute file fops"), but on older kernel versions where we do not have this extra security in debugfs we can use the older functions instead. Signed-off-by: Hauke Mehrtens --- backport/backport-include/linux/debugfs.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backport/backport-include/linux/debugfs.h b/backport/backport-include/linux/debugfs.h index 11670388..fb50c4f5 100644 --- a/backport/backport-include/linux/debugfs.h +++ b/backport/backport-include/linux/debugfs.h @@ -53,4 +53,11 @@ debugfs_real_fops(const struct file *filp) } #endif /* <4.9.0 but not >= 4.8.4, 4.7.10 */ +#ifndef DEFINE_DEBUGFS_ATTRIBUTE +#define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt) \ + DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt) +#define debugfs_create_file_unsafe(name, mode, parent, data, fops) \ + debugfs_create_file(name, mode, parent, data, fops) +#endif + #endif /* __BACKPORT_DEBUGFS_H_ */