From: "Igor A. Artemiev" <Igor.A.Artemiev@mcst.ru>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jozsef Kadlecsik <kadlec@netfilter.org>,
Florian Westphal <fw@strlen.de>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: Re: [lvc-project] [PATCH] netfilter: nfnetlink: NULL-check skb->dev in __build_packet_message()
Date: Mon, 27 Mar 2023 18:09:50 +0300 [thread overview]
Message-ID: <a5b24f66-4169-4204-034d-872340b4c141@mcst.ru> (raw)
In-Reply-To: <ZCFuaDrSdsyzRdgJ@salvia>
On 3/27/23 13:22, Pablo Neira Ayuso wrote:
> On Mon, Mar 27, 2023 at 12:41:16PM +0300, Igor Artemiev wrote:
>> After having been compared to NULL value at nfnetlink_log.c:560,
>> pointer 'skb->dev' is dereferenced at nfnetlink_log.c:576.
>>
>> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>>
>> Signed-off-by: Igor Artemiev <Igor.A.Artemiev@mcst.ru>
>> ---
>> net/netfilter/nfnetlink_log.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
>> index d97eb280cb2e..2711509eb9a5 100644
>> --- a/net/netfilter/nfnetlink_log.c
>> +++ b/net/netfilter/nfnetlink_log.c
>> @@ -572,7 +572,7 @@ __build_packet_message(struct nfnl_log_net *log,
>> }
>> }
>>
>> - if (indev && skb_mac_header_was_set(skb)) {
>> + if (indev && skb->dev && skb_mac_header_was_set(skb)) {
> This cannot ever happen, we assume skb->dev is always set on.
>
>> if (nla_put_be16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type)) ||
>> nla_put_be16(inst->skb, NFULA_HWLEN,
>> htons(skb->dev->hard_header_len)))
>> --
>> 2.30.2
>>
If skb->dev is always set on, should the check at nfnetlink_log.c:560 be removed?
|
if (indev && skb->dev &&
skb_mac_header_was_set(skb) &&
skb_mac_header_len(skb) != 0) { |
||Thanks, Igor
prev parent reply other threads:[~2023-03-27 15:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-27 9:41 [lvc-project] [PATCH] netfilter: nfnetlink: NULL-check skb->dev in __build_packet_message() Igor Artemiev
2023-03-27 10:22 ` Pablo Neira Ayuso
2023-03-27 15:09 ` Igor A. Artemiev [this message]
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=a5b24f66-4169-4204-034d-872340b4c141@mcst.ru \
--to=igor.a.artemiev@mcst.ru \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox