From patchwork Thu Jun 1 07:45:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 9758803 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3C7E860360 for ; Thu, 1 Jun 2017 07:46:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DBDD284C6 for ; Thu, 1 Jun 2017 07:46:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 225FC284FC; Thu, 1 Jun 2017 07:46:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBBE4284C6 for ; Thu, 1 Jun 2017 07:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751176AbdFAHqM (ORCPT ); Thu, 1 Jun 2017 03:46:12 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:34417 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbdFAHqK (ORCPT ); Thu, 1 Jun 2017 03:46:10 -0400 Received: by mail-lf0-f68.google.com with SMTP id f14so1271241lfe.1; Thu, 01 Jun 2017 00:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=556xp3st44fCEJK6b+Jkc8AUsXkXC6AffIWfu02T9IQ=; b=ddb6/fbrbprwaNbjhp4fNlaOf8LQ6N/cZLCJY4qKhEIYTRsvr6l+xxpRC4SODY/JKf wdMrNjhsCfD+qVd8dXjnZyIQie13sgKmMqkyi1WTKoqYe0tQ1kC7bQcsT5+T4rFZ1SKE PCnvjgrQcwWXT+Y8PopARIoiBJfrCcNTl42PSE6aJ4okCgJVL4s6hgP1edb5fr0X975s zuZsF6naP6J5wQQUYOkvI6OzqZPj/JlQ46xtK+UvZqSfAqr+sLoofgxpQiv13xAzhFog LVxVSRrFJHQ7+uBa4IWsuRHWUKATzljAjQ5mmodYl9nGAkLMy5P7QTvVYo457O69+PCs XfDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=556xp3st44fCEJK6b+Jkc8AUsXkXC6AffIWfu02T9IQ=; b=Eo1RUfg9PdAEOFkKFuet/ujMJzCQrme/C4jW6gKMWDOKiLt5BWzbpkinKtsVU0yXmA 570VuXdhiOEcquiYw000qZ9qgOXuIays9LkNu7yEOlwN98XGiIFEy+ux2bJub2An+x9y /KOp9FdvXqNTGXqaLI7fJV69it0V/cojELyCom0n5fpEGbBYSSxrCmVD+uRFrhCnGDix ojt09wJYaNQl4TKFBoh05k/zuw2gPC6Q/lO4UP1X3qnS1Yu850oEbBBJX2hGVEUVF3D4 2TZlKn8E01FhQMqxBfgKunT038QJYQD/qlQ/S8aFYERiYkmzcVsuD8g8aOoseM/eHZiJ sE7w== X-Gm-Message-State: AODbwcBLFsVGN3Cljy+c0Um9cLtslJTF0qTHMT+UPvU3/LZt3w3KQ0nh dKYb2xlJie6l9fwxAFQ= X-Received: by 10.25.16.161 with SMTP id 33mr59825lfq.3.1496303168404; Thu, 01 Jun 2017 00:46:08 -0700 (PDT) Received: from xi.terra (c-42c8e255.07-184-6d6c6d4.cust.bredbandsbolaget.se. [85.226.200.66]) by smtp.gmail.com with ESMTPSA id x24sm4076832ljd.5.2017.06.01.00.46.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Jun 2017 00:46:07 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.89) (envelope-from ) id 1dGKo8-0005M7-Pt; Thu, 01 Jun 2017 09:46:13 +0200 From: Johan Hovold To: Mauro Carvalho Chehab Cc: Sean Young , linux-media@vger.kernel.org, linux-usb@vger.kernel.org, Johan Hovold , stable , Jarod Wilson Subject: [PATCH 1/2] [media] mceusb: fix memory leaks in error path Date: Thu, 1 Jun 2017 09:45:59 +0200 Message-Id: <20170601074600.20548-1-johan@kernel.org> X-Mailer: git-send-email 2.13.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 # 2.6.36 Cc: Jarod Wilson Signed-off-by: Johan Hovold --- 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);