Skip to content

Commit

Permalink
Staging: batman-adv: fix crash when new OGM is generated
Browse files Browse the repository at this point in the history
If aggregation is not enabled the local translation table can grow
much bigger and expects to fill a full ethernet packet.

Reported-by: Sam Yeung <sam.cwyeung@gmail.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Marek Lindner authored and Greg Kroah-Hartman committed Oct 19, 2010
1 parent 24fb009 commit 15f0068
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/staging/batman-adv/aggregation.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,14 @@ static void new_aggregated_packet(unsigned char *packet_buff, int packet_len,
return;
}

forw_packet_aggr->skb = dev_alloc_skb(MAX_AGGREGATION_BYTES +
sizeof(struct ethhdr));
if ((atomic_read(&bat_priv->aggregation_enabled)) &&
(packet_len < MAX_AGGREGATION_BYTES))
forw_packet_aggr->skb = dev_alloc_skb(MAX_AGGREGATION_BYTES +
sizeof(struct ethhdr));
else
forw_packet_aggr->skb = dev_alloc_skb(packet_len +
sizeof(struct ethhdr));

if (!forw_packet_aggr->skb) {
if (!own_packet)
atomic_inc(&bat_priv->batman_queue_left);
Expand Down

0 comments on commit 15f0068

Please sign in to comment.