Skip to content
Snippets Groups Projects
Commit 273160ff authored by Xin Long's avatar Xin Long Committed by David S. Miller
Browse files

sctp: get sctphdr by offset in sctp_compute_cksum


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>
parent 18bed891
No related branches found
No related tags found
No related merge requests found
...@@ -61,7 +61,7 @@ static inline __wsum sctp_csum_combine(__wsum csum, __wsum csum2, ...@@ -61,7 +61,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);
const struct skb_checksum_ops ops = { const struct skb_checksum_ops ops = {
.update = sctp_csum_update, .update = sctp_csum_update,
.combine = sctp_csum_combine, .combine = sctp_csum_combine,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment