]>
Commit | Line | Data |
---|---|---|
e6c75312 GKH |
1 | From foo@baz Thu Mar 28 21:57:57 CET 2019 |
2 | From: Xin Long <lucien.xin@gmail.com> | |
3 | Date: Mon, 18 Mar 2019 19:47:00 +0800 | |
4 | Subject: sctp: get sctphdr by offset in sctp_compute_cksum | |
5 | ||
6 | From: Xin Long <lucien.xin@gmail.com> | |
7 | ||
8 | [ Upstream commit 273160ffc6b993c7c91627f5a84799c66dfe4dee ] | |
9 | ||
10 | sctp_hdr(skb) only works when skb->transport_header is set properly. | |
11 | ||
12 | But in Netfilter, skb->transport_header for ipv6 is not guaranteed | |
13 | to be right value for sctphdr. It would cause to fail to check the | |
14 | checksum for sctp packets. | |
15 | ||
16 | So fix it by using offset, which is always right in all places. | |
17 | ||
18 | v1->v2: | |
19 | - Fix the changelog. | |
20 | ||
21 | Fixes: e6d8b64b34aa ("net: sctp: fix and consolidate SCTP checksumming code") | |
22 | Reported-by: Li Shuang <shuali@redhat.com> | |
23 | Signed-off-by: Xin Long <lucien.xin@gmail.com> | |
24 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
25 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
26 | --- | |
27 | include/net/sctp/checksum.h | 2 +- | |
28 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
29 | ||
30 | --- a/include/net/sctp/checksum.h | |
31 | +++ b/include/net/sctp/checksum.h | |
32 | @@ -60,7 +60,7 @@ static inline __wsum sctp_csum_combine(_ | |
33 | static inline __le32 sctp_compute_cksum(const struct sk_buff *skb, | |
34 | unsigned int offset) | |
35 | { | |
36 | - struct sctphdr *sh = sctp_hdr(skb); | |
37 | + struct sctphdr *sh = (struct sctphdr *)(skb->data + offset); | |
38 | __le32 ret, old = sh->checksum; | |
39 | const struct skb_checksum_ops ops = { | |
40 | .update = sctp_csum_update, |