linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* semaphore driver_input_lock and device removal
@ 2021-03-01 15:32 Uwe Kleine-König
  0 siblings, 0 replies; only message in thread
From: Uwe Kleine-König @ 2021-03-01 15:32 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires; +Cc: linux-input, Greg Kroah-Hartman, kernel

[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]

Hello Jiri, hello Benjamin,

I'm working on making struct bus_type::remove return void (instead of
int), see for example commit 0d519e0d52ee7c532d4018b90cd0b042d374c06d
for the idea and motivation.

Looking at the function hid_device_remove() there is an error path that
makes the function return -EINTR if taking the semaphore
&hdev->driver_input_lock is interrupted.

If this exit path is taken the hid remove callback isn't called but the
driver core considers the device unbound and frees resources which might
then run into problems because the driver might continue to use these
resources.

I tried to understand how this semaphore is to be used, but I'm unsure
if if missed something. Can this semaphore just be converted to a mutex?
Or is using down() here instead the right thing to do even though down()
is deprecated according to the comment before its implementation?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-01 15:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 15:32 semaphore driver_input_lock and device removal Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).