Skip to contentSkip to conversation

netfilter: nf_nat: Fix possible null dereference

PATCH New [email protected] 1 participant 1 message Jun 29, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: nf_nat: Fix possible null dereference

Fix an issue where __nf_ct_ext_find() could return null to nat in nf_nat_masquerade_ipv4() and could be dereferenced.

This was detected by static analysis software.

---
 net/ipv4/netfilter/nf_nat_masquerade_ipv4.c | 2 ++
 1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
index c6eb421..4be5d70 100644

net/ipv4/netfilter/nf_nat_masquerade_ipv4.c +0 -0
@@ -38,6 +38,8 @@ nf_nat_masquerade_ipv4(struct sk_buff *skb, unsigned int

hooknum,

ct = nf_ct_get(skb, &ctinfo);
nat = nfct_nat(ct);
+ if (!nat)
+ return NF_DROP;

NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED ||
ctinfo == IP_CT_RELATED_REPLY));
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project