mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
rxrpc fixes for net-next
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEqG5UsNXhtOCrfGQP+7dXa6fLC2sFAmN0mecACgkQ+7dXa6fL C2sHIg/8Ce7qGGeGBlDXtpHumvLAOKh/Aq45GC68M6ZyScckIOXUYKSHnM+3XWln lUcuidsTyjHK7YRXzSLYZ56WREbr3GelEF1jh4iTt+UxBUn0gNV5C5PJQBL4KWcR qU5ZVlnbOHb19XzRsWSMjAhdAulwnG7nhvuKB+Zo1mx7VVLKED9DCQ3A+Mm92Dm9 DjV/skzh0PI1zTBMdM7DolydftizGOO6yiFjhd8ktzIZj0TdifB63bVbMgoasQrO SO+ZT9F4l/swiv12qgsYUH09SFdp2fdX3gt4Lj1JhwmXq/iSmeiHnvpJdbUW7RiI jDKLiE0XpXwix29P26gq+Sdsb2pd7Ni3+YY6Qteln7RekIe6g3g2xwOLbkIgpTvc NcwAbn0CL+ZLLts/udeIKHL5+ux1HZAAaHwftgysCHULLvxP4NrIcWrzVqzOLA9V SH2MI6fYuOUbpgsoGxgv0+8f7MOrgUW2C9ySHjZfUPAqhAG8DinqX9gdUiYPMVF9 GrqrETmmaJCxuQaFQ8BsWKkP+KLfsi3UfEOwv7HdHjOqvCKSXOg5hHjv6Ctpp5Kv yTj2BcAHjKB8FtuJ4h30UzVLhF1gquud+lPiO3Gbvbjhp1G1EQPwtcYjUamUre+w lxZ870Z/jEbqEOrH7Xh1VvoKcgtp8Y9idJeU+8VNLL/r96nCF2E= =xivU -----END PGP SIGNATURE----- Merge tag 'rxrpc-next-20221116' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs David Howells says: ==================== rxrpc: Fix oops and missing config conditionals The patches that were pulled into net-next previously[1] had some issues that this patchset fixes: (1) Fix missing IPV6 config conditionals. (2) Fix an oops caused by calling udpv6_sendmsg() directly on an AF_INET socket. (3) Fix the validation of network addresses on entry to socket functions so that we don't allow an AF_INET6 address if we've selected an AF_INET transport socket. Link: https://lore.kernel.org/r/166794587113.2389296.16484814996876530222.stgit@warthog.procyon.org.uk/ [1] ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
8cf4f8c7d9
|
@ -93,12 +93,11 @@ static int rxrpc_validate_address(struct rxrpc_sock *rx,
|
|||
srx->transport_len > len)
|
||||
return -EINVAL;
|
||||
|
||||
if (srx->transport.family != rx->family &&
|
||||
srx->transport.family == AF_INET && rx->family != AF_INET6)
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
switch (srx->transport.family) {
|
||||
case AF_INET:
|
||||
if (rx->family != AF_INET &&
|
||||
rx->family != AF_INET6)
|
||||
return -EAFNOSUPPORT;
|
||||
if (srx->transport_len < sizeof(struct sockaddr_in))
|
||||
return -EINVAL;
|
||||
tail = offsetof(struct sockaddr_rxrpc, transport.sin.__pad);
|
||||
|
@ -106,6 +105,8 @@ static int rxrpc_validate_address(struct rxrpc_sock *rx,
|
|||
|
||||
#ifdef CONFIG_AF_RXRPC_IPV6
|
||||
case AF_INET6:
|
||||
if (rx->family != AF_INET6)
|
||||
return -EAFNOSUPPORT;
|
||||
if (srx->transport_len < sizeof(struct sockaddr_in6))
|
||||
return -EINVAL;
|
||||
tail = offsetof(struct sockaddr_rxrpc, transport) +
|
||||
|
|
|
@ -33,7 +33,8 @@ static void rxrpc_encap_err_rcv(struct sock *sk, struct sk_buff *skb, int err,
|
|||
{
|
||||
if (ip_hdr(skb)->version == IPVERSION)
|
||||
return ip_icmp_error(sk, skb, err, port, info, payload);
|
||||
return ipv6_icmp_error(sk, skb, err, port, info, payload);
|
||||
if (IS_ENABLED(CONFIG_AF_RXRPC_IPV6))
|
||||
return ipv6_icmp_error(sk, skb, err, port, info, payload);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -18,15 +18,21 @@
|
|||
|
||||
extern int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len);
|
||||
|
||||
static ssize_t do_udp_sendmsg(struct socket *sk, struct msghdr *msg, size_t len)
|
||||
static ssize_t do_udp_sendmsg(struct socket *socket, struct msghdr *msg, size_t len)
|
||||
{
|
||||
#if IS_ENABLED(CONFIG_AF_RXRPC_IPV6)
|
||||
struct sockaddr *sa = msg->msg_name;
|
||||
struct sock *sk = socket->sk;
|
||||
|
||||
if (sa->sa_family == AF_INET6)
|
||||
return udpv6_sendmsg(sk->sk, msg, len);
|
||||
#endif
|
||||
return udp_sendmsg(sk->sk, msg, len);
|
||||
if (IS_ENABLED(CONFIG_AF_RXRPC_IPV6)) {
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
if (sk->sk_family != AF_INET6) {
|
||||
pr_warn("AF_INET6 address on AF_INET socket\n");
|
||||
return -ENOPROTOOPT;
|
||||
}
|
||||
return udpv6_sendmsg(sk, msg, len);
|
||||
}
|
||||
}
|
||||
return udp_sendmsg(sk, msg, len);
|
||||
}
|
||||
|
||||
struct rxrpc_abort_buffer {
|
||||
|
|
Loading…
Reference in a new issue