]> git.baikalelectronics.ru Git - kernel.git/commit
udp: fix skb_copy_and_csum_datagram with odd segment sizes
authorWillem de Bruijn <willemb@google.com>
Wed, 3 Feb 2021 19:29:52 +0000 (14:29 -0500)
committerJakub Kicinski <kuba@kernel.org>
Fri, 5 Feb 2021 02:56:56 +0000 (18:56 -0800)
commit36701e0c4c484fddfc1e65d74a406ce90950a8c9
tree55813d3d72a9cb35ec3e95363e292b8b210682e1
parent54ebcc9cca6a4ea98cce08b8e155429482466345
udp: fix skb_copy_and_csum_datagram with odd segment sizes

When iteratively computing a checksum with csum_block_add, track the
offset "pos" to correctly rotate in csum_block_add when offset is odd.

The open coded implementation of skb_copy_and_csum_datagram did this.
With the switch to __skb_datagram_iter calling csum_and_copy_to_iter,
pos was reinitialized to 0 on each call.

Bring back the pos by passing it along with the csum to the callback.

Changes v1->v2
  - pass csum value, instead of csump pointer (Alexander Duyck)

Link: https://lore.kernel.org/netdev/20210128152353.GB27281@optiplex/
Fixes: 8dc3f0dbe4ca ("datagram: consolidate datagram copy to iter helpers")
Reported-by: Oliver Graute <oliver.graute@gmail.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20210203192952.1849843-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/uio.h
lib/iov_iter.c
net/core/datagram.c