netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Leblond <eric@inl.fr>
To: Dan Carpenter <error27@gmail.com>
Cc: netfilter-devel@vger.kernel.org, Eric Leblond <eric@inl.fr>
Subject: [PATCH] netfilter: nfnetlink_log: Fix potential problem if skb->dev is null
Date: Thu, 22 Jul 2010 14:09:33 +0200	[thread overview]
Message-ID: <1279800573-10679-1-git-send-email-eric@inl.fr> (raw)
In-Reply-To: <20100722115053.GF17585@bicker>

This patch fixes a potentiel problem pointed out by Dan Carpenter
using smatch: skb->dev is used but there is no test on nullity
of pointer. It may not express as if mac header is filled we can
think that the dev is also set.
---
 net/netfilter/nfnetlink_log.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 6a1572b..b5617c2 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -468,7 +468,7 @@ __build_packet_message(struct nfulnl_instance *inst,
 		}
 	}
 
-	if (indev && skb_mac_header_was_set(skb)) {
+	if (indev && skb->dev && skb_mac_header_was_set(skb)) {
 		NLA_PUT_BE16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type));
 		NLA_PUT_BE16(inst->skb, NFULA_HWLEN,
 			     htons(skb->dev->hard_header_len));
-- 
1.6.1


      reply	other threads:[~2010-07-22 12:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22 11:50 netfilter: nfnetlink_log: send complete hardware header Dan Carpenter
2010-07-22 12:09 ` Eric Leblond [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=1279800573-10679-1-git-send-email-eric@inl.fr \
    --to=eric@inl.fr \
    --cc=error27@gmail.com \
    --cc=netfilter-devel@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 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).