From patchwork Mon Mar 1 16:12:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 390158 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E7E5C282E0 for ; Mon, 1 Mar 2021 16:49:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21AC465078 for ; Mon, 1 Mar 2021 16:49:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235700AbhCAQsr (ORCPT ); Mon, 1 Mar 2021 11:48:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:46974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233803AbhCAQlh (ORCPT ); Mon, 1 Mar 2021 11:41:37 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C77B064EE8; Mon, 1 Mar 2021 16:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614616147; bh=q3uN10S6y93+od1Cg4DctIyoAY/Q9eOy3biWHLYtE7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2aDR48fZdovf/bPOfaAeLk5p6Pcmj8jNQ4Aj5m70FnFY1pM5SrdiHYsy0WVZxj+6E pRxojAp/j6wDzuziDzbzuyHX8hfruGtrqeB3m8TkQdLuSwZ/qrR65H/OK/TPnhscgw 2n9WtPlqh4LNhYiDpE3/rKw9Cgi4ywXTCiWa+3lc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 050/176] media: tm6000: Fix memleak in tm6000_start_stream Date: Mon, 1 Mar 2021 17:12:03 +0100 Message-Id: <20210301161023.451268827@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161020.931630716@linuxfoundation.org> References: <20210301161020.931630716@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dinghao Liu [ Upstream commit 76aaf8a96771c16365b8510f1fb97738dc88026e ] When usb_clear_halt() fails, dvb->bulk_urb->transfer_buffer and dvb->bulk_urb should be freed just like when usb_submit_urb() fails. Fixes: 3169c9b26fffa ("V4L/DVB (12788): tm6000: Add initial DVB-T support") Signed-off-by: Dinghao Liu Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/tm6000/tm6000-dvb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/usb/tm6000/tm6000-dvb.c b/drivers/media/usb/tm6000/tm6000-dvb.c index 9a2af71c26912..98a4bbea33f52 100644 --- a/drivers/media/usb/tm6000/tm6000-dvb.c +++ b/drivers/media/usb/tm6000/tm6000-dvb.c @@ -150,6 +150,10 @@ static int tm6000_start_stream(struct tm6000_core *dev) if (ret < 0) { printk(KERN_ERR "tm6000: error %i in %s during pipe reset\n", ret, __func__); + + kfree(dvb->bulk_urb->transfer_buffer); + usb_free_urb(dvb->bulk_urb); + dvb->bulk_urb = NULL; return ret; } else printk(KERN_ERR "tm6000: pipe resetted\n");