hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/net/ipv6/raw.c
....@@ -539,6 +539,7 @@
539539 static int rawv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
540540 struct raw6_sock *rp)
541541 {
542
+ struct ipv6_txoptions *opt;
542543 struct sk_buff *skb;
543544 int err = 0;
544545 int offset;
....@@ -556,6 +557,9 @@
556557
557558 offset = rp->offset;
558559 total_len = inet_sk(sk)->cork.base.length;
560
+ opt = inet6_sk(sk)->cork.opt;
561
+ total_len -= opt ? opt->opt_flen : 0;
562
+
559563 if (offset >= total_len - 1) {
560564 err = -EINVAL;
561565 ip6_flush_pending_frames(sk);
....@@ -824,7 +828,8 @@
824828
825829 if (!proto)
826830 proto = inet->inet_num;
827
- else if (proto != inet->inet_num)
831
+ else if (proto != inet->inet_num &&
832
+ inet->inet_num != IPPROTO_RAW)
828833 return -EINVAL;
829834
830835 if (proto > 255)
....@@ -1207,8 +1212,6 @@
12071212 lock_sock(sk);
12081213 ip6_flush_pending_frames(sk);
12091214 release_sock(sk);
1210
-
1211
- inet6_destroy_sock(sk);
12121215 }
12131216
12141217 static int rawv6_init_sk(struct sock *sk)