From: "J. Bruce Fields" <bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
To: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Tetsuo Handa
<penguin-kernel-JPay3/Yim36HaxMnTkn67Xf5DAMn2ifp@public.gmane.org>,
linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: linux-next NFSD: NULL pointer dereference at nfsd_svc()
Date: Mon, 2 Aug 2010 14:16:34 -0400 [thread overview]
Message-ID: <20100802181634.GD12637@fieldses.org> (raw)
In-Reply-To: <20100802103620.5638dac1-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
On Mon, Aug 02, 2010 at 10:36:20AM -0400, Jeff Layton wrote:
> nevermind...that patch will probably fix this panic, but there's another
> possible one in nfsd_init_socks. We'll have to fix that one too.
(After private conversation with Jeff): something like this?
Compile-tested only.
--b.
commit 86d0cc3b91315c475c1c38ee7a06b5ebe5c01755
Author: J. Bruce Fields <bfields-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Date: Mon Aug 2 14:12:44 2010 -0400
nfsd: fix startup/shutdown order bug
We must create the server before we can call init_socks or check the
number of threads.
Symptoms were a NULL pointer dereference in nfsd_svc(). Problem
identified by Jeff Layton.
Reported-by: Tetsuo Handa <penguin-kernel-JPay3/Yim36HaxMnTkn67Xf5DAMn2ifp@public.gmane.org>
Signed-off-by: J. Bruce Fields <bfields-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 92173bd..1de1cb3 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -432,29 +432,30 @@ nfsd_svc(unsigned short port, int nrservs)
if (nrservs == 0 && nfsd_serv == NULL)
goto out;
+ error = nfsd_create_serv();
+ if (error)
+ goto out;
+
first_thread = (nfsd_serv->sv_nrthreads == 0) && (nrservs != 0);
if (first_thread) {
error = nfsd_startup(port, nrservs);
if (error)
- goto out;
+ goto out_destroy;
}
- error = nfsd_create_serv();
- if (error)
- goto out_shutdown;
error = svc_set_num_threads(nfsd_serv, NULL, nrservs);
if (error)
- goto out_destroy;
+ goto out_shutdown;
/* We are holding a reference to nfsd_serv which
* we don't want to count in the return value,
* so subtract 1
*/
error = nfsd_serv->sv_nrthreads - 1;
-out_destroy:
- svc_destroy(nfsd_serv); /* Release server */
out_shutdown:
if (error < 0 && first_thread)
nfsd_shutdown();
+out_destroy:
+ svc_destroy(nfsd_serv); /* Release server */
out:
mutex_unlock(&nfsd_mutex);
return error;
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-08-02 18:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-02 7:47 linux-next NFSD: NULL pointer dereference at nfsd_svc() Tetsuo Handa
2010-08-02 14:32 ` Jeff Layton
2010-08-02 14:36 ` Jeff Layton
[not found] ` <20100802103620.5638dac1-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-08-02 18:16 ` J. Bruce Fields [this message]
2010-08-02 18:53 ` Jeff Layton
[not found] ` <20100802181634.GD12637-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2010-08-03 1:09 ` Tetsuo Handa
2010-08-03 15:48 ` J. Bruce Fields
2010-08-03 16:24 ` J. Bruce Fields
[not found] ` <20100803154851.GA23467-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2010-08-04 0:13 ` Tetsuo Handa
[not found] ` <201008040013.o740DmYK024832-etx+eQDEXHD7nzcFbJAaVXf5DAMn2ifp@public.gmane.org>
2010-08-04 19:40 ` J. Bruce Fields
[not found] ` <20100804194045.GD18200-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2010-08-05 1:10 ` Tetsuo Handa
[not found] ` <201008050110.o751AG18066496-etx+eQDEXHD7nzcFbJAaVXf5DAMn2ifp@public.gmane.org>
2010-08-05 20:46 ` J. Bruce Fields
[not found] ` <20100805204612.GA13821-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2010-08-05 21:31 ` J. Bruce Fields
[not found] ` <20100805213107.GB13821-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2010-08-06 1:37 ` Tetsuo Handa
2010-08-06 21:27 ` J. Bruce Fields
[not found] ` <20100806212727.GC29536-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2010-08-06 22:05 ` J. Bruce Fields
2010-08-06 22:10 ` J. Bruce Fields
[not found] ` <20100806221000.GF29536-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2010-08-07 1:48 ` Tetsuo Handa
2010-08-07 2:33 ` J. Bruce Fields
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=20100802181634.GD12637@fieldses.org \
--to=bfields-uc3wqj2krung9huczpvpmw@public.gmane.org \
--cc=jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=penguin-kernel-JPay3/Yim36HaxMnTkn67Xf5DAMn2ifp@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).