kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: qca: Fix error code in qca_read_fw_build_info()
@ 2024-05-04 11:25 Dan Carpenter
  2024-05-06  7:49 ` Johan Hovold
  2024-05-06 17:00 ` patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-05-04 11:25 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, linux-bluetooth,
	linux-kernel, kernel-janitors

Return -ENOMEM on allocation failure.  Don't return success.

Fixes: cfc2a7747108 ("Bluetooth: qca: fix info leak when fetching fw build id")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/bluetooth/btqca.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
index cc61014ffbc9..3b018ee33725 100644
--- a/drivers/bluetooth/btqca.c
+++ b/drivers/bluetooth/btqca.c
@@ -136,8 +136,10 @@ static int qca_read_fw_build_info(struct hci_dev *hdev)
 	}
 
 	build_label = kstrndup(&edl->data[1], build_lbl_len, GFP_KERNEL);
-	if (!build_label)
+	if (!build_label) {
+		err = -ENOMEM;
 		goto out;
+	}
 
 	hci_set_fw_info(hdev, "%s", build_label);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: qca: Fix error code in qca_read_fw_build_info()
  2024-05-04 11:25 [PATCH] Bluetooth: qca: Fix error code in qca_read_fw_build_info() Dan Carpenter
@ 2024-05-06  7:49 ` Johan Hovold
  2024-05-06 17:00 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hovold @ 2024-05-06  7:49 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Johan Hovold, Marcel Holtmann, Luiz Augusto von Dentz,
	linux-bluetooth, linux-kernel, kernel-janitors

On Sat, May 04, 2024 at 02:25:43PM +0300, Dan Carpenter wrote:
> Return -ENOMEM on allocation failure.  Don't return success.

Thanks, Dan.

Fortunately this error path is never taken due to the small allocation
size, but if it were it would only lead to a debugfs attribute holding
the fw build id not being created.

That said, it should still be fixed of course even this can wait for
6.10-rc1.

> Fixes: cfc2a7747108 ("Bluetooth: qca: fix info leak when fetching fw build id")

This one should also have a matching:

Cc: stable@vger.kernel.org	# 5.12

> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Johan Hovold <johan+linaro@kernel.org>

> @@ -136,8 +136,10 @@ static int qca_read_fw_build_info(struct hci_dev *hdev)
>  	}
>  
>  	build_label = kstrndup(&edl->data[1], build_lbl_len, GFP_KERNEL);
> -	if (!build_label)
> +	if (!build_label) {
> +		err = -ENOMEM;
>  		goto out;
> +	}
>  
>  	hci_set_fw_info(hdev, "%s", build_label);

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: qca: Fix error code in qca_read_fw_build_info()
  2024-05-04 11:25 [PATCH] Bluetooth: qca: Fix error code in qca_read_fw_build_info() Dan Carpenter
  2024-05-06  7:49 ` Johan Hovold
@ 2024-05-06 17:00 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2024-05-06 17:00 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: johan+linaro, marcel, luiz.dentz, linux-bluetooth, linux-kernel,
	kernel-janitors

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Sat, 4 May 2024 14:25:43 +0300 you wrote:
> Return -ENOMEM on allocation failure.  Don't return success.
> 
> Fixes: cfc2a7747108 ("Bluetooth: qca: fix info leak when fetching fw build id")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/bluetooth/btqca.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Here is the summary with links:
  - Bluetooth: qca: Fix error code in qca_read_fw_build_info()
    https://git.kernel.org/bluetooth/bluetooth-next/c/0ae8d9b9ea1e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-06 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-04 11:25 [PATCH] Bluetooth: qca: Fix error code in qca_read_fw_build_info() Dan Carpenter
2024-05-06  7:49 ` Johan Hovold
2024-05-06 17:00 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).