Commit a5b9a852 authored by Xin Long's avatar Xin Long Committed by Stefan Bader

sctp: get sctphdr by offset in sctp_compute_cksum

BugLink: https://bugs.launchpad.net/bugs/1826212

[ Upstream commit 273160ff ]

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: e6d8b64b ("net: sctp: fix and consolidate SCTP checksumming code")
Reported-by: default avatarLi Shuang <shuali@redhat.com>
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 5f0937b2
...@@ -60,7 +60,7 @@ static inline __wsum sctp_csum_combine(__wsum csum, __wsum csum2, ...@@ -60,7 +60,7 @@ static inline __wsum sctp_csum_combine(__wsum csum, __wsum csum2,
static inline __le32 sctp_compute_cksum(const struct sk_buff *skb, static inline __le32 sctp_compute_cksum(const struct sk_buff *skb,
unsigned int offset) unsigned int offset)
{ {
struct sctphdr *sh = sctp_hdr(skb); struct sctphdr *sh = (struct sctphdr *)(skb->data + offset);
__le32 ret, old = sh->checksum; __le32 ret, old = sh->checksum;
const struct skb_checksum_ops ops = { const struct skb_checksum_ops ops = {
.update = sctp_csum_update, .update = sctp_csum_update,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment