[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1361385853-29010-1-git-send-email-sasha.levin@oracle.com>
Date: Wed, 20 Feb 2013 13:44:13 -0500
From: Sasha Levin <sasha.levin@...cle.com>
To: tj@...nel.org
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
Sasha Levin <sasha.levin@...cle.com>
Subject: [PATCH] idr: prevent NULL deref on lookups before insertions
'hint' will be NULL if we're looking up before adding anything
to the IDR.
Signed-off-by: Sasha Levin <sasha.levin@...cle.com>
---
include/linux/idr.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/idr.h b/include/linux/idr.h
index aed2a0c..a6f38b5 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -113,7 +113,7 @@ static inline void *idr_find(struct idr *idr, int id)
{
struct idr_layer *hint = rcu_dereference_raw(idr->hint);
- if ((id & ~IDR_MASK) == hint->prefix)
+ if (hint && (id & ~IDR_MASK) == hint->prefix)
return rcu_dereference_raw(hint->ary[id & IDR_MASK]);
return idr_find_slowpath(idr, id);
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists