[patch for 2.6.28]open refcount issue in hidraw

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Oliver Neukum<oneukum@xxxxxxx>

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.

---

diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 7685ae6..96ec1ba 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux