Thread (3 messages) 3 messages, 3 authors, 2011-07-27

Re: list not released in case of -ENODEV in hidraw_release (hidraw.c)

From: Amit Nagal <hidden>
Date: 2011-06-22 11:43:36

Possibly related (same subject, not in this thread)

On Wed, Jun 22, 2011 at 1:28 PM, Amit Nagal [off-list ref] wrote:
quoted hunk
Hi ,

linux kernel ver 2.6.39.1  ,  hidraw.c  , in  hidraw_release function
, list pointer ( struct hidraw_list *list ) is not freed
in case of -ENODEV .

i think the following patch is applicable :
--- a/drivers/hid/hidraw.c      2011-06-22 08:57:55.000000000 -0400
+++ b/drivers/hid/hidraw.c      2011-06-22 08:42:04.000000000 -0400
@@ -298,6 +298,7 @@ static int hidraw_release(struct inode *
       mutex_lock(&minors_lock);
       if (!hidraw_table[minor]) {
+               kfree(list);
               ret = -ENODEV;
               goto unlock;
       }

Please correct me if i am mistaken .
In continuation of above , in hidraw_release(), for the sequence
disconnect  followed by last userspace close(fd) call ,
even kfree(list->hidraw) should also be called , as in
hidraw_disconnect() function kfree(hidraw) is called only when
hidraw->open is 0 .
so list->hidraw should also be freed when calling last close() call
even after disconnect .

if i have misunderstood facts , kindly clear my doubts .


Regards
Amit Nagal
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help