TARPIT: fix memory leak when tarpit_generic() fails

Currently tarpit_generic() just returns on failure, but this does not
free nskb.

Signed-off-by: Josh Hunt <johunt@akamai.com>
This commit is contained in:
Josh Hunt
2012-08-02 00:07:42 +02:00
committed by Jan Engelhardt
parent 37e3a543a9
commit 4ff5a8fbf6
2 changed files with 3 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ HEAD
==== ====
Fixes: Fixes:
- length2, SYSRQ, RAWNAT: preinitialize values for ipv6_find_hdr - length2, SYSRQ, RAWNAT: preinitialize values for ipv6_find_hdr
- TARPIT: fix memory leak when tarpit_generic() fails
v1.45 (2012-07-16) v1.45 (2012-07-16)

View File

@@ -237,7 +237,7 @@ static void tarpit_tcp4(struct sk_buff *oldskb, unsigned int hook,
((u_int8_t *)tcph)[13] = 0; ((u_int8_t *)tcph)[13] = 0;
if (!tarpit_generic(tcph, oth, payload, mode)) if (!tarpit_generic(tcph, oth, payload, mode))
return; goto free_nskb;
/* Adjust TCP checksum */ /* Adjust TCP checksum */
tcph->check = 0; tcph->check = 0;
@@ -398,7 +398,7 @@ static void tarpit_tcp6(struct sk_buff *oldskb, unsigned int hook,
payload = nskb->len - sizeof(struct ipv6hdr) - sizeof(struct tcphdr); payload = nskb->len - sizeof(struct ipv6hdr) - sizeof(struct tcphdr);
if (!tarpit_generic(&oth, tcph, payload, mode)) if (!tarpit_generic(&oth, tcph, payload, mode))
return; goto free_nskb;
ip6h->payload_len = htons(sizeof(struct tcphdr)); ip6h->payload_len = htons(sizeof(struct tcphdr));
tcph->check = 0; tcph->check = 0;