From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3A2F336EC5; Tue, 31 Mar 2026 16:26:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774974395; cv=none; b=HyN1DBEGHXxGSgxB9o2DpVr1Xv3Nz0KhYYVz7w1MDNq0brjstiR07i/gfFxMGq8FVoyJyxg7IG51NT3qVMiCjneAW4uxm0ScylLZkeL2LjRYEp7fcNquy7ohhQxyW3kX9ZHQxdLbdieNSyBXPyBOBa/LWSHVkFd5DrcCAM3EsF0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774974395; c=relaxed/simple; bh=27i66W4NErdstwcx+dLmLVZ69sWt9d/dqdBvEBa6h5Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ha6NUs2O++1fralNDmdElD1f4Zd4dg+bPmS7X+xofcNBlcJQ+0+ICxZauS+0slrQ43OoZDAc9nS3pNjUTDcwUpEC/G2w1Bu7Pc6OYLfYye23un13ihm7OPzM73Mkar1olbyS9LfO2zDTZnpmj9esb5kjs0NvKnIDhiRmtGgFNZY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=N/SNjYFB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="N/SNjYFB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79347C19423; Tue, 31 Mar 2026 16:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774974394; bh=27i66W4NErdstwcx+dLmLVZ69sWt9d/dqdBvEBa6h5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N/SNjYFBPOUnJgwaSygbbSvVBTekQMsSaemMGX1NGjaAD3M7maqubdWIBHqzgaPbL q1TsRsiV9nX+ksmcp555rF8EFRbNd0fWl6fsTpAh6GLyd1a/MopUb8yoZfLdO5HgK9 4D68YTKLYA5DaEm/TzXoLRyeeJj/4P2GphgP9yZo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Paul Menzel , Anas Iqbal , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.6 041/175] Bluetooth: hci_ll: Fix firmware leak on error path Date: Tue, 31 Mar 2026 18:20:25 +0200 Message-ID: <20260331161731.295214220@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260331161729.779738837@linuxfoundation.org> References: <20260331161729.779738837@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anas Iqbal [ Upstream commit 31148a7be723aa9f2e8fbd62424825ab8d577973 ] Smatch reports: drivers/bluetooth/hci_ll.c:587 download_firmware() warn: 'fw' from request_firmware() not released on lines: 544. In download_firmware(), if request_firmware() succeeds but the returned firmware content is invalid (no data or zero size), the function returns without releasing the firmware, resulting in a resource leak. Fix this by calling release_firmware() before returning when request_firmware() succeeded but the firmware content is invalid. Fixes: 371805522f87 ("bluetooth: hci_uart: add LL protocol serdev driver support") Reviewed-by: Paul Menzel Signed-off-by: Anas Iqbal Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_ll.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/bluetooth/hci_ll.c b/drivers/bluetooth/hci_ll.c index 4a0b5c3160c2b..4d987dece2d0c 100644 --- a/drivers/bluetooth/hci_ll.c +++ b/drivers/bluetooth/hci_ll.c @@ -541,6 +541,8 @@ static int download_firmware(struct ll_device *lldev) if (err || !fw->data || !fw->size) { bt_dev_err(lldev->hu.hdev, "request_firmware failed(errno %d) for %s", err, bts_scr_name); + if (!err) + release_firmware(fw); return -EINVAL; } ptr = (void *)fw->data; -- 2.51.0