1
0
Fork 0

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: 1110a2dbe6 ("Bluetooth: btrtl: Add RTL8822BE Bluetooth device")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
hifive-unleashed-5.1
Dan Carpenter 2017-07-28 17:41:11 +03:00 committed by Johan Hedberg
parent 98b5798499
commit c3327bde51
1 changed files with 2 additions and 0 deletions

View 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);