[PATCH] hidraw : free list for all error in hidraw_open

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

 



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@xxxxxxxxx>
---

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;

 }

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