From: J. Bruce Fields Date: Thu, 19 Jan 2006 01:43:29 +0000 (-0800) Subject: [PATCH] nfsd4: recovery lookup dir check X-Git-Tag: firefly_0821_release~38659 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c2642ab05b855d2d3b850ddf90dbb02b1b9358ac;hp=d22749b62f3e12de26b86a200f9a5bf7afe3590e;p=firefly-linux-kernel-4.4.55.git [PATCH] nfsd4: recovery lookup dir check Make sure we get a directory when we look up the recovery directory. Thanks to Christoph Hellwig for the bug report. Based on feedback from Christoph and others, we may remove the need for this lookup and just pass in a file descriptor from userspace instead, and/or completely move the directory handling to userspace. For now we're just fixing the obvious bugs. Signed-off-by: J. Bruce Fields Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index 64f4af3651a1..06da7506363c 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -399,9 +399,10 @@ nfsd4_init_recdir(char *rec_dirname) nfs4_save_user(&uid, &gid); - status = path_lookup(rec_dirname, LOOKUP_FOLLOW, &rec_dir); - if (status == -ENOENT) - printk("NFSD: recovery directory %s doesn't exist\n", + status = path_lookup(rec_dirname, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, + &rec_dir); + if (status) + printk("NFSD: unable to find recovery directory %s\n", rec_dirname); if (!status)