From patchwork Fri Jun 19 14:31:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223963 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 1F553C433DF for ; Fri, 19 Jun 2020 15:51:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E901920706 for ; Fri, 19 Jun 2020 15:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592581901; bh=IAdVph0fG5ogOIukRAnscPJyX0P9LSD/fmItIjoQA6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WrwbG0wveMlnuP6IG7yOYvNHFn81IGqeNM7RxG85qUzS2B9BsmucAnEInK2uazFJ+ v9NQrv+OeH7X6KhfMP6dF6L2KiSV6UMMuXWU16+Q/G5OGA54t3ma2F/jDMGJFizb82 ggVaVInxV9v7pphPEjG+Po14lWz6GGs1UMCJCFuI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404191AbgFSPve (ORCPT ); Fri, 19 Jun 2020 11:51:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:55642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393235AbgFSPYA (ORCPT ); Fri, 19 Jun 2020 11:24:00 -0400 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 2233F21548; Fri, 19 Jun 2020 15:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580239; bh=IAdVph0fG5ogOIukRAnscPJyX0P9LSD/fmItIjoQA6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VeuiwLpILkPcT6f5mmv2+WC1oaZiYzcoEws7K2Pu6kMMLfC62oRA0p6f1rDgV6d6n 2eNlAy18ak731K0rfvbCVraCSbMvChZt16beLnZpmfP+MvmnlXVl6JMVM4mkTraact 5ZvCj09znYR3uDsF+vaQ7A7IlgrKrUfUKRWQkARE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Yongjun , Kalle Valo , Sasha Levin Subject: [PATCH 5.7 147/376] ath10k: fix possible memory leak in ath10k_bmi_lz_data_large() Date: Fri, 19 Jun 2020 16:31:05 +0200 Message-Id: <20200619141717.288645308@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@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: Wei Yongjun [ Upstream commit 2326aa011967f0afbcba7fe1a005d01f8b12900b ] 'cmd' is malloced in ath10k_bmi_lz_data_large() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Fixes: d58f466a5dee ("ath10k: add large size for BMI download data for SDIO") Signed-off-by: Wei Yongjun Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200427104348.13570-1-weiyongjun1@huawei.com Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/bmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ath/ath10k/bmi.c b/drivers/net/wireless/ath/ath10k/bmi.c index ea908107581d..5b6db6e66f65 100644 --- a/drivers/net/wireless/ath/ath10k/bmi.c +++ b/drivers/net/wireless/ath/ath10k/bmi.c @@ -380,6 +380,7 @@ static int ath10k_bmi_lz_data_large(struct ath10k *ar, const void *buffer, u32 l NULL, NULL); if (ret) { ath10k_warn(ar, "unable to write to the device\n"); + kfree(cmd); return ret; }