From patchwork Tue Jan 7 20:54:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 234294 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 272B7C282DD for ; Tue, 7 Jan 2020 21:21:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E0A902080A for ; Tue, 7 Jan 2020 21:20:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578432060; bh=/TX7Io1N26F0YAghoqFvXunFWVmzTvMzhqhIisVRMXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0oc6DJZyiozdlY5w91AJ6cN7O1vjbHwVR7YK0AXcZrmvulNdHvuyG9LTvVSQ0ZH9z H+Dv2eRl3+FrmruWxHYfOorosDoKM1X0VsRDByyyChpshOaYJGT+xTW3Gv8ot8OgpK i7rWlNpvmojE54fhMSSawyxFneel4WaHHT/gf0pA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727652AbgAGVDl (ORCPT ); Tue, 7 Jan 2020 16:03:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:46154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728223AbgAGVDk (ORCPT ); Tue, 7 Jan 2020 16:03:40 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7962E20880; Tue, 7 Jan 2020 21:03:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431019; bh=/TX7Io1N26F0YAghoqFvXunFWVmzTvMzhqhIisVRMXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Wgcci+WqP67UiJwF6biZ/eqwkLJdMaeOn9x9cMeHEc5I8kM4X87Lpp46JjxpUYzm r6bfepmx7SaPQuPFu1otDhBeWwzomg8FrND0+9vXFXfoV+f6UeRrD0oFtxvOR2FuFj X8bNzzkfT1zxLsGMYUbP/kU1U6TCKIyfYw3T0avg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.4 165/191] media: usb: fix memory leak in af9005_identify_state Date: Tue, 7 Jan 2020 21:54:45 +0100 Message-Id: <20200107205341.811781571@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205332.984228665@linuxfoundation.org> References: <20200107205332.984228665@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Navid Emamdoost commit 2289adbfa559050d2a38bcd9caac1c18b800e928 upstream. In af9005_identify_state when returning -EIO the allocated buffer should be released. Replace the "return -EIO" with assignment into ret and move deb_info() under a check. Fixes: af4e067e1dcf ("V4L/DVB (5625): Add support for the AF9005 demodulator from Afatech") Signed-off-by: Navid Emamdoost Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/dvb-usb/af9005.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/media/usb/dvb-usb/af9005.c +++ b/drivers/media/usb/dvb-usb/af9005.c @@ -976,8 +976,9 @@ static int af9005_identify_state(struct else if (reply == 0x02) *cold = 0; else - return -EIO; - deb_info("Identify state cold = %d\n", *cold); + ret = -EIO; + if (!ret) + deb_info("Identify state cold = %d\n", *cold); err: kfree(buf);