Commit 687aa0c
vsock: Fix transport_* TOCTOU
Transport assignment may race with module unload. Protect new_transport
from becoming a stale pointer.
This also takes care of an insecure call in vsock_use_local_transport();
add a lockdep assert.
BUG: unable to handle page fault for address: fffffbfff8056000
Oops: Oops: 0000 [#1] SMP KASAN
RIP: 0010:vsock_assign_transport+0x366/0x600
Call Trace:
vsock_connect+0x59c/0xc40
__sys_connect+0xe8/0x100
__x64_sys_connect+0x6e/0xc0
do_syscall_64+0x92/0x1c0
entry_SYSCALL_64_after_hwframe+0x4b/0x53
Fixes: c0cfa2d ("vsock: add multi-transports support")
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
Link: https://patch.msgid.link/20250703-vsock-transports-toctou-v4-2-98f0eb530747@rbox.co
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent 209fd72 commit 687aa0c
1 file changed
+23
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| 410 | + | |
| 411 | + | |
410 | 412 | | |
411 | 413 | | |
412 | 414 | | |
| |||
464 | 466 | | |
465 | 467 | | |
466 | 468 | | |
| 469 | + | |
| 470 | + | |
467 | 471 | | |
468 | 472 | | |
469 | 473 | | |
| |||
479 | 483 | | |
480 | 484 | | |
481 | 485 | | |
482 | | - | |
| 486 | + | |
| 487 | + | |
483 | 488 | | |
484 | 489 | | |
485 | 490 | | |
486 | | - | |
487 | | - | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
488 | 495 | | |
489 | 496 | | |
490 | 497 | | |
| |||
508 | 515 | | |
509 | 516 | | |
510 | 517 | | |
511 | | - | |
512 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
513 | 528 | | |
514 | 529 | | |
515 | 530 | | |
| |||
528 | 543 | | |
529 | 544 | | |
530 | 545 | | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
531 | 549 | | |
532 | 550 | | |
533 | 551 | | |
| |||
0 commit comments