From patchwork Tue Oct 27 13:56:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 307409 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=-12.8 required=3.0 tests=BAYES_00,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=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 C105AC55179 for ; Tue, 27 Oct 2020 16:01:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 89E4B22384 for ; Tue, 27 Oct 2020 16:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603814514; bh=BYAQTJGgiCU8v3R8HsfKnzr9lgvJfIjcAHFlSnlj/1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SstWi8CD5I46AgtYtxed4ArZeH6em/co73z95lFChz/ndWyF/UTz7AV13AM820IKv xzAUkSVXg5eY4BdUB+0CwPR0w+FTvF9QZUwj+6dJ5al1s0flh94coLtOqzh4Eaa8GL m18bSWjeEGp+WI+op1cSJydBbU0E5ro1s7J4EhhI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1804883AbgJ0P7o (ORCPT ); Tue, 27 Oct 2020 11:59:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:54796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1803565AbgJ0PxG (ORCPT ); Tue, 27 Oct 2020 11:53:06 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 9807420657; Tue, 27 Oct 2020 15:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813986; bh=BYAQTJGgiCU8v3R8HsfKnzr9lgvJfIjcAHFlSnlj/1A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gnDupuLuLS6tEA/a56tNJdoHvktLDRSYcyMSmY0dCZ4zRGF9MHy3thtm1D6cIofFr yDT3GrKLJz2wuPbJ8/WISn3jBKwan7PDMvd8bBdk2na1+IqjJMP/Ajt9JViLV8iFsN KSnxNujoeVDP9mnw2aztJOOGoq1ZyOqBnDTRqWAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Yufen , Kalle Valo , Sasha Levin Subject: [PATCH 5.9 737/757] brcm80211: fix possible memleak in brcmf_proto_msgbuf_attach Date: Tue, 27 Oct 2020 14:56:27 +0100 Message-Id: <20201027135525.068621149@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Wang Yufen [ Upstream commit 6c151410d5b57e6bb0d91a735ac511459539a7bf ] When brcmf_proto_msgbuf_attach fail and msgbuf->txflow_wq != NULL, we should destroy the workqueue. Reported-by: Hulk Robot Signed-off-by: Wang Yufen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1595237765-66238-1-git-send-email-wangyufen@huawei.com Signed-off-by: Sasha Levin --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c index f1a20db8daab9..bfddb851e386e 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c @@ -1620,6 +1620,8 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) BRCMF_TX_IOCTL_MAX_MSG_SIZE, msgbuf->ioctbuf, msgbuf->ioctbuf_handle); + if (msgbuf->txflow_wq) + destroy_workqueue(msgbuf->txflow_wq); kfree(msgbuf); } return -ENOMEM;