public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] out of bounds access in hiddev_cleanup
@ 2004-05-19 17:39 Olaf Hering
  2004-05-20 10:15 ` Vojtech Pavlik
  0 siblings, 1 reply; 2+ messages in thread
From: Olaf Hering @ 2004-05-19 17:39 UTC (permalink / raw)
  To: akpm, Vojtech Pavlik; +Cc: linux-kernel


hiddev_table[] is an array of pointers. the minor number is used as an
offset. hiddev minors start either with zero, or with 96.
If they start with 96, the offset must be reduced by HIDDEV_MINOR_BASE
because only 16 minors are available.
unplugging a hiddevice will zero data outside the hiddev_table array.

this was spotted by Takashi Iwai.

--- linux-2.6.5/drivers/usb/input/hiddev.c-dist	2004-05-16 17:16:20.260126241 +0200
+++ linux-2.6.5/drivers/usb/input/hiddev.c	2004-05-16 17:16:55.285207314 +0200
@@ -232,7 +232,7 @@ static int hiddev_fasync(int fd, struct 
 static struct usb_class_driver hiddev_class;
 static void hiddev_cleanup(struct hiddev *hiddev)
 {
-	hiddev_table[hiddev->hid->minor] = NULL;
+	hiddev_table[hiddev->hid->minor - HIDDEV_MINOR_BASE] = NULL;
 	usb_deregister_dev(hiddev->hid->intf, &hiddev_class);
 	kfree(hiddev);
 }



-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG

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

end of thread, other threads:[~2004-05-20 10:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-19 17:39 [PATCH] out of bounds access in hiddev_cleanup Olaf Hering
2004-05-20 10:15 ` Vojtech Pavlik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox