From patchwork Tue Oct 27 13:55:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 289935 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=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 ACE56C55179 for ; Tue, 27 Oct 2020 14:52:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D5722225E for ; Tue, 27 Oct 2020 14:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810340; bh=zx84Ap/ZbXLfmgQQFnACS6AemwwsovoRyJHPi1w2D2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=RW4eicyT6M1B/o4giio2kniwDUDV//QqFMvtItHYepDfOnUFjV3er8sS7HgUua2O7 ccMz7FcsrD/+XZU55qrFGTV3siI/sPEzAY6kpDNYVLvvNilVWp9OX+eZvbMXQF6W+S dPglOcuBT7rMcZADL0kIKeuYQ02zm8XsmDTWHOXk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765060AbgJ0Ori (ORCPT ); Tue, 27 Oct 2020 10:47:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:47526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765016AbgJ0Orh (ORCPT ); Tue, 27 Oct 2020 10:47:37 -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 B0507206E5; Tue, 27 Oct 2020 14:47:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810057; bh=zx84Ap/ZbXLfmgQQFnACS6AemwwsovoRyJHPi1w2D2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vrp2ejEYWkY+tF8Sce408jlZ7dCCAjDdk0jXjGWBl7LL0PVDeW1xQnS2Ev7vai7Xd u7tFjRNmpFP1Q/TToxGY+yWhWGnOnrGb3SDWPjSyikT7MrLKz7AGd6uLkZSR8zKKYu Tckwlq7q6LefhmWS+yXhOpmzqZhkG+UqP5FAlgJE= 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.4 387/408] Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb Date: Tue, 27 Oct 2020 14:55:25 +0100 Message-Id: <20201027135512.947356868@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 f3f0529564da0..b326eeddaadf0 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2664,6 +2664,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; }