Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2981377pxb; Tue, 13 Apr 2021 15:27:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOVJiS4zw7lvxd7HH11NfLNHtFdCDYqas4VKvGCPk2QQYshQ03oTNsHSYJTg2BswryQKTj X-Received: by 2002:a17:90a:ff02:: with SMTP id ce2mr9256pjb.217.1618352821359; Tue, 13 Apr 2021 15:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618352821; cv=none; d=google.com; s=arc-20160816; b=WZAHUPhBQ5g2zIVHjVbkdR4gnpG7paLqYGz8AVQRAiuY7L3P3XCX9WBthAQ193ZVkT L9bnFS1DFI9FHUq83/DoG12DimJhXjIg7+EcPIxkz4FRXhCV4MOgemlnZWJSS2PPh7/N e46mUvaICp2LlCayYE6a3uEi7nVEY+P6XgQXWgRI6yol3wO2V7KqXWhy/L1su87P1rKu OtX+ReyltjByZCllgSctW/sgqclAqqErwrjq/GWlf7lOzUcyrU60DRhlD917i8dMWfY5 BX25+yKO7eDT+muh6nDr5f6LVNkHexPOZQi3lRlxZROT2AnGiVAybN+YITufNRvie5Eq aiyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=Ev/cIRjlk73mIDK57wJJn3pchBiqOZC7aFiR3PP+ifk=; b=o3El46tgvqAjwB0rqeVh2+fd0XJLvfmPZAgLFcYdXs3YgwuDN2m0YnnJ0X5cvD+K6w 2BuDrXe4sC/9SeiLvzc2XRKhdgV3Fi51k2hPFO6SOkstvjFne7KiUo0JuQCtHAjJH2Vz VT2U3GybrhdrcMrsaT6kruTqLyPhA/fRwSjo0uu/4oYdkkkILYZkRCYVV4v4414MJBw1 jldeBobHYXivc8CmPYKbyaHAvdsTW7uDWNbomicMbfwZd95qL6snX9J0B4lBWEmCcu9D mR/Cl0Q+s6Yh6a5GaNFPhmpzw9SITXYbNSQBwXEy/VxG9GAxExdL603Xmagy/iv9XOy8 1Blw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vIVrIdqS; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mv17si4480700pjb.59.2021.04.13.15.26.47; Tue, 13 Apr 2021 15:27:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vIVrIdqS; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232476AbhDMRxg (ORCPT + 99 others); Tue, 13 Apr 2021 13:53:36 -0400 Received: from mail-wr1-f49.google.com ([209.85.221.49]:42574 "EHLO mail-wr1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230108AbhDMRxe (ORCPT ); Tue, 13 Apr 2021 13:53:34 -0400 Received: by mail-wr1-f49.google.com with SMTP id p6so10590594wrn.9; Tue, 13 Apr 2021 10:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=Ev/cIRjlk73mIDK57wJJn3pchBiqOZC7aFiR3PP+ifk=; b=vIVrIdqSffj9PKmvGmjc+95KNwntgZUXuITj4lF+rpoXq5DGs+Thcrz8cdTg4ycfU1 +bmJr/kvMvJ/VTL9SRKkKJsqPHgQaIosFTitBvbl+fZfxGC0tGUQTnAHUz5Btnk6nJbU u144wdV7GejNDFpejQDZiMyu4uwkcmuCPyA2sjNRvW6tu+IOvfB57CE9NwYdlQunWyL4 C5YiCkpxvagwuQ03pOvEQO4jxgoPHf2j9Hcvkez1juVucDSNKchhmqOmzpLZWRwEXI+d DI2k40z3UpPDnbAQKbVOiZhaP/33fi8onaq55DrzLF8p3EkVPCPiOq6KPA+Uu8NoiuUa SSGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=Ev/cIRjlk73mIDK57wJJn3pchBiqOZC7aFiR3PP+ifk=; b=f5KlkKOAJiVFCQ3t4L0GAbn7KUI9ekU2lJEhNYJUh36e4aNgQYoZu04qsFCATO1ZZX /RrQpNpmOa9LUxhhiLjCIO5nq3oYCxsF9jHC1tQJx5/+qcGMiYCDQGz9uh9cCszRsOvv EGyuw8JXj7qSlu4Rb7lufqdAUrsI9ILgpo76UjevSD6Eb/NQa5Vwo+3wZJHavDVYrgin w+LJEVWsyDXXr/ryDnm6p/t+g/e3PBzsgt9O293WRky6lZL+0PoTDLGmn/SxVyQcUWhx 7FssZ/gBPwpH4ylDPeThLh8pA/PY9yHOCgFmVQmCaf27LHyMEgRhd36FqDYgSLiEwUAw 9g8Q== X-Gm-Message-State: AOAM53190hTl16HN5iJ/If/0XHbGX0leTBl217A9ZEkh+jFc1282cdlu 0n2AXEsf6415vzfd+0BI8CA= X-Received: by 2002:a5d:5914:: with SMTP id v20mr12743011wrd.402.1618336334143; Tue, 13 Apr 2021 10:52:14 -0700 (PDT) Received: from LEGION ([39.46.65.172]) by smtp.gmail.com with ESMTPSA id o15sm20975338wra.93.2021.04.13.10.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 10:52:13 -0700 (PDT) Date: Tue, 13 Apr 2021 22:52:08 +0500 From: Muhammad Usama Anjum To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz , "mark-yw.chen" , "open list:BLUETOOTH DRIVERS" , open list Cc: musamaanjum@gmail.com, kernel-janitors@vger.kernel.org, dan.carpenter@oracle.com, colin.king@canonical.com Subject: [PATCH] Bluetooth: btusb: fix memory leak Message-ID: <20210413175208.GA560049@LEGION> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org If btusb_mtk_submit_wmt_recv_urb returns error, wc should be freed and then error should be returned to prevent memory leak. Addresses-Coverity: ("Prevent memory leak") Fixes: 4cbb375e997d ("Bluetooth: btusb: Fixed too many in-token issue for Mediatek Chip.") Signed-off-by: Muhammad Usama Anjum --- drivers/bluetooth/btusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 58ae824fb507..2c403188f586 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -3324,7 +3324,7 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev, /* Submit control IN URB on demand to process the WMT event */ err = btusb_mtk_submit_wmt_recv_urb(hdev); if (err < 0) - return err; + goto err_free_wc; /* The vendor specific WMT commands are all answered by a vendor * specific event and will have the Command Status or Command -- 2.25.1