Repository navigation
net: bpf: handle return value of BPF_CGROUP_RUN_PROG_INET4_POST_BIND() - #2339
kernel-patches-bot wants to merge 2 commits into
Conversation
|
Master branch: ecf45e6 |
|
Master branch: f60edf5 |
15d4d15 to
d03557e
Compare
|
Master branch: 5b3d729 |
d03557e to
6a00ec7
Compare
|
Master branch: b645941 |
6a00ec7 to
fec6ec3
Compare
|
Master branch: 3ccdcee |
The return value of BPF_CGROUP_RUN_PROG_INET4_POST_BIND() in
__inet_bind() is not handled properly. While the return value
is non-zero, it will set inet_saddr and inet_rcv_saddr to 0 and
exit:
err = BPF_CGROUP_RUN_PROG_INET4_POST_BIND(sk);
if (err) {
inet->inet_saddr = inet->inet_rcv_saddr = 0;
goto out_release_sock;
}
Let's take UDP for example and see what will happen. For UDP
socket, it will be added to 'udp_prot.h.udp_table->hash' and
'udp_prot.h.udp_table->hash2' after the sk->sk_prot->get_port()
called success. If 'inet->inet_rcv_saddr' is specified here,
then 'sk' will be in the 'hslot2' of 'hash2' that it don't belong
to (because inet_saddr is changed to 0), and UDP packet received
will not be passed to this sock. If 'inet->inet_rcv_saddr' is not
specified here, the sock will work fine, as it can receive packet
properly, which is wired, as the 'bind()' is already failed.
I'm not sure what should do here, maybe we should unhash the sock
for UDP? Therefor, user can try to bind another port?
Signed-off-by: Menglong Dong <[email protected]>
fec6ec3 to
0e17c94
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=601424 expired. Closing PR. |
Pull request for series with
subject: net: bpf: handle return value of BPF_CGROUP_RUN_PROG_INET4_POST_BIND()
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=601424