Re: [PATCH] rust: miscdevice: Export vtable testing
From: Greg KH
Date: Sat Jun 28 2025 - 02:06:53 EST
On Fri, Jun 27, 2025 at 11:42:38PM +0000, Matthew Maurer wrote:
> A common pattern in the kernel is to test whether a file belongs to a
> particular driver by checking its `f_op` struct against an expected
> value. This provides a safe way to perform that test for `MiscDevice`
> implementations without needing to directly expose the vtable.
Ick, who does that? And why? Who cares within the kernel what driver
owns a fd as why would any driver ever be passed a fd that is not owned
by it?
I would like to see a real user first please, or point out some places
in the kernel today that does this so we can go and fix them up :)
thanks,
greg k-h