All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hidraw : free list for all error in hidraw_open
@ 2011-09-02  5:29 Amit Nagal
  2011-09-02  7:27 ` Amit Nagal
  2011-09-15 15:34 ` James Hogan
  0 siblings, 2 replies; 5+ messages in thread
From: Amit Nagal @ 2011-09-02  5:29 UTC (permalink / raw)
  To: linux-input, linux-usb; +Cc: Jiri Kosina, Alan Ott

Hi ,

In function hidraw_open (linux-3.0.3/drivers/hid/hidraw.c ) ,  struct
hidraw_list *list should be freed for all error conditions .
Following is patch enclosed for the same :

Signed-off-by: Amit Nagal <helloin.amit@gmail.com>
---

diff -uprN linux-3.0.3/drivers/hid/hidraw.c.orig
linux-3.0.3/drivers/hid/hidraw.c
--- linux-3.0.3/drivers/hid/hidraw.c.orig       2011-09-01
13:23:19.000000000 -0400
+++ linux-3.0.3/drivers/hid/hidraw.c    2011-09-02 06:25:08.000000000 -0400
@@ -259,7 +259,6 @@ static int hidraw_open(struct inode *ino

        mutex_lock(&minors_lock);
        if (!hidraw_table[minor]) {
-               kfree(list);
                err = -ENODEV;
                goto out_unlock;
        }
@@ -285,6 +284,8 @@ static int hidraw_open(struct inode *ino
 out_unlock:
        mutex_unlock(&minors_lock);
 out:
+       if (err < 0)
+               kfree(list);
        return err;

 }

--

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

end of thread, other threads:[~2011-09-15 15:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02  5:29 [PATCH] hidraw : free list for all error in hidraw_open Amit Nagal
2011-09-02  7:27 ` Amit Nagal
     [not found]   ` <CA+F9FsA=u6EtGkWO8PVfJ4voSx+=wvoFdZ_61WO6x=8WMFM0Rg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-09-02 11:03     ` Sergei Shtylyov
2011-09-07 11:50   ` Jiri Kosina
2011-09-15 15:34 ` James Hogan

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.