Re: [PATCH] char: misc: make misc_open() and misc_register() killable

Greg KH
2022-07-04T11:01:23Z

On Mon, Jul 04, 2022 at 07:25:44PM +0900, Tetsuo Handa wrote:
> On 2022/07/04 16:29, Greg KH wrote:
> > On Mon, Jul 04, 2022 at 03:44:07PM +0900, Tetsuo Handa wrote:
> >> syzbot is reporting hung task at misc_open() [1], for snapshot_open() from
> >> misc_open() might sleep for long with misc_mtx held whereas userspace can
> >> flood with concurrent misc_open() requests. Mitigate this problem by making
> >> misc_open() and misc_register() killable.
> >
> > I do not understand, why not just fix snapshot_open()? Why add this
> > complexity to the misc core for a foolish individual misc device? Why
> > not add the fix there where it is spinning instead?
>
> Quoting an example from [1]. Multiple processes are calling misc_open() and
> all but one processes are blocked at mutex_lock(&misc_mtx). The one which is
> not blocked at mutex_lock(&misc_mtx) is also holding system_transition_mutex.

And that is because of that one misc device, right? Why not fix that
instead of papering over the issue in the misc core?

thanks,

greg k-h