sctp: get sctphdr by offset in sctp_compute_cksum
authorXin Long <lucien.xin@gmail.com>
Mon, 18 Mar 2019 11:47:00 +0000 (19:47 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2019 04:26:17 +0000 (06:26 +0200)
commit97265479d7cadf5fa6597ee74371d3d21d2e8f94
tree3d4c40062147c9d7abee6901731ea0f4a9741deb
parentcf86f7a97561fbdf18edd25da833419196504db2
sctp: get sctphdr by offset in sctp_compute_cksum

[ Upstream commit 273160ffc6b993c7c91627f5a84799c66dfe4dee ]

sctp_hdr(skb) only works when skb->transport_header is set properly.

But in Netfilter, skb->transport_header for ipv6 is not guaranteed
to be right value for sctphdr. It would cause to fail to check the
checksum for sctp packets.

So fix it by using offset, which is always right in all places.

v1->v2:
  - Fix the changelog.

Fixes: e6d8b64b34aa ("net: sctp: fix and consolidate SCTP checksumming code")
Reported-by: Li Shuang <shuali@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/net/sctp/checksum.h