LKML Archive on
help / color / mirror / Atom feed
From: Jeff Layton <>
To: "J. Bruce Fields" <>
Subject: Re: [PATCH 1/4] SUNRPC: spin svc_rqst initialization to its own function
Date: Fri, 18 Jan 2008 16:48:44 -0500	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, 18 Jan 2008 15:59:43 -0500
"J. Bruce Fields" <> wrote:

> On Mon, Jan 14, 2008 at 09:05:15AM -0500, Jeff Layton wrote:
> > Move the initialzation in __svc_create_thread that happens prior to
> > thread creation to a new function. Export the function to allow
> > services to have better control over the svc_rqst structs.
> > 
> > Also rearrange the rqstp initialization to prevent NULL pointer
> > dereferences in svc_exit_thread in case allocations fail.
> Those NULL dereferences are from the
> 	list_del(&rqstp->rq_all);
> ?  OK, make sense.  Thanks!
> --b.

Sorry, I didn't explain that well...

This was the problem that Neil pointed out with the existing code. If
the rqstp kzalloc succeeds, but the later kmallocs in
__svc_create_thread fail, we goto here:


svc_exit_thread does this:

    struct svc_pool *pool = rqstp->rq_pool;

...and then later:


...but rq_pool is set after the kmallocs, so if they fail rq_pool will
be NULL, and we'll oops in that spin_lock_bh().

The fix is to move the kmallocs closer to the bottom in the new
svc_prepare_thread function.

Jeff Layton <>

  reply	other threads:[~2008-01-18 21:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-14 14:05 [PATCH 0/4] Intro: convert lockd to kthread and fix use-after-free (try #8) Jeff Layton
2008-01-14 14:05 ` [PATCH 1/4] SUNRPC: spin svc_rqst initialization to its own function Jeff Layton
2008-01-14 14:05   ` [PATCH 2/4] SUNRPC: export svc_sock_update_bufs Jeff Layton
2008-01-14 14:05     ` [PATCH 3/4] NLM: Convert lockd to use kthreads Jeff Layton
2008-01-14 14:05       ` [PATCH 4/4] NLM: have nlm_shutdown_hosts kill off all NLM RPC tasks Jeff Layton
2008-01-18 21:43         ` J. Bruce Fields
2008-01-18 22:07           ` Jeff Layton
2008-01-18 20:59   ` [PATCH 1/4] SUNRPC: spin svc_rqst initialization to its own function J. Bruce Fields
2008-01-18 21:48     ` Jeff Layton [this message]
2008-01-18 21:51       ` 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \
    --subject='Re: [PATCH 1/4] SUNRPC: spin svc_rqst initialization to its own function' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).