[media] mceusb: fix memory leaks in error path
authorJohan Hovold <johan@kernel.org>
Thu, 1 Jun 2017 07:45:59 +0000 (04:45 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 7 Jun 2017 12:39:19 +0000 (09:39 -0300)
Fix urb and transfer-buffer leaks in an urb-submission error path which
may be hit when a device is disconnected.

Fixes: 66e89522aff7 ("V4L/DVB: IR: add mceusb IR receiver driver")

Cc: stable <stable@vger.kernel.org> # 2.6.36
Cc: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/rc/mceusb.c

index 4530237cbb672a2182fd2a6b21393ade107d2f92..04d6cd1818fb0ef53aeeb25359971836eca50917 100644 (file)
@@ -795,6 +795,8 @@ static void mce_request_packet(struct mceusb_dev *ir, unsigned char *data,
        res = usb_submit_urb(async_urb, GFP_ATOMIC);
        if (res) {
                dev_err(dev, "send request FAILED! (res=%d)", res);
+               kfree(async_buf);
+               usb_free_urb(async_urb);
                return;
        }
        dev_dbg(dev, "send request complete (res=%d)", res);