mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-04-05 21:07:57 +07:00
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>
This commit is contained in:
parent
4c72c53be5
commit
a8866ff6a5
@ -2298,7 +2298,12 @@ static int netlink_sendmsg(struct kiocb *kiocb, struct socket *sock,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* It's a really convoluted way for userland to ask for mmaped
|
||||||
|
* sendmsg(), but that's what we've got...
|
||||||
|
*/
|
||||||
if (netlink_tx_is_mmaped(sk) &&
|
if (netlink_tx_is_mmaped(sk) &&
|
||||||
|
msg->msg_iter.type == ITER_IOVEC &&
|
||||||
|
msg->msg_iter.nr_segs == 1 &&
|
||||||
msg->msg_iter.iov->iov_base == NULL) {
|
msg->msg_iter.iov->iov_base == NULL) {
|
||||||
err = netlink_mmap_sendmsg(sk, msg, dst_portid, dst_group,
|
err = netlink_mmap_sendmsg(sk, msg, dst_portid, dst_group,
|
||||||
&scm);
|
&scm);
|
||||||
|
Loading…
Reference in New Issue
Block a user