Skip to content

Commit 5866a6d

Browse files
herbertxngboonkhai
authored andcommitted
ipv6: raw: Deduct extension header length in rawv6_push_pending_frames
commit cb3e986 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 <[email protected]> Fixes: 357b40a ("[IPV6]: IPV6_CHECKSUM socket option can corrupt kernel memory") Signed-off-by: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 85d3266 commit 5866a6d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/ipv6/raw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ static int rawv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
505505
static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
506506
struct raw6_sock *rp)
507507
{
508+
struct ipv6_txoptions *opt;
508509
struct sk_buff *skb;
509510
int err = 0;
510511
int offset;
@@ -522,6 +523,9 @@ static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
522523

523524
offset = rp->offset;
524525
total_len = inet_sk(sk)->cork.base.length;
526+
opt = inet6_sk(sk)->cork.opt;
527+
total_len -= opt ? opt->opt_flen : 0;
528+
525529
if (offset >= total_len - 1) {
526530
err = -EINVAL;
527531
ip6_flush_pending_frames(sk);

0 commit comments

Comments
 (0)