Messages in this thread Patch in this message | | | From | Sasha Levin <> | Subject | [PATCH] idr: prevent NULL deref on lookups before insertions | Date | Wed, 20 Feb 2013 13:44:13 -0500 |
| |
'hint' will be NULL if we're looking up before adding anything to the IDR.
Signed-off-by: Sasha Levin <sasha.levin@oracle.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
| |