The patch number 9297 was added via Andy Walls <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Andy Walls  <[EMAIL PROTECTED]>
cx18: Fix memory leak on card initialization failure


On error exit, the cx18_probe() function did not use the proper entry in
cx18_cards[] with kfree() when card init failed; leaking memory.

Priority: normal

Signed-off-by: Andy Walls <[EMAIL PROTECTED]>


---

 linux/drivers/media/video/cx18/cx18-driver.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff -r e2a8b9b9c294 -r 6ea035897535 
linux/drivers/media/video/cx18/cx18-driver.c
--- a/linux/drivers/media/video/cx18/cx18-driver.c      Fri Oct 17 19:45:55 
2008 +0300
+++ b/linux/drivers/media/video/cx18/cx18-driver.c      Sat Oct 18 07:51:28 
2008 -0400
@@ -613,6 +613,7 @@ static int __devinit cx18_probe(struct p
                                const struct pci_device_id *pci_id)
 {
        int retval = 0;
+       int i;
        int vbi_buf_size;
        u32 devtype;
        struct cx18 *cx;
@@ -836,8 +837,11 @@ err:
        CX18_ERR("Error %d on initialization\n", retval);
        cx18_log_statistics(cx);
 
-       kfree(cx18_cards[cx18_cards_active]);
-       cx18_cards[cx18_cards_active] = NULL;
+       i = cx->num;
+       spin_lock(&cx18_cards_lock);
+       kfree(cx18_cards[i]);
+       cx18_cards[i] = NULL;
+       spin_unlock(&cx18_cards_lock);
        return retval;
 }
 


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/6ea035897535c20c8a535276715e2a6ad83746a4

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to