Skip to content

Commit

Permalink
Bluetooth: btrtl: fix incorrect skb allocation failure check
Browse files Browse the repository at this point in the history
Currently the check for a failed bt_skb_alloc allocation is incorrectly
checking using IS_ERR and this can lead to a null pointer dereference. Fix
this by checking for a null pointer return using the !skb idiom.

Addresses-Coverity: ("Dereference null return")
Fixes: 1996d9c ("Bluetooth: btrtl: Ask 8821C to drop old firmware")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Colin Ian King authored and Marcel Holtmann committed Nov 11, 2020
1 parent 844c79b commit f5e8e21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/bluetooth/btrtl.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
cmd[1] = opcode >> 8;

skb = bt_skb_alloc(sizeof(cmd), GFP_KERNEL);
if (IS_ERR(skb))
if (!skb)
goto out_free;

skb_put_data(skb, cmd, sizeof(cmd));
Expand Down

0 comments on commit f5e8e21

Please sign in to comment.