]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
netlink: make the check for "send from tx_ring" deterministic
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 13 Dec 2014 04:02:36 +0000 (23:02 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 4 Feb 2015 06:34:13 +0000 (01:34 -0500)
commita8866ff6a5bce7d0ec465a63bc482a85c09b0d39
treeba7534a7245d5230860564bb1e936a22a1c97e0c
parent4c72c53be5e3c8cf319a020ea671ab0fc32ec96f
netlink: make the check for "send from tx_ring" deterministic

As it is, zero msg_iovlen means that the first iovec in the kernel
array of iovecs is left uninitialized, so checking if its ->iov_base
is NULL is random.  Since the real users of that thing are doing
sendto(fd, NULL, 0, ...), they are getting msg_iovlen = 1 and
msg_iov[0] = {NULL, 0}, which is what this test is trying to catch.
As suggested by davem, let's just check that msg_iovlen was 1 and
msg_iov[0].iov_base was NULL - _that_ is well-defined and it catches
what we want to catch.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
net/netlink/af_netlink.c