Skip to content

Commit 86384a1

Browse files
myunghojgregkh
authored andcommitted
Bluetooth: hci_uart: Check if socket buffer is ERR_PTR in h4_recv_buf()
commit 1dc2d78 upstream. h4_recv_buf() callers store the return value to socket buffer and recursively pass the buffer to h4_recv_buf() without protection. So, ERR_PTR returned from h4_recv_buf() can be dereferenced, if called again before setting the socket buffer to NULL from previous error. Check if skb is ERR_PTR in h4_recv_buf(). Reported-by: [email protected] Signed-off-by: Myungho Jung <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3616a46 commit 86384a1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/bluetooth/hci_h4.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
174174
struct hci_uart *hu = hci_get_drvdata(hdev);
175175
u8 alignment = hu->alignment ? hu->alignment : 1;
176176

177+
/* Check for error from previous call */
178+
if (IS_ERR(skb))
179+
skb = NULL;
180+
177181
while (count) {
178182
int i, len;
179183

0 commit comments

Comments
 (0)