summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTetsuo Handa2019-08-12 04:16:11 +0200
committerJ. Bruce Fields2019-08-15 20:53:00 +0200
commitd6846bfbeeac873d85f32bd2b988fa94c89dbcb8 (patch)
tree6a25ba0ff6a531dff603b34e1f5c92c727210a06
parentLinux 5.3-rc2 (diff)
downloadkernel-qcow2-linux-d6846bfbeeac873d85f32bd2b988fa94c89dbcb8.tar.gz
kernel-qcow2-linux-d6846bfbeeac873d85f32bd2b988fa94c89dbcb8.tar.xz
kernel-qcow2-linux-d6846bfbeeac873d85f32bd2b988fa94c89dbcb8.zip
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 <penguin-kernel@I-love.SAKURA.ne.jp> Reported-by: syzbot <syzbot+2c95195d5d433f6ed6cb@syzkaller.appspotmail.com> Fixes: e8a79fb14f6b76b5 ("nfsd: add nfsd/clients directory") [bfields: clean up in nfsd_mkdir instead of __nfsd_mkdir] Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfsctl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 13c548733860..928a0b2c05dc 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;
}