From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [RFC PATCH] fix xfrm MTU regression
Date: Fri, 30 Apr 2021 07:17:45 +0800 [thread overview]
Message-ID: <202104300738.YRjWCNmt-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 31458 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210429170254.5grfgsz2hgy2qjhk@dwarf.suse.cz>
References: <20210429170254.5grfgsz2hgy2qjhk@dwarf.suse.cz>
TO: Jiri Bohac <jbohac@suse.cz>
Hi Jiri,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linus/master]
[also build test WARNING on v5.12 next-20210429]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jiri-Bohac/fix-xfrm-MTU-regression/20210430-010412
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d72cd4ad4174cfd2257c426ad51e4f53bcfde9c9
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: i386-randconfig-m021-20210429 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
net/ipv6/ip6_output.c:1501 __ip6_append_data() error: uninitialized symbol 'headersize'.
Old smatch warnings:
net/ipv6/ip6_output.c:292 ip6_xmit() error: we previously assumed 'np' could be null (see line 286)
vim +/headersize +1501 net/ipv6/ip6_output.c
366e41d9774d70 Vlad Yasevich 2015-01-31 1419
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1420 static int __ip6_append_data(struct sock *sk,
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1421 struct flowi6 *fl6,
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1422 struct sk_buff_head *queue,
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1423 struct inet_cork *cork,
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1424 struct inet6_cork *v6_cork,
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1425 struct page_frag *pfrag,
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1426 int getfrag(void *from, char *to, int offset,
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1427 int len, int odd, struct sk_buff *skb),
366e41d9774d70 Vlad Yasevich 2015-01-31 1428 void *from, int length, int transhdrlen,
5fdaa88dfefa87 Willem de Bruijn 2018-07-06 1429 unsigned int flags, struct ipcm6_cookie *ipc6)
366e41d9774d70 Vlad Yasevich 2015-01-31 1430 {
366e41d9774d70 Vlad Yasevich 2015-01-31 1431 struct sk_buff *skb, *skb_prev = NULL;
10b8a3de603df7 Paolo Abeni 2018-03-23 1432 unsigned int maxfraglen, fragheaderlen, mtu, orig_mtu, pmtu;
b5947e5d1e710c Willem de Bruijn 2018-11-30 1433 struct ubuf_info *uarg = NULL;
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1434 int exthdrlen = 0;
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1435 int dst_exthdrlen = 0;
366e41d9774d70 Vlad Yasevich 2015-01-31 1436 int hh_len;
366e41d9774d70 Vlad Yasevich 2015-01-31 1437 int copy;
366e41d9774d70 Vlad Yasevich 2015-01-31 1438 int err;
366e41d9774d70 Vlad Yasevich 2015-01-31 1439 int offset = 0;
366e41d9774d70 Vlad Yasevich 2015-01-31 1440 u32 tskey = 0;
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1441 struct rt6_info *rt = (struct rt6_info *)cork->dst;
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1442 struct ipv6_txoptions *opt = v6_cork->opt;
32dce968dd987a Vlad Yasevich 2015-01-31 1443 int csummode = CHECKSUM_NONE;
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1444 unsigned int maxnonfragsize, headersize;
1f4c6eb2402968 Eric Dumazet 2018-03-31 1445 unsigned int wmem_alloc_delta = 0;
100f6d8e09905c Willem de Bruijn 2019-05-30 1446 bool paged, extra_uref = false;
366e41d9774d70 Vlad Yasevich 2015-01-31 1447
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1448 skb = skb_peek_tail(queue);
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1449 if (!skb) {
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1450 exthdrlen = opt ? opt->opt_flen : 0;
7efdba5bd9a2f3 Romain KUNTZ 2013-01-16 1451 dst_exthdrlen = rt->dst.header_len - rt->rt6i_nfheader_len;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1452 }
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1453
15e36f5b8e982d Willem de Bruijn 2018-04-26 1454 paged = !!cork->gso_size;
bec1f6f697362c Willem de Bruijn 2018-04-26 1455 mtu = cork->gso_size ? IP6_MAX_MTU : cork->fragsize;
e367c2d03dba4c lucien 2014-03-17 1456 orig_mtu = mtu;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1457
678ca42d688534 Willem de Bruijn 2018-07-06 1458 if (cork->tx_flags & SKBTX_ANY_SW_TSTAMP &&
678ca42d688534 Willem de Bruijn 2018-07-06 1459 sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)
678ca42d688534 Willem de Bruijn 2018-07-06 1460 tskey = sk->sk_tskey++;
678ca42d688534 Willem de Bruijn 2018-07-06 1461
d8d1f30b95a635 Changli Gao 2010-06-10 1462 hh_len = LL_RESERVED_SPACE(rt->dst.dev);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1463
a1b051405bc162 Masahide NAKAMURA 2007-12-20 1464 fragheaderlen = sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len +
b4ce92775c2e7f Herbert Xu 2007-11-13 1465 (opt ? opt->opt_nflen : 0);
f556543e005a1e Jiri Bohac 2021-04-29 1466
f556543e005a1e Jiri Bohac 2021-04-29 1467 if (mtu < fragheaderlen ||
f556543e005a1e Jiri Bohac 2021-04-29 1468 ((mtu - fragheaderlen) & ~7) + fragheaderlen < sizeof(struct frag_hdr))
f556543e005a1e Jiri Bohac 2021-04-29 1469 goto emsgsize;
f556543e005a1e Jiri Bohac 2021-04-29 1470
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1471 maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen -
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1472 sizeof(struct frag_hdr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1473
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1474 headersize = sizeof(struct ipv6hdr) +
3a1cebe7e05027 Hannes Frederic Sowa 2014-05-11 1475 (opt ? opt->opt_flen + opt->opt_nflen : 0) +
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1476 (dst_allfrag(&rt->dst) ?
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1477 sizeof(struct frag_hdr) : 0) +
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1478 rt->rt6i_nfheader_len;
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1479
10b8a3de603df7 Paolo Abeni 2018-03-23 1480 /* as per RFC 7112 section 5, the entire IPv6 Header Chain must fit
10b8a3de603df7 Paolo Abeni 2018-03-23 1481 * the first fragment
10b8a3de603df7 Paolo Abeni 2018-03-23 1482 */
10b8a3de603df7 Paolo Abeni 2018-03-23 1483 if (headersize + transhdrlen > mtu)
10b8a3de603df7 Paolo Abeni 2018-03-23 1484 goto emsgsize;
10b8a3de603df7 Paolo Abeni 2018-03-23 1485
26879da58711aa Wei Wang 2016-05-02 1486 if (cork->length + length > mtu - headersize && ipc6->dontfrag &&
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1487 (sk->sk_protocol == IPPROTO_UDP ||
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1488 sk->sk_protocol == IPPROTO_RAW)) {
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1489 ipv6_local_rxpmtu(sk, fl6, mtu - headersize +
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1490 sizeof(struct ipv6hdr));
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1491 goto emsgsize;
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1492 }
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1493
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1494 if (ip6_sk_ignore_df(sk))
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1495 maxnonfragsize = sizeof(struct ipv6hdr) + IPV6_MAXPLEN;
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1496 else
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1497 maxnonfragsize = mtu;
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1498
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1499 if (cork->length + length > maxnonfragsize - headersize) {
4df98e76cde7c6 Hannes Frederic Sowa 2013-12-16 1500 emsgsize:
10b8a3de603df7 Paolo Abeni 2018-03-23 @1501 pmtu = max_t(int, mtu - headersize + sizeof(struct ipv6hdr), 0);
10b8a3de603df7 Paolo Abeni 2018-03-23 1502 ipv6_local_error(sk, EMSGSIZE, fl6, pmtu);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1503 return -EMSGSIZE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1504 }
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1505
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1506 /* CHECKSUM_PARTIAL only with no extension headers and when
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1507 * we are not going to fragment
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1508 */
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1509 if (transhdrlen && sk->sk_protocol == IPPROTO_UDP &&
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1510 headersize == sizeof(struct ipv6hdr) &&
2b89ed65a6f201 Vlad Yasevich 2017-01-29 1511 length <= mtu - headersize &&
bec1f6f697362c Willem de Bruijn 2018-04-26 1512 (!(flags & MSG_MORE) || cork->gso_size) &&
c8cd0989bd151f Tom Herbert 2015-12-14 1513 rt->dst.dev->features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM))
682b1a9d3f9686 Hannes Frederic Sowa 2015-10-27 1514 csummode = CHECKSUM_PARTIAL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1515
b5947e5d1e710c Willem de Bruijn 2018-11-30 1516 if (flags & MSG_ZEROCOPY && length && sock_flag(sk, SOCK_ZEROCOPY)) {
8c793822c5803e Jonathan Lemon 2021-01-06 1517 uarg = msg_zerocopy_realloc(sk, length, skb_zcopy(skb));
b5947e5d1e710c Willem de Bruijn 2018-11-30 1518 if (!uarg)
b5947e5d1e710c Willem de Bruijn 2018-11-30 1519 return -ENOBUFS;
522924b583082f Willem de Bruijn 2019-06-07 1520 extra_uref = !skb_zcopy(skb); /* only ref on new uarg */
b5947e5d1e710c Willem de Bruijn 2018-11-30 1521 if (rt->dst.dev->features & NETIF_F_SG &&
b5947e5d1e710c Willem de Bruijn 2018-11-30 1522 csummode == CHECKSUM_PARTIAL) {
b5947e5d1e710c Willem de Bruijn 2018-11-30 1523 paged = true;
b5947e5d1e710c Willem de Bruijn 2018-11-30 1524 } else {
b5947e5d1e710c Willem de Bruijn 2018-11-30 1525 uarg->zerocopy = 0;
52900d22288e7d Willem de Bruijn 2018-11-30 1526 skb_zcopy_set(skb, uarg, &extra_uref);
b5947e5d1e710c Willem de Bruijn 2018-11-30 1527 }
b5947e5d1e710c Willem de Bruijn 2018-11-30 1528 }
b5947e5d1e710c Willem de Bruijn 2018-11-30 1529
^1da177e4c3f41 Linus Torvalds 2005-04-16 1530 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 1531 * Let's try using as much space as possible.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1532 * Use MTU if total length of the message fits into the MTU.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1533 * Otherwise, we need to reserve fragment header and
^1da177e4c3f41 Linus Torvalds 2005-04-16 1534 * fragment alignment (= 8-15 octects, in total).
^1da177e4c3f41 Linus Torvalds 2005-04-16 1535 *
634a63e73f0594 Randy Dunlap 2020-09-17 1536 * Note that we may need to "move" the data from the tail
^1da177e4c3f41 Linus Torvalds 2005-04-16 1537 * of the buffer to the new fragment when we split
^1da177e4c3f41 Linus Torvalds 2005-04-16 1538 * the message.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1539 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 1540 * FIXME: It may be fragmented into multiple chunks
^1da177e4c3f41 Linus Torvalds 2005-04-16 1541 * at once if non-fragmentable extension headers
^1da177e4c3f41 Linus Torvalds 2005-04-16 1542 * are too large.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1543 * --yoshfuji
^1da177e4c3f41 Linus Torvalds 2005-04-16 1544 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1545
2811ebac2521ce Hannes Frederic Sowa 2013-09-21 1546 cork->length += length;
2811ebac2521ce Hannes Frederic Sowa 2013-09-21 1547 if (!skb)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1548 goto alloc_new_skb;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1549
^1da177e4c3f41 Linus Torvalds 2005-04-16 1550 while (length > 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1551 /* Check if the remaining data fits into current packet. */
bdc712b4c2baf9 David S. Miller 2011-05-06 1552 copy = (cork->length <= mtu && !(cork->flags & IPCORK_ALLFRAG) ? mtu : maxfraglen) - skb->len;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1553 if (copy < length)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1554 copy = maxfraglen - skb->len;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1555
^1da177e4c3f41 Linus Torvalds 2005-04-16 1556 if (copy <= 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1557 char *data;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1558 unsigned int datalen;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1559 unsigned int fraglen;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1560 unsigned int fraggap;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1561 unsigned int alloclen;
aba36930a35e7f Willem de Bruijn 2018-11-24 1562 unsigned int pagedlen;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1563 alloc_new_skb:
^1da177e4c3f41 Linus Torvalds 2005-04-16 1564 /* There's no room in the current skb */
0c1833797a5a6e Gao feng 2012-05-26 1565 if (skb)
0c1833797a5a6e Gao feng 2012-05-26 1566 fraggap = skb->len - maxfraglen;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1567 else
^1da177e4c3f41 Linus Torvalds 2005-04-16 1568 fraggap = 0;
0c1833797a5a6e Gao feng 2012-05-26 1569 /* update mtu and maxfraglen if necessary */
63159f29be1df7 Ian Morris 2015-03-29 1570 if (!skb || !skb_prev)
0c1833797a5a6e Gao feng 2012-05-26 1571 ip6_append_data_mtu(&mtu, &maxfraglen,
75a493e60ac4bb Hannes Frederic Sowa 2013-07-02 1572 fragheaderlen, skb, rt,
e367c2d03dba4c lucien 2014-03-17 1573 orig_mtu);
0c1833797a5a6e Gao feng 2012-05-26 1574
0c1833797a5a6e Gao feng 2012-05-26 1575 skb_prev = skb;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1576
^1da177e4c3f41 Linus Torvalds 2005-04-16 1577 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 1578 * If remaining data exceeds the mtu,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1579 * we know we need more fragment(s).
^1da177e4c3f41 Linus Torvalds 2005-04-16 1580 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1581 datalen = length + fraggap;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1582
0c1833797a5a6e Gao feng 2012-05-26 1583 if (datalen > (cork->length <= mtu && !(cork->flags & IPCORK_ALLFRAG) ? mtu : maxfraglen) - fragheaderlen)
0c1833797a5a6e Gao feng 2012-05-26 1584 datalen = maxfraglen - fragheaderlen - rt->dst.trailer_len;
15e36f5b8e982d Willem de Bruijn 2018-04-26 1585 fraglen = datalen + fragheaderlen;
aba36930a35e7f Willem de Bruijn 2018-11-24 1586 pagedlen = 0;
15e36f5b8e982d Willem de Bruijn 2018-04-26 1587
^1da177e4c3f41 Linus Torvalds 2005-04-16 1588 if ((flags & MSG_MORE) &&
d8d1f30b95a635 Changli Gao 2010-06-10 1589 !(rt->dst.dev->features&NETIF_F_SG))
^1da177e4c3f41 Linus Torvalds 2005-04-16 1590 alloclen = mtu;
15e36f5b8e982d Willem de Bruijn 2018-04-26 1591 else if (!paged)
15e36f5b8e982d Willem de Bruijn 2018-04-26 1592 alloclen = fraglen;
15e36f5b8e982d Willem de Bruijn 2018-04-26 1593 else {
15e36f5b8e982d Willem de Bruijn 2018-04-26 1594 alloclen = min_t(int, fraglen, MAX_HEADER);
15e36f5b8e982d Willem de Bruijn 2018-04-26 1595 pagedlen = fraglen - alloclen;
15e36f5b8e982d Willem de Bruijn 2018-04-26 1596 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1597
299b0767642a65 Steffen Klassert 2011-10-11 1598 alloclen += dst_exthdrlen;
299b0767642a65 Steffen Klassert 2011-10-11 1599
0c1833797a5a6e Gao feng 2012-05-26 1600 if (datalen != length + fraggap) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1601 /*
0c1833797a5a6e Gao feng 2012-05-26 1602 * this is not the last fragment, the trailer
0c1833797a5a6e Gao feng 2012-05-26 1603 * space is regarded as data space.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1604 */
0c1833797a5a6e Gao feng 2012-05-26 1605 datalen += rt->dst.trailer_len;
0c1833797a5a6e Gao feng 2012-05-26 1606 }
0c1833797a5a6e Gao feng 2012-05-26 1607
d8d1f30b95a635 Changli Gao 2010-06-10 1608 alloclen += rt->dst.trailer_len;
0c1833797a5a6e Gao feng 2012-05-26 1609 fraglen = datalen + fragheaderlen;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1610
^1da177e4c3f41 Linus Torvalds 2005-04-16 1611 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 1612 * We just reserve space for fragment header.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1613 * Note: this may be overallocation if the message
^1da177e4c3f41 Linus Torvalds 2005-04-16 1614 * (without MSG_MORE) fits into the MTU.
^1da177e4c3f41 Linus Torvalds 2005-04-16 1615 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1616 alloclen += sizeof(struct frag_hdr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1617
15e36f5b8e982d Willem de Bruijn 2018-04-26 1618 copy = datalen - transhdrlen - fraggap - pagedlen;
232cd35d0804cc Eric Dumazet 2017-05-19 1619 if (copy < 0) {
232cd35d0804cc Eric Dumazet 2017-05-19 1620 err = -EINVAL;
232cd35d0804cc Eric Dumazet 2017-05-19 1621 goto error;
232cd35d0804cc Eric Dumazet 2017-05-19 1622 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1623 if (transhdrlen) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1624 skb = sock_alloc_send_skb(sk,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1625 alloclen + hh_len,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1626 (flags & MSG_DONTWAIT), &err);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1627 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1628 skb = NULL;
1f4c6eb2402968 Eric Dumazet 2018-03-31 1629 if (refcount_read(&sk->sk_wmem_alloc) + wmem_alloc_delta <=
^1da177e4c3f41 Linus Torvalds 2005-04-16 1630 2 * sk->sk_sndbuf)
1f4c6eb2402968 Eric Dumazet 2018-03-31 1631 skb = alloc_skb(alloclen + hh_len,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1632 sk->sk_allocation);
63159f29be1df7 Ian Morris 2015-03-29 1633 if (unlikely(!skb))
^1da177e4c3f41 Linus Torvalds 2005-04-16 1634 err = -ENOBUFS;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1635 }
63159f29be1df7 Ian Morris 2015-03-29 1636 if (!skb)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1637 goto error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1638 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 1639 * Fill in the control structures
^1da177e4c3f41 Linus Torvalds 2005-04-16 1640 */
9c9c9ad5fae7e9 Hannes Frederic Sowa 2013-08-26 1641 skb->protocol = htons(ETH_P_IPV6);
32dce968dd987a Vlad Yasevich 2015-01-31 1642 skb->ip_summed = csummode;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1643 skb->csum = 0;
1f85851e17b64c Gao feng 2012-03-19 1644 /* reserve for fragmentation and ipsec header */
1f85851e17b64c Gao feng 2012-03-19 1645 skb_reserve(skb, hh_len + sizeof(struct frag_hdr) +
1f85851e17b64c Gao feng 2012-03-19 1646 dst_exthdrlen);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1647
^1da177e4c3f41 Linus Torvalds 2005-04-16 1648 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 1649 * Find where to start putting bytes
^1da177e4c3f41 Linus Torvalds 2005-04-16 1650 */
15e36f5b8e982d Willem de Bruijn 2018-04-26 1651 data = skb_put(skb, fraglen - pagedlen);
1f85851e17b64c Gao feng 2012-03-19 1652 skb_set_network_header(skb, exthdrlen);
1f85851e17b64c Gao feng 2012-03-19 1653 data += fragheaderlen;
b0e380b1d8a8e0 Arnaldo Carvalho de Melo 2007-04-10 1654 skb->transport_header = (skb->network_header +
b0e380b1d8a8e0 Arnaldo Carvalho de Melo 2007-04-10 1655 fragheaderlen);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1656 if (fraggap) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1657 skb->csum = skb_copy_and_csum_bits(
^1da177e4c3f41 Linus Torvalds 2005-04-16 1658 skb_prev, maxfraglen,
8d5930dfb7edbf Al Viro 2020-07-10 1659 data + transhdrlen, fraggap);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1660 skb_prev->csum = csum_sub(skb_prev->csum,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1661 skb->csum);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1662 data += fraggap;
e9fa4f7bd291c2 Herbert Xu 2006-08-13 1663 pskb_trim_unique(skb_prev, maxfraglen);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1664 }
232cd35d0804cc Eric Dumazet 2017-05-19 1665 if (copy > 0 &&
232cd35d0804cc Eric Dumazet 2017-05-19 1666 getfrag(from, data + transhdrlen, offset,
232cd35d0804cc Eric Dumazet 2017-05-19 1667 copy, fraggap, skb) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1668 err = -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1669 kfree_skb(skb);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1670 goto error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1671 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1672
^1da177e4c3f41 Linus Torvalds 2005-04-16 1673 offset += copy;
15e36f5b8e982d Willem de Bruijn 2018-04-26 1674 length -= copy + transhdrlen;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1675 transhdrlen = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1676 exthdrlen = 0;
299b0767642a65 Steffen Klassert 2011-10-11 1677 dst_exthdrlen = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1678
52900d22288e7d Willem de Bruijn 2018-11-30 1679 /* Only the initial fragment is time stamped */
52900d22288e7d Willem de Bruijn 2018-11-30 1680 skb_shinfo(skb)->tx_flags = cork->tx_flags;
52900d22288e7d Willem de Bruijn 2018-11-30 1681 cork->tx_flags = 0;
52900d22288e7d Willem de Bruijn 2018-11-30 1682 skb_shinfo(skb)->tskey = tskey;
52900d22288e7d Willem de Bruijn 2018-11-30 1683 tskey = 0;
52900d22288e7d Willem de Bruijn 2018-11-30 1684 skb_zcopy_set(skb, uarg, &extra_uref);
52900d22288e7d Willem de Bruijn 2018-11-30 1685
0dec879f636f11 Julian Anastasov 2017-02-06 1686 if ((flags & MSG_CONFIRM) && !skb_prev)
0dec879f636f11 Julian Anastasov 2017-02-06 1687 skb_set_dst_pending_confirm(skb, 1);
0dec879f636f11 Julian Anastasov 2017-02-06 1688
^1da177e4c3f41 Linus Torvalds 2005-04-16 1689 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 1690 * Put the packet on the pending queue
^1da177e4c3f41 Linus Torvalds 2005-04-16 1691 */
1f4c6eb2402968 Eric Dumazet 2018-03-31 1692 if (!skb->destructor) {
1f4c6eb2402968 Eric Dumazet 2018-03-31 1693 skb->destructor = sock_wfree;
1f4c6eb2402968 Eric Dumazet 2018-03-31 1694 skb->sk = sk;
1f4c6eb2402968 Eric Dumazet 2018-03-31 1695 wmem_alloc_delta += skb->truesize;
1f4c6eb2402968 Eric Dumazet 2018-03-31 1696 }
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1697 __skb_queue_tail(queue, skb);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1698 continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1699 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1700
^1da177e4c3f41 Linus Torvalds 2005-04-16 1701 if (copy > length)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1702 copy = length;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1703
113f99c3358564 Willem de Bruijn 2018-05-17 1704 if (!(rt->dst.dev->features&NETIF_F_SG) &&
113f99c3358564 Willem de Bruijn 2018-05-17 1705 skb_tailroom(skb) >= copy) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1706 unsigned int off;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1707
^1da177e4c3f41 Linus Torvalds 2005-04-16 1708 off = skb->len;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1709 if (getfrag(from, skb_put(skb, copy),
^1da177e4c3f41 Linus Torvalds 2005-04-16 1710 offset, copy, off, skb) < 0) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1711 __skb_trim(skb, off);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1712 err = -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1713 goto error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1714 }
b5947e5d1e710c Willem de Bruijn 2018-11-30 1715 } else if (!uarg || !uarg->zerocopy) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1716 int i = skb_shinfo(skb)->nr_frags;
5640f7685831e0 Eric Dumazet 2012-09-23 1717
^1da177e4c3f41 Linus Torvalds 2005-04-16 1718 err = -ENOMEM;
5640f7685831e0 Eric Dumazet 2012-09-23 1719 if (!sk_page_frag_refill(sk, pfrag))
^1da177e4c3f41 Linus Torvalds 2005-04-16 1720 goto error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1721
5640f7685831e0 Eric Dumazet 2012-09-23 1722 if (!skb_can_coalesce(skb, i, pfrag->page,
5640f7685831e0 Eric Dumazet 2012-09-23 1723 pfrag->offset)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1724 err = -EMSGSIZE;
5640f7685831e0 Eric Dumazet 2012-09-23 1725 if (i == MAX_SKB_FRAGS)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1726 goto error;
5640f7685831e0 Eric Dumazet 2012-09-23 1727
5640f7685831e0 Eric Dumazet 2012-09-23 1728 __skb_fill_page_desc(skb, i, pfrag->page,
5640f7685831e0 Eric Dumazet 2012-09-23 1729 pfrag->offset, 0);
5640f7685831e0 Eric Dumazet 2012-09-23 1730 skb_shinfo(skb)->nr_frags = ++i;
5640f7685831e0 Eric Dumazet 2012-09-23 1731 get_page(pfrag->page);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1732 }
5640f7685831e0 Eric Dumazet 2012-09-23 1733 copy = min_t(int, copy, pfrag->size - pfrag->offset);
9e903e085262ff Eric Dumazet 2011-10-18 1734 if (getfrag(from,
5640f7685831e0 Eric Dumazet 2012-09-23 1735 page_address(pfrag->page) + pfrag->offset,
5640f7685831e0 Eric Dumazet 2012-09-23 1736 offset, copy, skb->len, skb) < 0)
5640f7685831e0 Eric Dumazet 2012-09-23 1737 goto error_efault;
5640f7685831e0 Eric Dumazet 2012-09-23 1738
5640f7685831e0 Eric Dumazet 2012-09-23 1739 pfrag->offset += copy;
5640f7685831e0 Eric Dumazet 2012-09-23 1740 skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], copy);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1741 skb->len += copy;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1742 skb->data_len += copy;
f945fa7ad9c12a Herbert Xu 2008-01-22 1743 skb->truesize += copy;
1f4c6eb2402968 Eric Dumazet 2018-03-31 1744 wmem_alloc_delta += copy;
b5947e5d1e710c Willem de Bruijn 2018-11-30 1745 } else {
b5947e5d1e710c Willem de Bruijn 2018-11-30 1746 err = skb_zerocopy_iter_dgram(skb, from, copy);
b5947e5d1e710c Willem de Bruijn 2018-11-30 1747 if (err < 0)
b5947e5d1e710c Willem de Bruijn 2018-11-30 1748 goto error;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1749 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1750 offset += copy;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1751 length -= copy;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1752 }
5640f7685831e0 Eric Dumazet 2012-09-23 1753
9e8445a56c253f Paolo Abeni 2018-04-04 1754 if (wmem_alloc_delta)
1f4c6eb2402968 Eric Dumazet 2018-03-31 1755 refcount_add(wmem_alloc_delta, &sk->sk_wmem_alloc);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1756 return 0;
5640f7685831e0 Eric Dumazet 2012-09-23 1757
5640f7685831e0 Eric Dumazet 2012-09-23 1758 error_efault:
5640f7685831e0 Eric Dumazet 2012-09-23 1759 err = -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1760 error:
8e0449172497a9 Jonathan Lemon 2021-01-06 1761 net_zcopy_put_abort(uarg, extra_uref);
bdc712b4c2baf9 David S. Miller 2011-05-06 1762 cork->length -= length;
3bd653c8455bc7 Denis V. Lunev 2008-10-08 1763 IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
1f4c6eb2402968 Eric Dumazet 2018-03-31 1764 refcount_add(wmem_alloc_delta, &sk->sk_wmem_alloc);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1765 return err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1766 }
0bbe84a67b0b54 Vlad Yasevich 2015-01-31 1767
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29663 bytes --]
next reply other threads:[~2021-04-29 23:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 23:17 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-04-29 17:02 [RFC PATCH] fix xfrm MTU regression Jiri Bohac
2021-04-29 19:48 ` Sabrina Dubroca
2021-04-29 20:25 ` Jiri Bohac
2021-05-01 10:23 ` Sabrina Dubroca
2021-04-29 20:37 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202104300738.YRjWCNmt-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.