Commit 86b702c
committed
SUNRPC: Fix null-ptr-deref when xps sysfs alloc failed
jira LE-1907
Rebuild_History Non-Buildable kernel-rt-5.14.0-284.30.1.rt14.315.el9_2
commit-author Zhang Xiaoxu <[email protected]>
commit cbdeaee
There is a null-ptr-deref when xps sysfs alloc failed:
BUG: KASAN: null-ptr-deref in sysfs_do_create_link_sd+0x40/0xd0
Read of size 8 at addr 0000000000000030 by task gssproxy/457
CPU: 5 PID: 457 Comm: gssproxy Not tainted 6.0.0-09040-g02357b27ee03 ctrliq#9
Call Trace:
<TASK>
dump_stack_lvl+0x34/0x44
kasan_report+0xa3/0x120
sysfs_do_create_link_sd+0x40/0xd0
rpc_sysfs_client_setup+0x161/0x1b0
rpc_new_client+0x3fc/0x6e0
rpc_create_xprt+0x71/0x220
rpc_create+0x1d4/0x350
gssp_rpc_create+0xc3/0x160
set_gssp_clnt+0xbc/0x140
write_gssp+0x116/0x1a0
proc_reg_write+0xd6/0x130
vfs_write+0x177/0x690
ksys_write+0xb9/0x150
do_syscall_64+0x35/0x80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
When the xprt_switch sysfs alloc failed, should not add xprt and
switch sysfs to it, otherwise, maybe null-ptr-deref; also initialize
the 'xps_sysfs' to NULL to avoid oops when destroy it.
Fixes: 2a338a5 ("sunrpc: add a symlink from rpc-client directory to the xprt_switch")
Fixes: d408ebe ("sunrpc: add add sysfs directory per xprt under each xprt_switch")
Fixes: baea994 ("sunrpc: add xprt_switch direcotry to sunrpc's sysfs")
Signed-off-by: Zhang Xiaoxu <[email protected]>
Signed-off-by: Anna Schumaker <[email protected]>
(cherry picked from commit cbdeaee)
Signed-off-by: Jonathan Maple <[email protected]>1 parent ba5686f commit 86b702c
1 file changed
+10
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
521 | 526 | | |
522 | 527 | | |
523 | 528 | | |
524 | 529 | | |
525 | 530 | | |
526 | | - | |
527 | | - | |
528 | 531 | | |
529 | 532 | | |
530 | 533 | | |
| |||
558 | 561 | | |
559 | 562 | | |
560 | 563 | | |
| 564 | + | |
| 565 | + | |
561 | 566 | | |
562 | 567 | | |
563 | 568 | | |
| |||
569 | 574 | | |
570 | 575 | | |
571 | 576 | | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
572 | 580 | | |
573 | 581 | | |
574 | 582 | | |
| |||
0 commit comments