diff options
| author | Herbert Xu <herbert@gondor.apana.org.au> | 2023-01-10 08:59:06 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-18 11:30:52 +0100 |
| commit | f487d636e49bc1fdfbd8105bc1ab159164e2d8bd (patch) | |
| tree | 5d8e49c5938f9fe68ee2c80a3a3c035c21ce2a69 | |
| parent | 08ac1d9e9935f140b05a604ade5f0ad6a2bb39bf (diff) | |
| download | linux-f487d636e49bc1fdfbd8105bc1ab159164e2d8bd.tar.gz linux-f487d636e49bc1fdfbd8105bc1ab159164e2d8bd.tar.bz2 linux-f487d636e49bc1fdfbd8105bc1ab159164e2d8bd.zip | |
ipv6: raw: Deduct extension header length in rawv6_push_pending_frames
commit cb3e9864cdbe35ff6378966660edbcbac955fe17 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | net/ipv6/raw.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index ad7bd40b6d53..44e9a240d607 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -544,6 +544,7 @@ csum_copy_err: static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, struct raw6_sock *rp) { + struct ipv6_txoptions *opt; struct sk_buff *skb; int err = 0; int offset; @@ -561,6 +562,9 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, offset = rp->offset; total_len = inet_sk(sk)->cork.base.length; + opt = inet6_sk(sk)->cork.opt; + total_len -= opt ? opt->opt_flen : 0; + if (offset >= total_len - 1) { err = -EINVAL; ip6_flush_pending_frames(sk); |
