From: Peter Hurley <peter@hurleysoftware.com>
To: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH] idr: Don't WARN in idr_find
Date: Mon, 25 Feb 2013 20:37:12 -0500 [thread overview]
Message-ID: <1361842632-29689-1-git-send-email-peter@hurleysoftware.com> (raw)
Since idr is used for syscall apis (to associate 'handles' with
internal structures), don't WARN with invalid input.
For example, POSIX timers are identified by timer_t id. These
ids are idr values. If userspace passes a representable timer_t id
value (eg, id < 0) but which was not previous allocated (since the
current idr api does not return negative idr values), then the
syscall properly returns an error; a WARN is unnecessary and
undesirable.
[ 188.957053] WARNING: at /home/peter/src/kernels/next/lib/idr.c:669 idr_find_slowpath+0x151/0x170()
[ 188.957055] Hardware name: Bochs
[ 188.957105] Modules linked in: nfnetlink scsi_transport_iscsi can_raw ipt_ULOG
<...snip...>
[ 188.957109] Pid: 2682, comm: trinity-child2 Not tainted 3.9.0-next-20130220+ldsem-xeon+lockdep #20130220+ldsem
[ 188.957112] Call Trace:
[ 188.957124] [<ffffffff8105ecdf>] warn_slowpath_common+0x7f/0xc0
[ 188.957126] [<ffffffff8105ed3a>] warn_slowpath_null+0x1a/0x20
[ 188.957129] [<ffffffff813a8691>] idr_find_slowpath+0x151/0x170
[ 188.957139] [<ffffffff8108d787>] __lock_timer+0x97/0x2b0
[ 188.957142] [<ffffffff8108d6f5>] ? __lock_timer+0x5/0x2b0
[ 188.957145] [<ffffffff8108e0b7>] sys_timer_getoverrun+0x17/0x50
[ 188.957152] [<ffffffff817aeb99>] system_call_fastpath+0x16/0x1b
[ 188.957156] ---[ end trace 25fe46b21eb9d42d ]---
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
lib/idr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/idr.c b/lib/idr.c
index 1a30272..8e9b1ac 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -666,7 +666,7 @@ void *idr_find_slowpath(struct idr *idp, int id)
int n;
struct idr_layer *p;
- if (WARN_ON_ONCE(id < 0))
+ if (id < 0)
return NULL;
p = rcu_dereference_raw(idp->top);
--
1.8.1.2
next reply other threads:[~2013-02-26 1:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-26 1:37 Peter Hurley [this message]
2013-02-26 1:40 ` [PATCH] idr: Don't WARN in idr_find Tejun Heo
2013-02-26 1:46 ` Peter Hurley
2013-02-26 1:48 ` Tejun Heo
2013-02-26 2:07 ` Peter Hurley
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=1361842632-29689-1-git-send-email-peter@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.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