Re: [PATCH] drivers:uio: Fix system crashes during driver switchover

From: Greg KH
Date: Tue May 17 2022 - 03:37:26 EST


On Wed, May 11, 2022 at 04:51:11PM +0800, zhanghongtao (A) wrote:
> Thanks for your reply.
> I looked through the historical emails and thought I was not the
> same problem as his.
> After the driver is switched, the application can still operate
> on the mapped address, which causes the system to crash.
> The application is not aware of the driver's switchover.
> The solution I can think of is to block the switch and wait for
> the application to release before switching, as shown in the patch.
> So want to seek help from the community, how to solve it better?
> Is there a better way?

Yes, do not unbind the driver from the device unless all userspace
programs have stopped using the device.

Also, do not use the UIO driver for disk devices, that way is crazy, use
a real block driver. What prevents you from doing that today?

thanks,

greg k-h