From patchwork Fri Apr 26 18:28:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Layton X-Patchwork-Id: 10919561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18CAF933 for ; Fri, 26 Apr 2019 18:29:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A44928E58 for ; Fri, 26 Apr 2019 18:29:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F23E728E5E; Fri, 26 Apr 2019 18:29:18 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 7F96F28E58 for ; Fri, 26 Apr 2019 18:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726341AbfDZS2y (ORCPT ); Fri, 26 Apr 2019 14:28:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:46800 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725875AbfDZS2x (ORCPT ); Fri, 26 Apr 2019 14:28:53 -0400 Received: from tleilax.poochiereds.net (cpe-71-70-156-158.nc.res.rr.com [71.70.156.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C63182146E; Fri, 26 Apr 2019 18:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556303332; bh=PhejF+uxD/AHiOpiaxpAzIe9h8Sj4miG+Hyie5o3Cco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGuQeqOu5G6ShYokxkvA2F+UX3xSLZQOFY1MPpCN301MaVQ/SxGyCL9KcPaSZSMie 25Y6Y4uaEc8YIiku1i81MChYxVy4Ut+ncJla+C/cJ0Qz6kx9QUerpMZU05xUj9b4LR ZTPSJrLbE6wCB5Z8IFORmjjzwE+w9lUol8HNKa4c= From: Jeff Layton To: viro@zeniv.linux.org.uk Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, gregkh@linuxfoundation.org, tj@kernel.org, jack@suse.cz, amir73il@gmail.com, paul@paul-moore.com, eparis@redhat.com, linux-audit@redhat.com, rafael@kernel.org Subject: [PATCH 1/5] dcache: track the length of the string in struct name_snapshot Date: Fri, 26 Apr 2019 14:28:43 -0400 Message-Id: <20190426182847.25088-2-jlayton@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426182847.25088-1-jlayton@kernel.org> References: <20190426182847.25088-1-jlayton@kernel.org> MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Several existing callers end up having to strlen the string, so just convert the code over to set up a qstr instead and copy the length from the original. Signed-off-by: Jeff Layton --- fs/dcache.c | 11 +++++++---- fs/debugfs/inode.c | 2 +- fs/namei.c | 2 +- fs/notify/fsnotify.c | 4 ++-- fs/overlayfs/export.c | 2 +- include/linux/dcache.h | 2 +- include/linux/fsnotify.h | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index aac41adf4743..a8dcc27ce2d0 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -287,22 +287,25 @@ void take_dentry_name_snapshot(struct name_snapshot *name, struct dentry *dentry if (unlikely(dname_external(dentry))) { struct external_name *p = external_name(dentry); atomic_inc(&p->u.count); + name->name.len = dentry->d_name.len; spin_unlock(&dentry->d_lock); - name->name = p->name; + name->name.name = p->name; } else { memcpy(name->inline_name, dentry->d_iname, dentry->d_name.len + 1); + name->name.len = dentry->d_name.len; spin_unlock(&dentry->d_lock); - name->name = name->inline_name; + name->name.name = name->inline_name; } } EXPORT_SYMBOL(take_dentry_name_snapshot); void release_dentry_name_snapshot(struct name_snapshot *name) { - if (unlikely(name->name != name->inline_name)) { + if (unlikely(name->name.name != name->inline_name)) { struct external_name *p; - p = container_of(name->name, struct external_name, name[0]); + p = container_of(name->name.name, struct external_name, + name[0]); if (unlikely(atomic_dec_and_test(&p->u.count))) kfree_rcu(p, u.head); } diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index f25daa207421..37c0a025d7e8 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -824,7 +824,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, goto exit; } d_move(old_dentry, dentry); - fsnotify_move(d_inode(old_dir), d_inode(new_dir), old_name.name, + fsnotify_move(d_inode(old_dir), d_inode(new_dir), old_name.name.name, d_is_dir(old_dentry), NULL, old_dentry); release_dentry_name_snapshot(&old_name); diff --git a/fs/namei.c b/fs/namei.c index dede0147b3f6..c96713077326 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -4498,7 +4498,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, inode_unlock(target); dput(new_dentry); if (!error) { - fsnotify_move(old_dir, new_dir, old_name.name, is_dir, + fsnotify_move(old_dir, new_dir, old_name.name.name, is_dir, !(flags & RENAME_EXCHANGE) ? target : NULL, old_dentry); if (flags & RENAME_EXCHANGE) { fsnotify_move(new_dir, old_dir, old_dentry->d_name.name, diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index df06f3da166c..fb22f76329ae 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -179,10 +179,10 @@ int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask take_dentry_name_snapshot(&name, dentry); if (path) ret = fsnotify(p_inode, mask, path, FSNOTIFY_EVENT_PATH, - name.name, 0); + name.name.name, 0); else ret = fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE, - name.name, 0); + name.name.name, 0); release_dentry_name_snapshot(&name); } diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c index 54e5d17d7f3e..cc1c9e5606ba 100644 --- a/fs/overlayfs/export.c +++ b/fs/overlayfs/export.c @@ -398,7 +398,7 @@ static struct dentry *ovl_lookup_real_one(struct dentry *connected, * pointer because we hold no lock on the real dentry. */ take_dentry_name_snapshot(&name, real); - this = lookup_one_len(name.name, connected, strlen(name.name)); + this = lookup_one_len(name.name.name, connected, name.name.len); err = PTR_ERR(this); if (IS_ERR(this)) { goto fail; diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 60996e64c579..2ff5f3bb9ddc 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -594,7 +594,7 @@ static inline struct inode *d_real_inode(const struct dentry *dentry) } struct name_snapshot { - const unsigned char *name; + struct qstr name; unsigned char inline_name[DNAME_INLINE_LEN]; }; void take_dentry_name_snapshot(struct name_snapshot *, struct dentry *); diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 09587e2860b5..e09cfff69bb2 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -178,7 +178,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) take_dentry_name_snapshot(&name, dentry); fsnotify(d_inode(parent), mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, - name.name, 0); + name.name.name, 0); release_dentry_name_snapshot(&name); dput(parent); From patchwork Fri Apr 26 18:28:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Layton X-Patchwork-Id: 10919563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E559933 for ; Fri, 26 Apr 2019 18:29:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30D2528E57 for ; Fri, 26 Apr 2019 18:29:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2537B28E5D; Fri, 26 Apr 2019 18:29:25 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 BF9C728E57 for ; Fri, 26 Apr 2019 18:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726416AbfDZS3T (ORCPT ); Fri, 26 Apr 2019 14:29:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:46894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726326AbfDZS2y (ORCPT ); Fri, 26 Apr 2019 14:28:54 -0400 Received: from tleilax.poochiereds.net (cpe-71-70-156-158.nc.res.rr.com [71.70.156.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 449BA214C6; Fri, 26 Apr 2019 18:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556303333; bh=xgtrjev1l0myncFB4+Rxefbc1PEu33mLHqZlotiEJcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hvBLan3aRLOzI/++mN09qi5Xg/iKciT/gTDSXeO0pV+JYv/jpo71hpWUB0Sk3vpi7 Kt8OwiLPwW+q+Owr/IH/+LTlcuGeh6Rie1VbpW6VQz/kA0UAQJTxd/vyAnRywPquHo oGVkjD2+LF/uhRYooNxRIqV3My7ISsaRbuzGGWg8= From: Jeff Layton To: viro@zeniv.linux.org.uk Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, gregkh@linuxfoundation.org, tj@kernel.org, jack@suse.cz, amir73il@gmail.com, paul@paul-moore.com, eparis@redhat.com, linux-audit@redhat.com, rafael@kernel.org Subject: [PATCH 2/5] fsnotify: have fsnotify_move take a struct qstr instead of a string Date: Fri, 26 Apr 2019 14:28:44 -0400 Message-Id: <20190426182847.25088-3-jlayton@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426182847.25088-1-jlayton@kernel.org> References: <20190426182847.25088-1-jlayton@kernel.org> MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With this, ovl_lookup_real_one can skip the strlen call. Signed-off-by: Jeff Layton --- fs/debugfs/inode.c | 2 +- fs/namei.c | 4 ++-- include/linux/fsnotify.h | 11 +++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 37c0a025d7e8..5dbeefa69a58 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -824,7 +824,7 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry, goto exit; } d_move(old_dentry, dentry); - fsnotify_move(d_inode(old_dir), d_inode(new_dir), old_name.name.name, + fsnotify_move(d_inode(old_dir), d_inode(new_dir), &old_name.name, d_is_dir(old_dentry), NULL, old_dentry); release_dentry_name_snapshot(&old_name); diff --git a/fs/namei.c b/fs/namei.c index c96713077326..5ebd64b21970 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -4498,10 +4498,10 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, inode_unlock(target); dput(new_dentry); if (!error) { - fsnotify_move(old_dir, new_dir, old_name.name.name, is_dir, + fsnotify_move(old_dir, new_dir, &old_name.name, is_dir, !(flags & RENAME_EXCHANGE) ? target : NULL, old_dentry); if (flags & RENAME_EXCHANGE) { - fsnotify_move(new_dir, old_dir, old_dentry->d_name.name, + fsnotify_move(new_dir, old_dir, &old_dentry->d_name, new_is_dir, NULL, new_dentry); } } diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index e09cfff69bb2..2de90a7e388b 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -102,7 +102,7 @@ static inline void fsnotify_link_count(struct inode *inode) * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir */ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, - const unsigned char *old_name, + const struct qstr *old_name, int isdir, struct inode *target, struct dentry *moved) { @@ -111,7 +111,6 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, __u32 old_dir_mask = FS_MOVED_FROM; __u32 new_dir_mask = FS_MOVED_TO; __u32 mask = FS_MOVE_SELF; - const unsigned char *new_name = moved->d_name.name; if (old_dir == new_dir) old_dir_mask |= FS_DN_RENAME; @@ -122,10 +121,10 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, mask |= FS_ISDIR; } - fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name, - fs_cookie); - fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name, - fs_cookie); + fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, + old_name->name, fs_cookie); + fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, + moved->d_name.name, fs_cookie); if (target) fsnotify_link_count(target); From patchwork Fri Apr 26 18:28:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Layton X-Patchwork-Id: 10919559 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 866C8933 for ; Fri, 26 Apr 2019 18:29:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 793C328E57 for ; Fri, 26 Apr 2019 18:29:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D27B28E5E; Fri, 26 Apr 2019 18:29:16 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 E755628E57 for ; Fri, 26 Apr 2019 18:29:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726373AbfDZS25 (ORCPT ); Fri, 26 Apr 2019 14:28:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:46928 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726366AbfDZS24 (ORCPT ); Fri, 26 Apr 2019 14:28:56 -0400 Received: from tleilax.poochiereds.net (cpe-71-70-156-158.nc.res.rr.com [71.70.156.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B8B1920B7C; Fri, 26 Apr 2019 18:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556303335; bh=Tmqzy32XGQfb99U/hUBF1rbLUPylqVacMlS2Hrby3j4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WORJQH/P5NuYNOEARycZEMFB2PNYuFM/fkEPqczwA2glTHwA6o2J/VEHRLX/PEOIr XjBtBkMoanEhgfYC3+yliQE1RiOIBGYGCkkzPwmYaXYzAtf0zBUbkxbyBEGzQ3Y4tX FUIMitHRvjtJOd4bktPvQ4/aUmVB9V/ORdz9FtKE= From: Jeff Layton To: viro@zeniv.linux.org.uk Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, gregkh@linuxfoundation.org, tj@kernel.org, jack@suse.cz, amir73il@gmail.com, paul@paul-moore.com, eparis@redhat.com, linux-audit@redhat.com, rafael@kernel.org Subject: [PATCH 3/5] fsnotify: have fsnotify() take a qstr instead of a string Date: Fri, 26 Apr 2019 14:28:45 -0400 Message-Id: <20190426182847.25088-4-jlayton@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426182847.25088-1-jlayton@kernel.org> References: <20190426182847.25088-1-jlayton@kernel.org> MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This means that kernfs_notify_workfn has to grow a strlen as well. Signed-off-by: Jeff Layton --- fs/kernfs/file.c | 6 ++++-- fs/notify/fsnotify.c | 8 ++++---- include/linux/fsnotify.h | 10 +++++----- include/linux/fsnotify_backend.h | 4 ++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index ae948aaa4c53..a43283c515f4 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c @@ -885,6 +885,8 @@ static void kernfs_notify_workfn(struct work_struct *work) list_for_each_entry(info, &kernfs_root(kn)->supers, node) { struct kernfs_node *parent; struct inode *inode; + const struct qstr name = { .name = kn->name, + .len = strlen(kn->name) }; /* * We want fsnotify_modify() on @kn but as the @@ -903,7 +905,7 @@ static void kernfs_notify_workfn(struct work_struct *work) p_inode = ilookup(info->sb, parent->id.ino); if (p_inode) { fsnotify(p_inode, FS_MODIFY | FS_EVENT_ON_CHILD, - inode, FSNOTIFY_EVENT_INODE, kn->name, 0); + inode, FSNOTIFY_EVENT_INODE, &name, 0); iput(p_inode); } @@ -911,7 +913,7 @@ static void kernfs_notify_workfn(struct work_struct *work) } fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE, - kn->name, 0); + &name, 0); iput(inode); } diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index fb22f76329ae..9cbb5ae11d2f 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -179,10 +179,10 @@ int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask take_dentry_name_snapshot(&name, dentry); if (path) ret = fsnotify(p_inode, mask, path, FSNOTIFY_EVENT_PATH, - name.name.name, 0); + &name.name, 0); else ret = fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE, - name.name.name, 0); + &name.name, 0); release_dentry_name_snapshot(&name); } @@ -325,7 +325,7 @@ static void fsnotify_iter_next(struct fsnotify_iter_info *iter_info) * notification event in whatever means they feel necessary. */ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, - const unsigned char *file_name, u32 cookie) + const struct qstr *file_name, u32 cookie) { struct fsnotify_iter_info iter_info = {}; struct super_block *sb = to_tell->i_sb; @@ -379,7 +379,7 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, */ while (fsnotify_iter_select_report_types(&iter_info)) { ret = send_to_group(to_tell, mask, data, data_is, cookie, - file_name, &iter_info); + file_name->name, &iter_info); if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS)) goto out; diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 2de90a7e388b..66e322df78a3 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -27,7 +27,7 @@ static inline int fsnotify_dirent(struct inode *dir, struct dentry *dentry, __u32 mask) { return fsnotify(dir, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, - dentry->d_name.name, 0); + &dentry->d_name, 0); } /* Notify this dentry's parent about a child's events. */ @@ -122,9 +122,9 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, } fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, - old_name->name, fs_cookie); + old_name, fs_cookie); fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, - moved->d_name.name, fs_cookie); + &moved->d_name, fs_cookie); if (target) fsnotify_link_count(target); @@ -177,7 +177,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) take_dentry_name_snapshot(&name, dentry); fsnotify(d_inode(parent), mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, - name.name.name, 0); + &name.name, 0); release_dentry_name_snapshot(&name); dput(parent); @@ -217,7 +217,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct fsnotify_link_count(inode); audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE); - fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); + fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0); } /* diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index dfc28fcb4de8..7eb7821766d5 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -350,7 +350,7 @@ struct fsnotify_mark { /* main fsnotify call to send events */ extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, - const unsigned char *name, u32 cookie); + const struct qstr *name, u32 cookie); extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask); extern void __fsnotify_inode_delete(struct inode *inode); extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); @@ -505,7 +505,7 @@ static inline void fsnotify_init_event(struct fsnotify_event *event, #else static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, - const unsigned char *name, u32 cookie) + const struct qstr *name, u32 cookie) { return 0; } From patchwork Fri Apr 26 18:28:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Layton X-Patchwork-Id: 10919557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 43AA11515 for ; Fri, 26 Apr 2019 18:29:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3605128E57 for ; Fri, 26 Apr 2019 18:29:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A1D528E5D; Fri, 26 Apr 2019 18:29:13 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 721A028E57 for ; Fri, 26 Apr 2019 18:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726411AbfDZS26 (ORCPT ); Fri, 26 Apr 2019 14:28:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:46960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725875AbfDZS25 (ORCPT ); Fri, 26 Apr 2019 14:28:57 -0400 Received: from tleilax.poochiereds.net (cpe-71-70-156-158.nc.res.rr.com [71.70.156.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3BCBC2166E; Fri, 26 Apr 2019 18:28:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556303336; bh=HUowgapcKvM2imJYDWUjZDUj1s3I+j+zfX+Jrh6XD1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ff2KBv0LzPtNTAtN95HZD/4UxMj+PufRhJMtAFD2tiHFKqIBKI6ZL5EojGZhtVQWD iRieIrOhDCILs5875hWzrkoKLhhSeOzw25a2+Z1orNyLLR7TFPOqRQoOroUs1KNTa0 x2aaIPW3+B2ssVFxB9nijq/i1Di/CoAXI8w8obco= From: Jeff Layton To: viro@zeniv.linux.org.uk Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, gregkh@linuxfoundation.org, tj@kernel.org, jack@suse.cz, amir73il@gmail.com, paul@paul-moore.com, eparis@redhat.com, linux-audit@redhat.com, rafael@kernel.org Subject: [PATCH 4/5] fsnotify: change ->handle_event and send_to_group to take a qstr Date: Fri, 26 Apr 2019 14:28:46 -0400 Message-Id: <20190426182847.25088-5-jlayton@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426182847.25088-1-jlayton@kernel.org> References: <20190426182847.25088-1-jlayton@kernel.org> MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jeff Layton --- fs/notify/dnotify/dnotify.c | 2 +- fs/notify/fanotify/fanotify.c | 2 +- fs/notify/fsnotify.c | 4 ++-- fs/notify/inotify/inotify.h | 2 +- fs/notify/inotify/inotify_fsnotify.c | 6 +++--- include/linux/fsnotify_backend.h | 2 +- kernel/audit_fsnotify.c | 5 +++-- kernel/audit_tree.c | 2 +- kernel/audit_watch.c | 6 +++--- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c index 58d77dc696eb..250369d6901d 100644 --- a/fs/notify/dnotify/dnotify.c +++ b/fs/notify/dnotify/dnotify.c @@ -81,7 +81,7 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark) static int dnotify_handle_event(struct fsnotify_group *group, struct inode *inode, u32 mask, const void *data, int data_type, - const unsigned char *file_name, u32 cookie, + const struct qstr *file_name, u32 cookie, struct fsnotify_iter_info *iter_info) { struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index 6b9c27548997..a34d7e003d7d 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c @@ -361,7 +361,7 @@ static __kernel_fsid_t fanotify_get_fsid(struct fsnotify_iter_info *iter_info) static int fanotify_handle_event(struct fsnotify_group *group, struct inode *inode, u32 mask, const void *data, int data_type, - const unsigned char *file_name, u32 cookie, + const struct qstr *file_name, u32 cookie, struct fsnotify_iter_info *iter_info) { int ret = 0; diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 9cbb5ae11d2f..5433e37fb0c5 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -195,7 +195,7 @@ EXPORT_SYMBOL_GPL(__fsnotify_parent); static int send_to_group(struct inode *to_tell, __u32 mask, const void *data, int data_is, u32 cookie, - const unsigned char *file_name, + const struct qstr *file_name, struct fsnotify_iter_info *iter_info) { struct fsnotify_group *group = NULL; @@ -379,7 +379,7 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, */ while (fsnotify_iter_select_report_types(&iter_info)) { ret = send_to_group(to_tell, mask, data, data_is, cookie, - file_name->name, &iter_info); + file_name, &iter_info); if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS)) goto out; diff --git a/fs/notify/inotify/inotify.h b/fs/notify/inotify/inotify.h index 74ae60305189..3f246f7b8a92 100644 --- a/fs/notify/inotify/inotify.h +++ b/fs/notify/inotify/inotify.h @@ -27,7 +27,7 @@ extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark, extern int inotify_handle_event(struct fsnotify_group *group, struct inode *inode, u32 mask, const void *data, int data_type, - const unsigned char *file_name, u32 cookie, + const struct qstr *file_name, u32 cookie, struct fsnotify_iter_info *iter_info); extern const struct fsnotify_ops inotify_fsnotify_ops; diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c index ff30abd6a49b..7e8b131029f8 100644 --- a/fs/notify/inotify/inotify_fsnotify.c +++ b/fs/notify/inotify/inotify_fsnotify.c @@ -67,7 +67,7 @@ static int inotify_merge(struct list_head *list, int inotify_handle_event(struct fsnotify_group *group, struct inode *inode, u32 mask, const void *data, int data_type, - const unsigned char *file_name, u32 cookie, + const struct qstr *file_name, u32 cookie, struct fsnotify_iter_info *iter_info) { struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); @@ -89,7 +89,7 @@ int inotify_handle_event(struct fsnotify_group *group, return 0; } if (file_name) { - len = strlen(file_name); + len = file_name->len; alloc_len += len + 1; } @@ -129,7 +129,7 @@ int inotify_handle_event(struct fsnotify_group *group, event->sync_cookie = cookie; event->name_len = len; if (len) - strcpy(event->name, file_name); + strcpy(event->name, file_name->name); ret = fsnotify_add_event(group, fsn_event, inotify_merge); if (ret) { diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 7eb7821766d5..c28f6ed1f59b 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -117,7 +117,7 @@ struct fsnotify_ops { int (*handle_event)(struct fsnotify_group *group, struct inode *inode, u32 mask, const void *data, int data_type, - const unsigned char *file_name, u32 cookie, + const struct qstr *file_name, u32 cookie, struct fsnotify_iter_info *iter_info); void (*free_group_priv)(struct fsnotify_group *group); void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); diff --git a/kernel/audit_fsnotify.c b/kernel/audit_fsnotify.c index 37ae95cfb7f4..6def7f426ba6 100644 --- a/kernel/audit_fsnotify.c +++ b/kernel/audit_fsnotify.c @@ -164,7 +164,7 @@ static void audit_autoremove_mark_rule(struct audit_fsnotify_mark *audit_mark) static int audit_mark_handle_event(struct fsnotify_group *group, struct inode *to_tell, u32 mask, const void *data, int data_type, - const unsigned char *dname, u32 cookie, + const struct qstr *dname, u32 cookie, struct fsnotify_iter_info *iter_info) { struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); @@ -188,7 +188,8 @@ static int audit_mark_handle_event(struct fsnotify_group *group, } if (mask & (FS_CREATE|FS_MOVED_TO|FS_DELETE|FS_MOVED_FROM)) { - if (audit_compare_dname_path(dname, audit_mark->path, AUDIT_NAME_FULL)) + if (audit_compare_dname_path(dname->name, audit_mark->path, + AUDIT_NAME_FULL)) return 0; audit_update_mark(audit_mark, inode); } else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF)) diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index abfb112f26aa..e49c912f862d 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c @@ -1040,7 +1040,7 @@ static void evict_chunk(struct audit_chunk *chunk) static int audit_tree_handle_event(struct fsnotify_group *group, struct inode *to_tell, u32 mask, const void *data, int data_type, - const unsigned char *file_name, u32 cookie, + const struct qstr *file_name, u32 cookie, struct fsnotify_iter_info *iter_info) { return 0; diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index e8d1adeb2223..3c12fd5b680e 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c @@ -482,7 +482,7 @@ void audit_remove_watch_rule(struct audit_krule *krule) static int audit_watch_handle_event(struct fsnotify_group *group, struct inode *to_tell, u32 mask, const void *data, int data_type, - const unsigned char *dname, u32 cookie, + const struct qstr *dname, u32 cookie, struct fsnotify_iter_info *iter_info) { struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); @@ -507,9 +507,9 @@ static int audit_watch_handle_event(struct fsnotify_group *group, } if (mask & (FS_CREATE|FS_MOVED_TO) && inode) - audit_update_watch(parent, dname, inode->i_sb->s_dev, inode->i_ino, 0); + audit_update_watch(parent, dname->name, inode->i_sb->s_dev, inode->i_ino, 0); else if (mask & (FS_DELETE|FS_MOVED_FROM)) - audit_update_watch(parent, dname, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1); + audit_update_watch(parent, dname->name, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1); else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF)) audit_remove_parent_watches(parent); From patchwork Fri Apr 26 18:28:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Layton X-Patchwork-Id: 10919555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BCB415A6 for ; Fri, 26 Apr 2019 18:29:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EDF928E58 for ; Fri, 26 Apr 2019 18:29:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 831D328E57; Fri, 26 Apr 2019 18:29:11 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 EF46828E58 for ; Fri, 26 Apr 2019 18:29:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726449AbfDZS3E (ORCPT ); Fri, 26 Apr 2019 14:29:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:47046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726409AbfDZS26 (ORCPT ); Fri, 26 Apr 2019 14:28:58 -0400 Received: from tleilax.poochiereds.net (cpe-71-70-156-158.nc.res.rr.com [71.70.156.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AE81A21655; Fri, 26 Apr 2019 18:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556303337; bh=qPguXvk3S40sXOgTeAXxt29eR11ACNXOhNQRyIoZS7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iBRasJCyL4p+vhW0pIUG8ly+IDXVGFUojd110zzACOkg6/Acop5Qe3hxZWPV7bLC6 Hj9KFqPyudUOMKklwD6GVJfukmZdaqe5Y0j0Qh0GxIvheRg65t1Dmo3Wrbzutqs0eC RM5db/pAiEzJDatZjRg0zNczopQ6Fr60Fbig2lFI= From: Jeff Layton To: viro@zeniv.linux.org.uk Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, gregkh@linuxfoundation.org, tj@kernel.org, jack@suse.cz, amir73il@gmail.com, paul@paul-moore.com, eparis@redhat.com, linux-audit@redhat.com, rafael@kernel.org Subject: [PATCH 5/5] audit: fix audit_compare_dname_path to take a qstr Date: Fri, 26 Apr 2019 14:28:47 -0400 Message-Id: <20190426182847.25088-6-jlayton@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426182847.25088-1-jlayton@kernel.org> References: <20190426182847.25088-1-jlayton@kernel.org> MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ...and eliminate its strlen call. Signed-off-by: Jeff Layton Acked-by: Paul Moore --- kernel/audit.h | 3 ++- kernel/audit_fsnotify.c | 2 +- kernel/audit_watch.c | 6 +++--- kernel/auditfilter.c | 7 ++++--- kernel/auditsc.c | 7 +++---- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/kernel/audit.h b/kernel/audit.h index 958d5b8fc1b3..8c581fd38050 100644 --- a/kernel/audit.h +++ b/kernel/audit.h @@ -231,7 +231,8 @@ extern int audit_comparator(const u32 left, const u32 op, const u32 right); extern int audit_uid_comparator(kuid_t left, u32 op, kuid_t right); extern int audit_gid_comparator(kgid_t left, u32 op, kgid_t right); extern int parent_len(const char *path); -extern int audit_compare_dname_path(const char *dname, const char *path, int plen); +extern int audit_compare_dname_path(const struct qstr *dname, const char *path, + int plen); extern struct sk_buff *audit_make_reply(int seq, int type, int done, int multi, const void *payload, int size); extern void audit_panic(const char *message); diff --git a/kernel/audit_fsnotify.c b/kernel/audit_fsnotify.c index 6def7f426ba6..af281e965d24 100644 --- a/kernel/audit_fsnotify.c +++ b/kernel/audit_fsnotify.c @@ -188,7 +188,7 @@ static int audit_mark_handle_event(struct fsnotify_group *group, } if (mask & (FS_CREATE|FS_MOVED_TO|FS_DELETE|FS_MOVED_FROM)) { - if (audit_compare_dname_path(dname->name, audit_mark->path, + if (audit_compare_dname_path(dname, audit_mark->path, AUDIT_NAME_FULL)) return 0; audit_update_mark(audit_mark, inode); diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index 3c12fd5b680e..b50c574223fa 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c @@ -255,7 +255,7 @@ static void audit_watch_log_rule_change(struct audit_krule *r, struct audit_watc /* Update inode info in audit rules based on filesystem event. */ static void audit_update_watch(struct audit_parent *parent, - const char *dname, dev_t dev, + const struct qstr *dname, dev_t dev, unsigned long ino, unsigned invalidating) { struct audit_watch *owatch, *nwatch, *nextw; @@ -507,9 +507,9 @@ static int audit_watch_handle_event(struct fsnotify_group *group, } if (mask & (FS_CREATE|FS_MOVED_TO) && inode) - audit_update_watch(parent, dname->name, inode->i_sb->s_dev, inode->i_ino, 0); + audit_update_watch(parent, dname, inode->i_sb->s_dev, inode->i_ino, 0); else if (mask & (FS_DELETE|FS_MOVED_FROM)) - audit_update_watch(parent, dname->name, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1); + audit_update_watch(parent, dname, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1); else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF)) audit_remove_parent_watches(parent); diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index 63f8b3f26fab..6f585b48f4ef 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c @@ -1290,12 +1290,13 @@ int parent_len(const char *path) * @parentlen: length of the parent if known. Passing in AUDIT_NAME_FULL * here indicates that we must compute this value. */ -int audit_compare_dname_path(const char *dname, const char *path, int parentlen) +int audit_compare_dname_path(const struct qstr *dname, const char *path, + int parentlen) { int dlen, pathlen; const char *p; - dlen = strlen(dname); + dlen = dname->len; pathlen = strlen(path); if (pathlen < dlen) return 1; @@ -1306,7 +1307,7 @@ int audit_compare_dname_path(const char *dname, const char *path, int parentlen) p = path + parentlen; - return strncmp(p, dname, dlen); + return strncmp(p, dname->name, dlen); } int audit_filter(int msgtype, unsigned int listtype) diff --git a/kernel/auditsc.c b/kernel/auditsc.c index d1eab1d4a930..05e06b766af1 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -2045,7 +2045,6 @@ void __audit_inode_child(struct inode *parent, { struct audit_context *context = audit_context(); struct inode *inode = d_backing_inode(dentry); - const char *dname = dentry->d_name.name; struct audit_names *n, *found_parent = NULL, *found_child = NULL; struct audit_entry *e; struct list_head *list = &audit_filter_list[AUDIT_FILTER_FS]; @@ -2083,7 +2082,7 @@ void __audit_inode_child(struct inode *parent, continue; if (n->ino == parent->i_ino && n->dev == parent->i_sb->s_dev && - !audit_compare_dname_path(dname, + !audit_compare_dname_path(&dentry->d_name, n->name->name, n->name_len)) { if (n->type == AUDIT_TYPE_UNKNOWN) n->type = AUDIT_TYPE_PARENT; @@ -2099,8 +2098,8 @@ void __audit_inode_child(struct inode *parent, (n->type != type && n->type != AUDIT_TYPE_UNKNOWN)) continue; - if (!strcmp(dname, n->name->name) || - !audit_compare_dname_path(dname, n->name->name, + if (!strcmp(dentry->d_name.name, n->name->name) || + !audit_compare_dname_path(&dentry->d_name, n->name->name, found_parent ? found_parent->name_len : AUDIT_NAME_FULL)) {