diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-07-28 16:41:11 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2017-07-28 18:29:08 +0200 |
commit | c3327bde514d5945f5de1e28bed3eaa0c4d622ec (patch) | |
tree | 9c4b8d9598e2651b2c729355cbedb1ca5ea9bdbb /drivers/bluetooth | |
parent | mrf24j40: Fix en error handling path in 'mrf24j40_probe()' (diff) | |
download | linux-c3327bde514d5945f5de1e28bed3eaa0c4d622ec.tar.xz linux-c3327bde514d5945f5de1e28bed3eaa0c4d622ec.zip |
Bluetooth: btrtl: Fix a error code in rtl_load_config()
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>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/btrtl.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c index 8279094dd713..d9a99b4302ea 100644 --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c @@ -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); |