summaryrefslogtreecommitdiffstats
path: root/net/rxrpc/ar-error.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2014-02-14 13:02:41 +0100
committerDavid Howells <dhowells@redhat.com>2014-02-26 18:25:01 +0100
commit6c9a2d3202973a0266beabc5274c3e67dad5db96 (patch)
tree15f7e49861faec55d167131093c68e8e0bd40d13 /net/rxrpc/ar-error.c
parentaf_rxrpc: Prevent RxRPC peers from ABORT-storming one another (diff)
downloadlinux-6c9a2d3202973a0266beabc5274c3e67dad5db96.tar.xz
linux-6c9a2d3202973a0266beabc5274c3e67dad5db96.zip
af_rxrpc: Fix UDP MTU calculation from ICMP_FRAG_NEEDED
AF_RXRPC sends UDP packets with the "Don't Fragment" bit set in an attempt to determine the maximum packet size between the local socket and the peer by invoking the generation of ICMP_FRAG_NEEDED packets. Once a packet is sent with the "Don't Fragment" bit set, it is then inconvenient to break it up as that requires recalculating all the rxrpc serial and sequence numbers and reencrypting all the fragments, so we switch off the "Don't Fragment" service temporarily and send the bounced packet again. Future packets then use the new MTU. That's all fine. The problem lies in rxrpc_UDP_error_report() where the code that deals with ICMP_FRAG_NEEDED packets lives. Packets of this type have a field (ee_info) to indicate the maximum packet size at the reporting node - but sometimes ee_info isn't filled in and is just left as 0 and the code must allow for this. When ee_info is 0, the code should take the MTU size we're currently using and reduce it for the next packet we want to send. However, it takes ee_info (which is known to be 0) and tries to reduce that instead. This was discovered by Coverity. Reported-by: Dave Jones <davej@redhat.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc/ar-error.c')
-rw-r--r--net/rxrpc/ar-error.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/rxrpc/ar-error.c b/net/rxrpc/ar-error.c
index a9206087b4d7..db57458c824c 100644
--- a/net/rxrpc/ar-error.c
+++ b/net/rxrpc/ar-error.c
@@ -83,6 +83,7 @@ void rxrpc_UDP_error_report(struct sock *sk)
if (mtu == 0) {
/* they didn't give us a size, estimate one */
+ mtu = peer->if_mtu;
if (mtu > 1500) {
mtu >>= 1;
if (mtu < 1500)