]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
Bluetooth: btrtl: Fix a error code in rtl_load_config()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 28 Jul 2017 14:41:11 +0000 (17:41 +0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Fri, 28 Jul 2017 16:29:08 +0000 (19:29 +0300)
We accidentally return success if the kmemdup() fails.  It results in
a NULL dereference in the caller.

Fixes: 1110a2dbe698 ("Bluetooth: btrtl: Add RTL8822BE Bluetooth device")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
drivers/bluetooth/btrtl.c

index 8279094dd713bf8b03d0403e2ebee77313bcde3c..d9a99b4302ea767d8896ee06c55d01b2050aa29a 100644 (file)
@@ -279,6 +279,8 @@ static int rtl_load_config(struct hci_dev *hdev, const char *name, u8 **buff)
                return ret;
        ret = fw->size;
        *buff = kmemdup(fw->data, ret, GFP_KERNEL);
+       if (!*buff)
+               ret = -ENOMEM;
 
        release_firmware(fw);