Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9204ybl; Tue, 7 Jan 2020 13:04:37 -0800 (PST) X-Google-Smtp-Source: APXvYqxV9VXPVwvwK15zG3Ss1RUi4VcwE4UWbYWeZgOJ+ERGrLykqNE2nr/8gbp99ni4ZtIepf4F X-Received: by 2002:a9d:53c4:: with SMTP id i4mr1788281oth.48.1578431076924; Tue, 07 Jan 2020 13:04:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578431076; cv=none; d=google.com; s=arc-20160816; b=ZjoyxhMUbeCAoGxj/AOacoXUKL0dRRsJibSRsLZ/oJOnTOBZCOSx8tQ0dFaXbjGDir BFTxkrpv/PCoo6wTl7iugDynD9EiB+IciC43BP93UNkioOq8PX9q4EZzw6lGaxJG/qov s0TZnmS3exH510VZuMbZ6k9kL+lotovGuB6okvBsbkPoDMGfF38qwp8nekbX/au3dLdI u8MhRGh13MEcsfkp3syYN8JePhPUyCkqucY1cRMG18FjrdEh3G1m861lR7BNDK5ssAb+ h6/DUCXpGO2WR9LO9OcrNKHDdwvIaozwsXOYw3aYAO4x1hUTqF5qyfrI1UOxfdOQxciL T2hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ayrL1+zyQa5fuPY/XIRFkMfJRFu7YCEzd/kvDR192uw=; b=uzL0MeHPdb+5VjaIJ8snYmdkwyynoa6v7Rl0yoXARWXERs77FNCp+1uxstUBXv1gGb YjqxipWWEKK0N0yc6k/o4B7rpZSdgjdXKmIY4ZLnPqhE4Qv1o06SjbnRuxu0yTWpAQER aCcCZDy2R/VnNhyJGewg3qjAMiz/kIMOX9Ub0lH/7JRqGEWK18eG6XfTHD2O3oBW+KS8 uhYt7aRulvDf1xr3VJ/0NlG74tPueZzXUY3N+vJAmoYdCJaWXXFmcSNns46EgjCMUXUU +dZnMgN62aBWmwbbcVuzlbRPxR61kzsZnI3g5vYEjx8sfYdOBTPvESgQjt/DVDFe8HTG 5Ovg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2Wgcci+W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si519011oti.306.2020.01.07.13.04.24; Tue, 07 Jan 2020 13:04:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2Wgcci+W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728965AbgAGVDl (ORCPT + 99 others); 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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);