From: Tetsuo Handa Date: Mon, 12 Aug 2019 02:16:11 +0000 (+0900) Subject: nfsd: fix dentry leak upon mkdir failure. X-Git-Tag: v5.4-rc1~305^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d6846bfbeeac873d85f32bd2b988fa94c89dbcb8;p=platform%2Fkernel%2Flinux-rpi.git nfsd: fix dentry leak upon mkdir failure. syzbot is reporting that nfsd_mkdir() forgot to remove dentry created by d_alloc_name() when __nfsd_mkdir() failed (due to memory allocation fault injection) [1]. [1] https://syzkaller.appspot.com/bug?id=ce41a1f769ea4637ebffedf004a803e8405b4674 Signed-off-by: Tetsuo Handa Reported-by: syzbot Fixes: e8a79fb14f6b76b5 ("nfsd: add nfsd/clients directory") [bfields: clean up in nfsd_mkdir instead of __nfsd_mkdir] Signed-off-by: J. Bruce Fields --- diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 13c5487..928a0b2 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1205,6 +1205,7 @@ out: inode_unlock(dir); return dentry; out_err: + dput(dentry); dentry = ERR_PTR(ret); goto out; }