[PATCH] netfilter: nfnetlink_log: Fix potential problem if skb->dev is null

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux