From patchwork Tue Oct 27 13:55:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 289786 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 B6800C5517A for ; Tue, 27 Oct 2020 15:17:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76C3A22283 for ; Tue, 27 Oct 2020 15:17:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811830; bh=fLiAoAGyPCd7f6ZiKnIY/1DfUH5bqyP4A7ZYOC0nuHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lzUZQjHPw2r6Dh+4Dm/AnzQ9HMbUgmkefmJx7CdqcajhwqXzi4/4geozRIjpnjo+b n7M1fLypgnSXIo7POyTC6DhEIFo7v3r/a9eb1xbonwcuQCrizdJ6iDj/9DNOSgCXzO KJ/GfHTaDRZydavSuwcfcvX05se4kmin5Tz8iQV8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1796268AbgJ0PRA (ORCPT ); Tue, 27 Oct 2020 11:17:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:52702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1796194AbgJ0PQB (ORCPT ); Tue, 27 Oct 2020 11:16:01 -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 EE6F52224A; Tue, 27 Oct 2020 15:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811761; bh=fLiAoAGyPCd7f6ZiKnIY/1DfUH5bqyP4A7ZYOC0nuHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t48qxLaC3apEI27Se6aO5gsLp4AuAMczcizLb7shhj5UjXcgOs/SxXK5uuVI3NDGz SXt/RKWEsC15xP1l8i89OkYt1UoQKDMI/QSMSMgey4DqZrk+MIzJe4/BIhB3YEimLS ZAOe2W4Xtk4wBzsa7eRyQxWD96NELXsJtd6EXDPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.8 607/633] Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb Date: Tue, 27 Oct 2020 14:55:50 +0100 Message-Id: <20201027135551.293834425@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dinghao Liu [ Upstream commit d33fe77bdf75806d785dabf90d21d962122e5296 ] When kmalloc() on buf fails, urb should be freed just like when kmalloc() on dr fails. Signed-off-by: Dinghao Liu Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index a5fef9aa419fd..91a0c84d55c97 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2849,6 +2849,7 @@ static int btusb_mtk_submit_wmt_recv_urb(struct hci_dev *hdev) buf = kmalloc(size, GFP_KERNEL); if (!buf) { kfree(dr); + usb_free_urb(urb); return -ENOMEM; }