linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] [media] mceusb: fix memory leaks in error path
@ 2017-06-01  7:45 Johan Hovold
  2017-06-01  7:46 ` [PATCH 2/2] [media] mceusb: drop redundant urb reinitialisation Johan Hovold
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2017-06-01  7:45 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Sean Young, linux-media, linux-usb, Johan Hovold, stable,
	Jarod Wilson

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>
---
 drivers/media/rc/mceusb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 93b16fe3ab38..0a16bd34ee4e 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -766,6 +766,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, "receive request FAILED! (res=%d)", res);
+		kfree(async_buf);
+		usb_free_urb(async_urb);
 		return;
 	}
 	dev_dbg(dev, "receive request complete (res=%d)", res);
-- 
2.13.0

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

* [PATCH 2/2] [media] mceusb: drop redundant urb reinitialisation
  2017-06-01  7:45 [PATCH 1/2] [media] mceusb: fix memory leaks in error path Johan Hovold
@ 2017-06-01  7:46 ` Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2017-06-01  7:46 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Sean Young, linux-media, linux-usb, Johan Hovold

Drop a since commit e1159cb35712 ("[media] mceusb: remove pointless
mce_flush_rx_buffer function") redundant reinitialisation of two urb
fields immediately after they have been initialised.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/media/rc/mceusb.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 0a16bd34ee4e..cba7ae90c000 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -760,9 +760,6 @@ static void mce_request_packet(struct mceusb_dev *ir, unsigned char *data,
 
 	dev_dbg(dev, "receive request called (size=%#x)", size);
 
-	async_urb->transfer_buffer_length = size;
-	async_urb->dev = ir->usbdev;
-
 	res = usb_submit_urb(async_urb, GFP_ATOMIC);
 	if (res) {
 		dev_err(dev, "receive request FAILED! (res=%d)", res);
-- 
2.13.0

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

end of thread, other threads:[~2017-06-01  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-01  7:45 [PATCH 1/2] [media] mceusb: fix memory leaks in error path Johan Hovold
2017-06-01  7:46 ` [PATCH 2/2] [media] mceusb: drop redundant urb reinitialisation Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).