Re: WARNING: at lib/idr.c:678 idr_find_slowpath+0x97/0xc0()

From: Tejun Heo
Date: Fri Mar 01 2013 - 16:35:22 EST


Hello, Andrew.

On Fri, Mar 01, 2013 at 01:31:59PM -0800, Andrew Morton wrote:
> okluar passed a negative `wd' into inotify_rm_watch()?
>
> I wonder why it did that. I doubt if inotify_add_watch() ever returns
> negative descriptors, in which case I expect that okular's call to
> inotify_add_watch() returned -1 and an errno and okular forgot to check
> it, and later passed that -1 back into inotify_rm_watch().
>
> Anyway, I guess we need to make inotify_add_watch() refuse to return
> negative descriptors (presumably this is already the case due to idr
> internals) and make inotify_rm_watch() trap negative values of `wd' up
> front.
>
> I wonder how many other such gremlins the IDR checking has added.

The WARN_ON() is just for cases where someone might be doing something
crazy with the previous behavior of ignoring high bit. Maybe I was
being overly paranoid and we should just drop it from idr_find().

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/