Skip to content

Commit

Permalink
Bluetooth: btrtl: Fix a error code in rtl_load_config()
Browse files Browse the repository at this point in the history
We accidentally return success if the kmemdup() fails.  It results in
a NULL dereference in the caller.

Fixes: 1110a2d ("Bluetooth: btrtl: Add RTL8822BE Bluetooth device")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
Dan Carpenter authored and Johan Hedberg committed Jul 28, 2017
1 parent 98b5798 commit c3327bd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/bluetooth/btrtl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c3327bd

Please sign in to comment.