summaryrefslogtreecommitdiffstats
path: root/drivers/staging/batman-adv
diff options
context:
space:
mode:
authorMarek Lindner <lindner_marek@yahoo.de>2010-10-19 11:59:14 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-10-19 10:04:16 -0700
commit15f00687e3b7b88c23d498d2c65e5911d8efa214 (patch)
tree9a8db7e7ca7bf53c4f759648213464caf850b0fc /drivers/staging/batman-adv
parent24fb009bae18f2ef712800ee9b2f52c177d9d3f9 (diff)
downloadblackbird-obmc-linux-15f00687e3b7b88c23d498d2c65e5911d8efa214.tar.gz
blackbird-obmc-linux-15f00687e3b7b88c23d498d2c65e5911d8efa214.zip
Staging: batman-adv: fix crash when new OGM is generated
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>
Diffstat (limited to 'drivers/staging/batman-adv')
-rw-r--r--drivers/staging/batman-adv/aggregation.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/staging/batman-adv/aggregation.c b/drivers/staging/batman-adv/aggregation.c
index 46b9c2b89ddb..16b268ea7aef 100644
--- a/drivers/staging/batman-adv/aggregation.c
+++ b/drivers/staging/batman-adv/aggregation.c
@@ -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);
OpenPOWER on IntegriCloud