Bluetooth: qca: Fix error code in qca_read_fw_build_info()
authorDan Carpenter <dan.carpenter@linaro.org>
Sat, 4 May 2024 11:25:43 +0000 (14:25 +0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 14 May 2024 14:51:09 +0000 (10:51 -0400)
Return -ENOMEM on allocation failure.  Don't return success.

Fixes: cda0d6a198e2 ("Bluetooth: qca: fix info leak when fetching fw build id")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btqca.c

index 6aefc922a08a451b0d03617e5a34c7c3727f95bd..dfbbac92242a8479af67264d86772d2eca9d3eac 100644 (file)
@@ -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);