Re: [net-next] tcp: don't free a FIN sk_buff in tcp_remove_empty_skb()
From: kernel test robot
Date: Sun Oct 24 2021 - 13:19:37 EST
Hi Jon,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/0day-ci/linux/commits/Jon-Maxwell/tcp-don-t-free-a-FIN-sk_buff-in-tcp_remove_empty_skb/20211021-072644
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 2641b62d2fab52648e34cdc6994b2eacde2d27c1
config: i386-randconfig-s002-20211021 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/0day-ci/linux/commit/87f5ea309107de5183ec0bd7d0b48ec90546d350
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jon-Maxwell/tcp-don-t-free-a-FIN-sk_buff-in-tcp_remove_empty_skb/20211021-072644
git checkout 87f5ea309107de5183ec0bd7d0b48ec90546d350
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> net/ipv4/tcp.c:941:61: sparse: sparse: dubious: !x & y
vim +941 net/ipv4/tcp.c
0c54b85f282812 Ilpo Järvinen 2009-03-14 932
fdfc5c8594c24c Eric Dumazet 2019-08-26 933 /* In some cases, both sendpage() and sendmsg() could have added
fdfc5c8594c24c Eric Dumazet 2019-08-26 934 * an skb to the write queue, but failed adding payload on it.
fdfc5c8594c24c Eric Dumazet 2019-08-26 935 * We need to remove it to consume less memory, but more
fdfc5c8594c24c Eric Dumazet 2019-08-26 936 * importantly be able to generate EPOLLOUT for Edge Trigger epoll()
fdfc5c8594c24c Eric Dumazet 2019-08-26 937 * users.
fdfc5c8594c24c Eric Dumazet 2019-08-26 938 */
b796d04bd014fd Paolo Abeni 2020-11-16 939 void tcp_remove_empty_skb(struct sock *sk, struct sk_buff *skb)
fdfc5c8594c24c Eric Dumazet 2019-08-26 940 {
87f5ea309107de Jon Maxwell 2021-10-21 @941 if (skb && !skb->len && !TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN) {
fdfc5c8594c24c Eric Dumazet 2019-08-26 942 tcp_unlink_write_queue(skb, sk);
fdfc5c8594c24c Eric Dumazet 2019-08-26 943 if (tcp_write_queue_empty(sk))
fdfc5c8594c24c Eric Dumazet 2019-08-26 944 tcp_chrono_stop(sk, TCP_CHRONO_BUSY);
fdfc5c8594c24c Eric Dumazet 2019-08-26 945 sk_wmem_free_skb(sk, skb);
fdfc5c8594c24c Eric Dumazet 2019-08-26 946 }
fdfc5c8594c24c Eric Dumazet 2019-08-26 947 }
fdfc5c8594c24c Eric Dumazet 2019-08-26 948
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxxAttachment:
.config.gz
Description: application/gzip