Skip to contentSkip to conversation

open refcount issue in hidraw

PATCH In review Oliver Neukum 2 participants 2 messages Dec 15, 2008 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 open refcount issue in hidraw

The hidraw subsystem has a bug that prevents the close syscall from ever reaching the low level driver, leading to a resource leak. Fix by replacing postdecrement with predecrement.

Hi Jiři,

I found this testing hid autosuspend, but it is absolutely independent from it. In fact it seems to me that it should still go into 2.6.28 despite the lateness and should definitely go into the stable series. Hence I am sending this as a separate patch.

---

drivers/hid/hidraw.c +1 -1
index 7685ae6..96ec1ba 100644
@@ -208,7 +208,7 @@ static int hidraw_release(struct inode * inode, struct file * file)
 
 	list_del(&list->node);
 	dev = hidraw_table[minor];
-	if (!dev->open--) {
+	if (!--dev->open) {
 		if (list->hidraw->exist)
 			dev->hid->ll_driver->close(dev->hid);
 		else

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 3 lines · Oliver Neukum

The hidraw subsystem has a bug that prevents the close syscall from ever reaching the low level driver, leading to a resource leak. Fix by replacing postdecrement with predecrement.

Good catch, applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs