Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipv6: raw: Deduct extension header length in rawv6_push_pending_frames

The total cork length created by ip6_append_data includes extension
headers, so we must exclude them when comparing them against the
IPV6_CHECKSUM offset which does not include extension headers.

Reported-by: Kyle Zeng <zengyhkyle@gmail.com>
Fixes: 357b40a18b04 ("[IPV6]: IPV6_CHECKSUM socket option can corrupt kernel memory")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Herbert Xu and committed by
David S. Miller
cb3e9864 b0e380b5

+4
+4
net/ipv6/raw.c
··· 505 505 static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, 506 506 struct raw6_sock *rp) 507 507 { 508 + struct ipv6_txoptions *opt; 508 509 struct sk_buff *skb; 509 510 int err = 0; 510 511 int offset; ··· 523 522 524 523 offset = rp->offset; 525 524 total_len = inet_sk(sk)->cork.base.length; 525 + opt = inet6_sk(sk)->cork.opt; 526 + total_len -= opt ? opt->opt_flen : 0; 527 + 526 528 if (offset >= total_len - 1) { 527 529 err = -EINVAL; 528 530 ip6_flush_pending_frames(sk);