diff --git a/drivers/staging/batman-adv/routing.c b/drivers/staging/batman-adv/routing.c index e12fd995417c5e43f32eba8a6af2b7ed24fd30d3..2cf8cf98a299f76ec91ae8657d86bf15b366ded6 100644 --- a/drivers/staging/batman-adv/routing.c +++ b/drivers/staging/batman-adv/routing.c @@ -1232,8 +1232,12 @@ int recv_ucast_frag_packet(struct sk_buff *skb, struct batman_if *recv_if) orig_node->last_frag_packet = jiffies; - if (list_empty(&orig_node->frag_list)) - create_frag_buffer(&orig_node->frag_list); + if (list_empty(&orig_node->frag_list) && + create_frag_buffer(&orig_node->frag_list)) { + spin_unlock_irqrestore(&bat_priv->orig_hash_lock, + flags); + return NET_RX_DROP; + } tmp_frag_entry = search_frag_packet(&orig_node->frag_list, diff --git a/drivers/staging/batman-adv/unicast.c b/drivers/staging/batman-adv/unicast.c index f951abc1afe6badceeab74dc0aab711fd95eea22..0dac50d69c03c13b0dec25f95c93dae2f93ddd45 100644 --- a/drivers/staging/batman-adv/unicast.c +++ b/drivers/staging/batman-adv/unicast.c @@ -78,7 +78,7 @@ void create_frag_entry(struct list_head *head, struct sk_buff *skb) return; } -void create_frag_buffer(struct list_head *head) +int create_frag_buffer(struct list_head *head) { int i; struct frag_packet_list_entry *tfp; @@ -86,13 +86,17 @@ void create_frag_buffer(struct list_head *head) for (i = 0; i < FRAG_BUFFER_SIZE; i++) { tfp = kmalloc(sizeof(struct frag_packet_list_entry), GFP_ATOMIC); + if (!tfp) { + frag_list_free(head); + return -ENOMEM; + } tfp->skb = NULL; tfp->seqno = 0; INIT_LIST_HEAD(&tfp->list); list_add(&tfp->list, head); } - return; + return 0; } struct frag_packet_list_entry *search_frag_packet(struct list_head *head, diff --git a/drivers/staging/batman-adv/unicast.h b/drivers/staging/batman-adv/unicast.h index 1d5cbeb6733f47de7c8727176ca4210d61567148..79736977190069fdd4800a672408c3ed2f713644 100644 --- a/drivers/staging/batman-adv/unicast.h +++ b/drivers/staging/batman-adv/unicast.h @@ -30,7 +30,7 @@ struct sk_buff *merge_frag_packet(struct list_head *head, struct sk_buff *skb); void create_frag_entry(struct list_head *head, struct sk_buff *skb); -void create_frag_buffer(struct list_head *head); +int create_frag_buffer(struct list_head *head); struct frag_packet_list_entry *search_frag_packet(struct list_head *head, struct unicast_frag_packet *up); void frag_list_free(struct list_head *head);