From patchwork Fri May 27 15:57:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 6773 Return-path: Envelope-to: mchehab@pedra Delivery-date: Fri, 27 May 2011 12:58:07 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1QPzQN-0008VX-KN for mchehab@pedra; Fri, 27 May 2011 12:58:07 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Fri, 27 May 2011 12:58:07 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QPzPv-0003jP-CV; Fri, 27 May 2011 15:57:39 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755756Ab1E0P5U (ORCPT + 1 other); Fri, 27 May 2011 11:57:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48267 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755138Ab1E0P5S (ORCPT ); Fri, 27 May 2011 11:57:18 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4RFvD6l026938 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 27 May 2011 11:57:13 -0400 Received: from xavier.bos.redhat.com (xavier.bos.redhat.com [10.16.16.50]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4RFvCFs011639; Fri, 27 May 2011 11:57:12 -0400 From: Jarod Wilson To: linux-media@vger.kernel.org Cc: Jarod Wilson , Hans Petter Selasky Subject: [PATCH] [media] mceusb: plug memory leak on data transmit Date: Fri, 27 May 2011 11:57:09 -0400 Message-Id: <1306511829-493-1-git-send-email-jarod@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Hans Petter Selasky pointed out to me that we're leaking urbs when mce_async_out is called. Its used both for configuring the hardware and for transmitting IR data. In the tx case, mce_request_packet actually allocates both a urb and the transfer buffer, neither of which was being torn down. Do that in the tx callback. CC: Hans Petter Selasky Signed-off-by: Jarod Wilson --- drivers/media/rc/mceusb.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index ad927fc..124f5af 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -612,6 +612,9 @@ static void mce_async_callback(struct urb *urb, struct pt_regs *regs) mceusb_dev_printdata(ir, urb->transfer_buffer, 0, len, true); } + /* the transfer buffer and urb were allocated in mce_request_packet */ + kfree(urb->transfer_buffer); + usb_free_urb(urb); } /* request incoming or send outgoing usb packet - used to initialize remote */