From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] bpf: Add helper to retrieve socket in BPF
Date: Thu, 11 Oct 2018 11:54:26 +0000 [thread overview]
Message-ID: <20181011115426.GA21551@mwanda> (raw)
Hello Joe Stringer,
This is a semi-automatic email about new static checker warnings.
The patch 6acc9b432e67: "bpf: Add helper to retrieve socket in BPF"
from Oct 2, 2018, leads to the following Smatch complaint:
net/core/filter.c:4893 bpf_sk_lookup()
error: we previously assumed 'skb->dev' could be null (see line 4885)
net/core/filter.c
4884
4885 if (skb->dev)
^^^^^^^^
The patch adds a check
4886 caller_net = dev_net(skb->dev);
4887 else
4888 caller_net = sock_net(skb->sk);
4889 if (netns_id) {
4890 net = get_net_ns_by_id(caller_net, netns_id);
4891 if (unlikely(!net))
4892 goto out;
4893 sk = sk_lookup(net, tuple, skb, family, proto);
^^^
4894 put_net(net);
4895 } else {
4896 net = caller_net;
4897 sk = sk_lookup(net, tuple, skb, family, proto);
^^^
We dereference skb->dev inside the sk_lookup() function.
4898 }
4899
4900 if (sk)
4901 sk = sk_to_full_sk(sk);
4902 out:
4903 return (unsigned long) sk;
4904 }
regards,
dan carpenter
next reply other threads:[~2018-10-11 11:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-11 11:54 Dan Carpenter [this message]
2018-10-11 17:01 ` [bug report] bpf: Add helper to retrieve socket in BPF Joe Stringer
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=20181011115426.GA21551@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.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.