Commit 18c996e
rds: sysctl: rds_tcp_{rcv,snd}buf: avoid using current->nsproxy
As mentioned in a previous commit of this series, using the 'net'
structure via 'current' is not recommended for different reasons:
- Inconsistency: getting info from the reader's/writer's netns vs only
from the opener's netns.
- current->nsproxy can be NULL in some cases, resulting in an 'Oops'
(null-ptr-deref), e.g. when the current task is exiting, as spotted by
syzbot [1] using acct(2).
The per-netns structure can be obtained from the table->data using
container_of(), then the 'net' one can be retrieved from the listen
socket (if available).
Fixes: c6a58ff ("RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket")
Link: https://lore.kernel.org/[email protected] [1]
Suggested-by: Al Viro <[email protected]>
Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>1 parent 95bd289 commit 18c996e
1 file changed
+32
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
77 | | - | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
86 | | - | |
| 88 | + | |
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| |||
682 | 684 | | |
683 | 685 | | |
684 | 686 | | |
685 | | - | |
| 687 | + | |
| 688 | + | |
686 | 689 | | |
687 | 690 | | |
688 | | - | |
689 | 691 | | |
690 | 692 | | |
691 | 693 | | |
| |||
694 | 696 | | |
695 | 697 | | |
696 | 698 | | |
697 | | - | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
698 | 703 | | |
| 704 | + | |
| 705 | + | |
699 | 706 | | |
700 | 707 | | |
701 | 708 | | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
702 | 727 | | |
703 | 728 | | |
704 | 729 | | |
| |||
0 commit comments