All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch for 2.6.28]open refcount issue in hidraw
@ 2008-12-15 12:04 Oliver Neukum
  2008-12-15 12:13 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2008-12-15 12:04 UTC (permalink / raw)
  To: Jiri Kosina, Jiri Slaby, linux-input

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@suse.de>

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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch for 2.6.28]open refcount issue in hidraw
  2008-12-15 12:04 [patch for 2.6.28]open refcount issue in hidraw Oliver Neukum
@ 2008-12-15 12:13 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2008-12-15 12:13 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: Jiri Slaby, linux-input

On Mon, 15 Dec 2008, Oliver Neukum wrote:

> 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.

-- 
Jiri Kosina
SUSE Labs

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

end of thread, other threads:[~2008-12-15 12:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-15 12:04 [patch for 2.6.28]open refcount issue in hidraw Oliver Neukum
2008-12-15 12:13 ` 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.