All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb-hid-core: Set intfdata to NULL if probe fails
@ 2012-05-21 19:39 Hans de Goede
  2012-05-22  7:56 ` Jiri Slaby
  0 siblings, 1 reply; 9+ messages in thread
From: Hans de Goede @ 2012-05-21 19:39 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-kernel, Hans de Goede

Having a dangling pointer in intfdata is no good, and may actually bite
other drivers which rely on frameworks which only call dev_set_drvdata
on the interface's device if no drvdata has been set (which is how I
found out that usb-hid-core leaves the dangling pointer in there).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/hid/usbhid/hid-core.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 5bf91db..70d760f 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1296,6 +1296,7 @@ err_free:
 	kfree(usbhid);
 err:
 	hid_destroy_device(hid);
+	usb_set_intfdata(intf, NULL);
 	return ret;
 }
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-05-22 22:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-21 19:39 [PATCH] usb-hid-core: Set intfdata to NULL if probe fails Hans de Goede
2012-05-22  7:56 ` Jiri Slaby
2012-05-22  8:09   ` Hans de Goede
2012-05-22  8:29     ` Jiri Slaby
2012-05-22  9:33       ` Hans de Goede
2012-05-22 22:00         ` Jiri Kosina
2012-05-22 22:08           ` Hans de Goede
2012-05-22 22:10           ` Greg KH
2012-05-22 22:14             ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.