Commit c08cec9
committed
Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg
jira VULN-465
cve CVE-2023-51779
commit-author Hyunwoo Kim <[email protected]>
commit 2e07e83
upstream-diff We are missing f4b41f0 ("net: remove noblock
parameter from skb_recv_datagram()") commit. The
patch is clean otherwise.
This can cause a race with bt_sock_ioctl() because
bt_sock_recvmsg() gets the skb from sk->sk_receive_queue
and then frees it without holding lock_sock.
A use-after-free for a skb occurs with the following flow.
```
bt_sock_recvmsg() -> skb_recv_datagram() -> skb_free_datagram()
bt_sock_ioctl() -> skb_peek()
```
Add lock_sock to bt_sock_recvmsg() to fix this issue.
Cc: [email protected]
Fixes: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Hyunwoo Kim <[email protected]>
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
(cherry picked from commit 2e07e83)
Signed-off-by: Pratham Patel <[email protected]>1 parent b67c49b commit c08cec9
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| 266 | + | |
| 267 | + | |
266 | 268 | | |
267 | 269 | | |
268 | 270 | | |
269 | | - | |
| 271 | + | |
270 | 272 | | |
| 273 | + | |
271 | 274 | | |
272 | 275 | | |
273 | 276 | | |
| |||
293 | 296 | | |
294 | 297 | | |
295 | 298 | | |
| 299 | + | |
| 300 | + | |
296 | 301 | | |
297 | 302 | | |
298 | 303 | | |
| |||
0 commit comments