[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121019170951.GM2616@ZenIV.linux.org.uk>
Date: Fri, 19 Oct 2012 18:09:51 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Dave Jones <davej@...hat.com>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: weird use-after-free bug in module_put
On Fri, Oct 19, 2012 at 09:33:18AM -0700, Dmitry Torokhov wrote:
> We are now removing instance of character device corresponding to input
> device when input device disappears.
>
> Ah, I know... cdev is embedded in evdev, but lives longer.. I do want to
> keep cdev embedded as it allows me to easily get to evdev in
> evdev_open(), but I need to be able to add and then drop reference to
> evdev from cdev's ->release() method. This means I need to override it.
>
> Or I could have cdev separately allocated, but then I'd like to have a
> void pointer in "struct cdev" so I could get from it back to
> corresponding evdev.
Your real problem is that you have two kobjects embedded into the same
thing. It can work, but you need to make the secondary (one that does
*not* free in its ->release()) pin the primary. Sigh... Device model
sucks, film at 11...
--
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