From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 331D1C7EE29 for ; Thu, 25 May 2023 19:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242641AbjEYT0R (ORCPT ); Thu, 25 May 2023 15:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242527AbjEYT0C (ORCPT ); Thu, 25 May 2023 15:26:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68C982701; Thu, 25 May 2023 12:24:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E4F160F97; Thu, 25 May 2023 18:45:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E0A9C433EF; Thu, 25 May 2023 18:45:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685040346; bh=VgJujuEt515rc2+IhSJ0rRHVEVk7DVjTwiT/xFqdMrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fbGP+XMEA4YmAftAEXJ00jJsxrV7xRR2pqx3BgO+tJNEHYvHHV5AIlkzE45UHTQbe nyQLRSIY44GbL+/xsLrThA38SXlao+xx0zpWLzYiTfKy4qKKYMjqNxiSK7xhy/fJtZ w1Dd++LvGb2Qqj4V4N3HVvZVX89sdscygdIFyfmiUnziSeKIpKQjexurF+nMJv3qJx LJH/NWSCybs7oAbd0eoNEnTkQWQYVY5z/8qmkF9J3BNsGshxWFg9qkQGDZCGHqAorM HxsnNzeq+2wslutXc1i+BSRg5kf2JcY+0loG2QX7x9qnh4QCEEPYQY3RPYf8ItkeG9 RByeYNOREh9sQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hyunwoo Kim , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 10/20] media: ttusb-dec: fix memory leak in ttusb_dec_exit_dvb() Date: Thu, 25 May 2023 14:45:06 -0400 Message-Id: <20230525184520.2004878-10-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230525184520.2004878-1-sashal@kernel.org> References: <20230525184520.2004878-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hyunwoo Kim [ Upstream commit 517a281338322ff8293f988771c98aaa7205e457 ] Since dvb_frontend_detach() is not called in ttusb_dec_exit_dvb(), which is called when the device is disconnected, dvb_frontend_free() is not finally called. This causes a memory leak just by repeatedly plugging and unplugging the device. Fix this issue by adding dvb_frontend_detach() to ttusb_dec_exit_dvb(). Link: https://lore.kernel.org/linux-media/20221117045925.14297-5-imv4bel@gmail.com Signed-off-by: Hyunwoo Kim Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/ttusb-dec/ttusb_dec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c index cad2746158160..d41ba80881759 100644 --- a/drivers/media/usb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c @@ -1571,8 +1571,7 @@ static void ttusb_dec_exit_dvb(struct ttusb_dec *dec) dvb_dmx_release(&dec->demux); if (dec->fe) { dvb_unregister_frontend(dec->fe); - if (dec->fe->ops.release) - dec->fe->ops.release(dec->fe); + dvb_frontend_detach(dec->fe); } dvb_unregister_adapter(&dec->adapter); } -- 2.39.2