Netfilter: SNMP NAT helper: fix memleak snmp_object_decode
Subsystems (2)
PATCH 1/1 Netfilter: SNMP NAT helper: fix memleak snmp_object_decode
If kmalloc fails, error path leaks data allocated from asn1_oid_decode().
Signed-off-by Chris Wright <[email protected]>
---
net/ipv4/netfilter/ip_nat_snmp_basic.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/netfilter/ip_nat_snmp_basic.c +1 -0
@@ -768,6 +768,7 @@ static unsigned char snmp_object_decode( len *=sizeof (unsigned long ); *obj =kmalloc (sizeof (struct snmp_object ) + len,GFP_ATOMIC );if (*obj ==NULL ) { +kfree (lp);kfree (id);if (net_ratelimit ())printk ("OOM in bsalg (%d)\n" , __LINE__);
Quoted 1 line · Chris Wright
If kmalloc fails, error path leaks data allocated from
asn1_oid_decode().
Thanks Chris, applied. "len" can't exceed the real packets length, so I don't think this can really be triggered remotely. Feel free to add to -stable though.