Skip to contentSkip to conversation

net: bridge: use vzalloc() instead of vmalloc() as counterstmp is not cleared before it is used in get_counters(). counterstmp might be leaked partially when it is sent to userland later on.

PATCH In review Loganaden Velvindron 2 participants 4 messages Oct 28, 2015

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

PATCH 1/1 net: bridge: use vzalloc() instead of vmalloc() as counterstmp is not cleared before it is used in get_counters(). counterstmp might be leaked partially when it is sent to userland later on.

---
 net/bridge/netfilter/ebtables.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/bridge/netfilter/ebtables.c +2 -2
index f46ca41..26922e9 100644
@@ -989,7 +989,7 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,
 	   the check on the size is done later, when we have the lock */
 	if (repl->num_counters) {
 		unsigned long size = repl->num_counters * sizeof(*counterstmp);
-		counterstmp = vmalloc(size);
+		counterstmp = vzalloc(size);
 		if (!counterstmp)
 			return -ENOMEM;
 	}
@@ -1410,7 +1410,7 @@ static int copy_counters_to_user(struct ebt_table *t,
 		return -EINVAL;
 	}
 
-	counterstmp = vmalloc(nentries * sizeof(*counterstmp));
+	counterstmp = vzalloc(nentries * sizeof(*counterstmp));
 	if (!counterstmp)
 		return -ENOMEM;
 
Signature · 1 line
2.6.1
#1 lore raw

Hello.

Your subject is too long, it should have been placed in the changelog
partially. You you didn't sign off on the patch, so it can't applied.

MBR, Sergei

#2 lore raw
Quoted 6 lines · Sergei Shtylyov

Hello.

Your subject is too long, it should have been placed in the changelog
partially. You you didn't sign off on the patch, so it can't applied.

MBR, Sergei

Thank you. Please reject this patch. I re-sent a proper one in another mail.

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html