From: Steve Dickson <SteveD@redhat.com>
To: nfs@lists.sourceforge.net, Trond Myklebust <Trond.Myklebust@netapp.com>
Subject: [PATCH] SUNRPC: Invalid BUG_ON() popping in rpc_release_task()
Date: Sun, 21 Jan 2007 06:53:05 -0500 [thread overview]
Message-ID: <45B35421.1010908@RedHat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 880 bytes --]
Over the weekend, while doing some Secure NFS testing, I found
that the BUG_ON() in rpc_release_task() would pop when
the Kerberos server was not set up correctly (which I know is a
very common problem when people start using this feature).
The code path looks like:
rpc_call_sync() calls rpc_call_setup() which calls rpcauth_bindcred()
which fails (due to a krb5 problem) and sets tk_status to -EACCES.
Back in rpc_call_sync(), since (tk_status != 0) rpc_release_task()
is called. Unfortunately, since this task was never active,
(meaning rpc_execute() and rpc_set_active() were never called)
the tk_magic id was never set and the global task list was
never set up. So when rpc_release_task() is call, the world
come tumbling down...
So the attached patch ensures the RPC_TASK_ACTIVE run state bit
is set before calling the BUG_ON() and cleaning up the task
list.
steved.
[-- Attachment #2: linux-2.6.20-rpc-sec-error.patch --]
[-- Type: text/x-patch, Size: 1024 bytes --]
Only check the magic number and clean the tk_task queue
iff the task was active.
Signed-off-by: Steve Dickson <steved@redhat.com>
-------------------------------------------------
--- nfs-2.6/net/sunrpc/sched.c.orig 2006-12-23 07:03:31.000000000 -0500
+++ nfs-2.6/net/sunrpc/sched.c 2007-01-21 06:17:32.000000000 -0500
@@ -898,16 +898,18 @@ EXPORT_SYMBOL(rpc_put_task);
void rpc_release_task(struct rpc_task *task)
{
-#ifdef RPC_DEBUG
- BUG_ON(task->tk_magic != RPC_TASK_MAGIC_ID);
-#endif
dprintk("RPC: %4d release task\n", task->tk_pid);
- /* Remove from global task list */
- spin_lock(&rpc_sched_lock);
- list_del(&task->tk_task);
- spin_unlock(&rpc_sched_lock);
+ if (test_bit(RPC_TASK_ACTIVE, &task->tk_runstate)) {
+#ifdef RPC_DEBUG
+ BUG_ON(task->tk_magic != RPC_TASK_MAGIC_ID);
+#endif
+ /* Remove from global task list */
+ spin_lock(&rpc_sched_lock);
+ list_del(&task->tk_task);
+ spin_unlock(&rpc_sched_lock);
+ }
BUG_ON (RPC_IS_QUEUED(task));
/* Synchronously delete any running timer */
[-- Attachment #3: Type: text/plain, Size: 347 bytes --]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
next reply other threads:[~2007-01-21 11:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-21 11:53 Steve Dickson [this message]
2007-01-21 17:25 ` [PATCH] SUNRPC: Invalid BUG_ON() popping in rpc_release_task() Trond Myklebust
2007-01-21 19:59 ` Steve Dickson
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=45B35421.1010908@RedHat.com \
--to=steved@redhat.com \
--cc=Trond.Myklebust@netapp.com \
--cc=nfs@lists.sourceforge.net \
/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