From: "J. Bruce Fields" <bfields@fieldses.org>
To: Jeff Layton <jeff.layton@primarydata.com>
Cc: Chengyu Song <csong84@gatech.edu>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
taesoo@gatech.edu, changwoo@gatech.edu, sanidhya@gatech.edu,
blee@gatech.edu
Subject: Re: [PATCH 1/1] nfsd: incorrect check for debugfs returns
Date: Wed, 25 Mar 2015 11:08:56 -0400 [thread overview]
Message-ID: <20150325150856.GB13764@fieldses.org> (raw)
In-Reply-To: <20150324064420.515096c7@tlielax.poochiereds.net>
On Tue, Mar 24, 2015 at 06:44:20AM -0400, Jeff Layton wrote:
> On Mon, 23 Mar 2015 22:58:05 -0400
> Chengyu Song <csong84@gatech.edu> wrote:
>
> > debugfs_create_dir and debugfs_create_file may return -ENODEV when debugfs
> > is not configured, so the return value should be checked against ERROR_VALUE
> > as well, otherwise the later dereference of the dentry pointer would crash
> > the kernel.
> >
> > Signed-off-by: Chengyu Song <csong84@gatech.edu>
> > ---
> > fs/nfsd/fault_inject.c | 12 ++++++++----
> > 1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/fs/nfsd/fault_inject.c b/fs/nfsd/fault_inject.c
> > index c16bf5a..621d065 100644
> > --- a/fs/nfsd/fault_inject.c
> > +++ b/fs/nfsd/fault_inject.c
> > @@ -132,19 +132,23 @@ int nfsd_fault_inject_init(void)
> > unsigned int i;
> > struct nfsd_fault_inject_op *op;
> > umode_t mode = S_IFREG | S_IRUSR | S_IWUSR;
> > + struct dentry *dent;
> >
> > - debug_dir = debugfs_create_dir("nfsd", NULL);
> > - if (!debug_dir)
> > + dent = debugfs_create_dir("nfsd", NULL);
> > + if (IS_ERR_OR_NULL(dent))
> > goto fail;
> > + debug_dir = dent;
> >
> > for (i = 0; i < NUM_INJECT_OPS; i++) {
> > op = &inject_ops[i];
> > - if (!debugfs_create_file(op->file, mode, debug_dir, op, &fops_nfsd))
> > + dent = debugfs_create_file(op->file, mode, debug_dir, op, &fops_nfsd);
> > + if (IS_ERR_OR_NULL(dent))
> > goto fail;
> > +
> > }
> > return 0;
> >
> > fail:
> > nfsd_fault_inject_cleanup();
> > - return -ENOMEM;
> > + return dent ? PTR_ERR(dent) : -ENOMEM;
> > }
>
> No objection to taking this patch in the near term if it helps, but we
> had discussed over the summer just removing the NFS fault injection
> framework.
>
> Bruce, any objections to making that happen for v4.1?
I was prepared to, but I think Redhat QA people told me that they do use
it--which means other people may too, so I'm sort of reluctant to tear
it out even if it's imperfect.
--b.
next prev parent reply other threads:[~2015-03-25 15:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-24 2:58 [PATCH 1/1] nfsd: incorrect check for debugfs returns Chengyu Song
2015-03-24 10:44 ` Jeff Layton
2015-03-25 15:08 ` J. Bruce Fields [this message]
2015-03-25 15:49 ` Jeff Layton
2015-03-25 15:17 ` J. Bruce Fields
2015-03-25 16:41 ` Chengyu Song
2015-03-25 20:09 ` J. Bruce Fields
2015-03-25 20:41 ` Chengyu Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150325150856.GB13764@fieldses.org \
--to=bfields@fieldses.org \
--cc=blee@gatech.edu \
--cc=changwoo@gatech.edu \
--cc=csong84@gatech.edu \
--cc=jeff.layton@primarydata.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=sanidhya@gatech.edu \
--cc=taesoo@gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox