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

From: Andrew Morton
Date: Fri Mar 01 2013 - 16:32:09 EST


On Thu, 28 Feb 2013 10:08:46 +0100
markus@xxxxxxxxxxxxxxx wrote:

> Just hit the following warning on current git tree:
>
> ------------[ cut here ]------------
> WARNING: at lib/idr.c:678 idr_find_slowpath+0x97/0xc0()
> Hardware name: System Product Name
> Pid: 12366, comm: okular Not tainted 3.8.0-09633-g2a7d2b9-dirty #312
> Call Trace:
> [<ffffffff8105b7a0>] ? warn_slowpath_common+0x60/0xa0
> [<ffffffff811bf557>] ? idr_find_slowpath+0x97/0xc0
> [<ffffffff811249f2>] ? inotify_idr_find_locked+0x32/0x80
> [<ffffffff810ecf7d>] ? fput+0x1d/0xc0
> [<ffffffff811254d0>] ? sys_inotify_rm_watch+0x50/0xc0
> [<ffffffff814c9f58>] ? int_signal+0x12/0x17
> [<ffffffff814c9d52>] ? system_call_fastpath+0x16/0x1b

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.
--
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/