Commit dbd63e8
bpf: fix NULL pointer dereference in print_reg_state()
Syzkaller reported a general protection fault due to a NULL pointer
dereference in print_reg_state() when accessing reg->map_ptr without
checking if it is NULL.
The existing code assumes reg->map_ptr is always valid before
dereferencing reg->map_ptr->name, reg->map_ptr->key_size, and
reg->map_ptr->value_size.
Fix this by adding explicit NULL checks before accessing reg->map_ptr
and its members. This prevents crashes when reg->map_ptr is NULL,
improving the robustness of the BPF verifier's verbose logging.
Reported-by: [email protected]
Signed-off-by: Brahmajit Das <[email protected]>1 parent f2c71e8 commit dbd63e8
1 file changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
705 | 706 | | |
706 | 707 | | |
707 | 708 | | |
708 | | - | |
| 709 | + | |
709 | 710 | | |
710 | | - | |
711 | | - | |
712 | | - | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
713 | 715 | | |
714 | 716 | | |
715 | 717 | | |
| |||
0 commit comments