Commit 8961749e5f498d91ded20dc797bb77aa366bca2e

Authored by Tim Smith
Committed by David Howells
1 parent 38dbfb59d1

af_rxrpc: Remove incorrect checksum calculation from rxrpc_recvmsg()

The UDP checksum was already verified in rxrpc_data_ready() - which calls
skb_checksum_complete() - as the RxRPC packet header contains no checksum of
its own.  Subsequent calls to skb_copy_and_csum_datagram_iovec() are thus
redundant and are, in any case, being passed only a subset of the UDP payload -
so the checksum will always fail if that path is taken.

So there is no need to check skb->ip_summed in rxrpc_recvmsg(), and no need for
the csum_copy_error: exit path.

Signed-off-by: Tim Smith <tim@electronghost.co.uk>
Signed-off-by: David Howells <dhowells@redhat.com>

Showing 1 changed file with 1 additions and 24 deletions Side-by-side Diff

net/rxrpc/ar-recvmsg.c
... ... @@ -180,16 +180,7 @@
180 180 if (copy > len - copied)
181 181 copy = len - copied;
182 182  
183   - if (skb->ip_summed == CHECKSUM_UNNECESSARY ||
184   - skb->ip_summed == CHECKSUM_PARTIAL) {
185   - ret = skb_copy_datagram_iovec(skb, offset,
186   - msg->msg_iov, copy);
187   - } else {
188   - ret = skb_copy_and_csum_datagram_iovec(skb, offset,
189   - msg->msg_iov);
190   - if (ret == -EINVAL)
191   - goto csum_copy_error;
192   - }
  183 + ret = skb_copy_datagram_iovec(skb, offset, msg->msg_iov, copy);
193 184  
194 185 if (ret < 0)
195 186 goto copy_error;
... ... @@ -347,20 +338,6 @@
347 338 rxrpc_put_call(continue_call);
348 339 _leave(" = %d", ret);
349 340 return ret;
350   -
351   -csum_copy_error:
352   - _debug("csum error");
353   - release_sock(&rx->sk);
354   - if (continue_call)
355   - rxrpc_put_call(continue_call);
356   - rxrpc_kill_skb(skb);
357   - if (!(flags & MSG_PEEK)) {
358   - if (skb_dequeue(&rx->sk.sk_receive_queue) != skb)
359   - BUG();
360   - }
361   - skb_kill_datagram(&rx->sk, skb, flags);
362   - rxrpc_put_call(call);
363   - return -EAGAIN;
364 341  
365 342 wait_interrupted:
366 343 ret = sock_intr_errno(timeo);