The patch titled Subject: autofs: drop dentry reference only when it is never used has been added to the -mm tree. Its filename is autofs-drop-dentry-reference-only-when-it-is-never-used.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/autofs-drop-dentry-reference-only-when-it-is-never-used.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/autofs-drop-dentry-reference-only-when-it-is-never-used.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Pan Bian <bianpan2016@xxxxxxx> Subject: autofs: drop dentry reference only when it is never used autofs_expire_run() calls dput(dentry) to drop the reference count of dentry. However, dentry is read via autofs_dentry_ino(dentry) after that. This may result in a use-free-bug. The patch drops the reference count of dentry only when it is never used. Link: http://lkml.kernel.org/r/154725122396.11260.16053424107144453867.stgit@pluto-themaw-net Signed-off-by: Pan Bian <bianpan2016@xxxxxxx> Signed-off-by: Ian Kent <raven@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/autofs/expire.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/autofs/expire.c~autofs-drop-dentry-reference-only-when-it-is-never-used +++ a/fs/autofs/expire.c @@ -596,7 +596,6 @@ int autofs_expire_run(struct super_block pkt.len = dentry->d_name.len; memcpy(pkt.name, dentry->d_name.name, pkt.len); pkt.name[pkt.len] = '\0'; - dput(dentry); if (copy_to_user(pkt_p, &pkt, sizeof(struct autofs_packet_expire))) ret = -EFAULT; @@ -609,6 +608,8 @@ int autofs_expire_run(struct super_block complete_all(&ino->expire_complete); spin_unlock(&sbi->fs_lock); + dput(dentry); + return ret; } _ Patches currently in -mm which might be from bianpan2016@xxxxxxx are autofs-drop-dentry-reference-only-when-it-is-never-used.patch