From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, John Fastabend <john.fastabend@gmail.com>,
jakub@cloudflare.com, daniel@iogearbox.net,
xiyou.wangcong@gmail.com, alexei.starovoitov@gmail.com
Cc: lkp@intel.com, kbuild-all@lists.01.org, john.fastabend@gmail.com,
bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH bpf 2/3] bpf, sockmap: on cleanup we additionally need to remove cached skb
Date: Wed, 21 Jul 2021 12:38:11 +0300 [thread overview]
Message-ID: <202107201829.npSZIVc5-lkp@intel.com> (raw)
In-Reply-To: <20210719214834.125484-3-john.fastabend@gmail.com>
Hi John,
url: https://github.com/0day-ci/linux/commits/John-Fastabend/sockmap-fixes-picked-up-by-stress-tests/20210720-144138
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master
config: i386-randconfig-m021-20210720 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.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>
smatch warnings:
net/core/skmsg.c:627 sk_psock_backlog() error: uninitialized symbol 'skb'.
net/core/skmsg.c:639 sk_psock_backlog() error: uninitialized symbol 'off'.
net/core/skmsg.c:640 sk_psock_backlog() error: uninitialized symbol 'len'.
vim +/skb +627 net/core/skmsg.c
604326b41a6fb9 Daniel Borkmann 2018-10-13 609 static void sk_psock_backlog(struct work_struct *work)
604326b41a6fb9 Daniel Borkmann 2018-10-13 610 {
604326b41a6fb9 Daniel Borkmann 2018-10-13 611 struct sk_psock *psock = container_of(work, struct sk_psock, work);
604326b41a6fb9 Daniel Borkmann 2018-10-13 612 struct sk_psock_work_state *state = &psock->work_state;
604326b41a6fb9 Daniel Borkmann 2018-10-13 613 struct sk_buff *skb;
604326b41a6fb9 Daniel Borkmann 2018-10-13 614 bool ingress;
604326b41a6fb9 Daniel Borkmann 2018-10-13 615 u32 len, off;
604326b41a6fb9 Daniel Borkmann 2018-10-13 616 int ret;
604326b41a6fb9 Daniel Borkmann 2018-10-13 617
799aa7f98d53e0 Cong Wang 2021-03-30 618 mutex_lock(&psock->work_mutex);
d1f6b1c794e27f John Fastabend 2021-07-19 619 if (unlikely(state->skb)) {
d1f6b1c794e27f John Fastabend 2021-07-19 620 spin_lock_bh(&psock->ingress_lock);
604326b41a6fb9 Daniel Borkmann 2018-10-13 621 skb = state->skb;
604326b41a6fb9 Daniel Borkmann 2018-10-13 622 len = state->len;
604326b41a6fb9 Daniel Borkmann 2018-10-13 623 off = state->off;
604326b41a6fb9 Daniel Borkmann 2018-10-13 624 state->skb = NULL;
d1f6b1c794e27f John Fastabend 2021-07-19 625 spin_unlock_bh(&psock->ingress_lock);
604326b41a6fb9 Daniel Borkmann 2018-10-13 626 }
skb uninitialized on else path.
d1f6b1c794e27f John Fastabend 2021-07-19 @627 if (skb)
d1f6b1c794e27f John Fastabend 2021-07-19 628 goto start;
604326b41a6fb9 Daniel Borkmann 2018-10-13 629
604326b41a6fb9 Daniel Borkmann 2018-10-13 630 while ((skb = skb_dequeue(&psock->ingress_skb))) {
604326b41a6fb9 Daniel Borkmann 2018-10-13 631 len = skb->len;
604326b41a6fb9 Daniel Borkmann 2018-10-13 632 off = 0;
604326b41a6fb9 Daniel Borkmann 2018-10-13 633 start:
e3526bb92a2084 Cong Wang 2021-02-23 634 ingress = skb_bpf_ingress(skb);
e3526bb92a2084 Cong Wang 2021-02-23 635 skb_bpf_redirect_clear(skb);
604326b41a6fb9 Daniel Borkmann 2018-10-13 636 do {
604326b41a6fb9 Daniel Borkmann 2018-10-13 637 ret = -EIO;
799aa7f98d53e0 Cong Wang 2021-03-30 638 if (!sock_flag(psock->sk, SOCK_DEAD))
604326b41a6fb9 Daniel Borkmann 2018-10-13 @639 ret = sk_psock_handle_skb(psock, skb, off,
604326b41a6fb9 Daniel Borkmann 2018-10-13 @640 len, ingress);
604326b41a6fb9 Daniel Borkmann 2018-10-13 641 if (ret <= 0) {
604326b41a6fb9 Daniel Borkmann 2018-10-13 642 if (ret == -EAGAIN) {
d1f6b1c794e27f John Fastabend 2021-07-19 643 sk_psock_skb_state(psock, state, skb,
d1f6b1c794e27f John Fastabend 2021-07-19 644 len, off);
604326b41a6fb9 Daniel Borkmann 2018-10-13 645 goto end;
604326b41a6fb9 Daniel Borkmann 2018-10-13 646 }
604326b41a6fb9 Daniel Borkmann 2018-10-13 647 /* Hard errors break pipe and stop xmit. */
604326b41a6fb9 Daniel Borkmann 2018-10-13 648 sk_psock_report_error(psock, ret ? -ret : EPIPE);
604326b41a6fb9 Daniel Borkmann 2018-10-13 649 sk_psock_clear_state(psock, SK_PSOCK_TX_ENABLED);
781dd0431eb549 Cong Wang 2021-06-14 650 sock_drop(psock->sk, skb);
604326b41a6fb9 Daniel Borkmann 2018-10-13 651 goto end;
604326b41a6fb9 Daniel Borkmann 2018-10-13 652 }
604326b41a6fb9 Daniel Borkmann 2018-10-13 653 off += ret;
604326b41a6fb9 Daniel Borkmann 2018-10-13 654 len -= ret;
604326b41a6fb9 Daniel Borkmann 2018-10-13 655 } while (len);
604326b41a6fb9 Daniel Borkmann 2018-10-13 656
604326b41a6fb9 Daniel Borkmann 2018-10-13 657 if (!ingress)
604326b41a6fb9 Daniel Borkmann 2018-10-13 658 kfree_skb(skb);
604326b41a6fb9 Daniel Borkmann 2018-10-13 659 }
604326b41a6fb9 Daniel Borkmann 2018-10-13 660 end:
799aa7f98d53e0 Cong Wang 2021-03-30 661 mutex_unlock(&psock->work_mutex);
604326b41a6fb9 Daniel Borkmann 2018-10-13 662 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
next prev parent reply other threads:[~2021-07-21 9:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-19 21:48 [PATCH bpf 0/3] sockmap fixes picked up by stress tests John Fastabend
2021-07-19 21:48 ` [PATCH bpf 1/3] bpf, sockmap: zap ingress queues after stopping strparser John Fastabend
2021-07-20 10:27 ` Jakub Sitnicki
2021-07-20 17:41 ` John Fastabend
2021-07-19 21:48 ` [PATCH bpf 2/3] bpf, sockmap: on cleanup we additionally need to remove cached skb John Fastabend
2021-07-21 9:38 ` Dan Carpenter [this message]
2021-07-21 10:13 ` Jakub Sitnicki
2021-07-19 21:48 ` [PATCH bpf 3/3] bpf, sockmap: fix memleak on ingress msg enqueue John Fastabend
2021-07-21 16:36 ` Jakub Sitnicki
2021-07-21 18:02 ` Martin KaFai Lau
2021-07-21 16:38 ` [PATCH bpf 0/3] sockmap fixes picked up by stress tests Jakub Sitnicki
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=202107201829.npSZIVc5-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jakub@cloudflare.com \
--cc=john.fastabend@gmail.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=lkp@intel.com \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).