[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025082545-extrovert-photo-3358@gregkh>
Date: Mon, 25 Aug 2025 22:27:28 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: xion.wang@...iatek.com
Cc: Arnd Bergmann <arnd@...db.de>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
wsd_upstream@...iatek.com, huadian.liu@...iatek.com,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH 0/1] misc: Prevent double registration and deregistration
of miscdevice
On Mon, Aug 25, 2025 at 04:45:46PM +0800, xion.wang@...iatek.com wrote:
> From: Xion Wang <xion.wang@...iatek.com>
>
> Dear maintainers,
>
> I am submitting a patch to improve the robustness of the misc device subsystem in the Linux kernel.
>
> In the current implementation, repeated calls to misc_register() or misc_deregister() on the same miscdevice instance may result in corruption of the misc_list or kernel crash due to multiple INIT_LIST_HEAD or list_del operations on the same list node.
Don't do that then :)
Seriously, what in-tree driver does that?
> This patch introduces additional checks in both misc_register() and misc_deregister() to prevent double registration and double deregistration. By using misc->this_device as a status flag, the driver can safely determine whether the device has already been registered or deregistered, and avoid performing dangerous operations on the misc_list.
>
> With these changes, the misc device subsystem becomes more stable and reliable, reducing the risks of list corruption and improving overall system safety.
But again, what driver is doing this? Why is this really needed?
thanks,
greg k-h
Powered by blists - more mailing lists