Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux-2.6-block.git] / net / tipc / link.c
index 6f4a6d9b014989f29ff378d3e84cb60fd809aabe..e31d92f805728da939ea5ac7ef06867b42f6df6b 100644 (file)
@@ -903,8 +903,10 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list,
                if (unlikely(l->backlog[i].len >= l->backlog[i].limit))
                        return link_schedule_user(l, list);
        }
-       if (unlikely(msg_size(hdr) > mtu))
+       if (unlikely(msg_size(hdr) > mtu)) {
+               skb_queue_purge(list);
                return -EMSGSIZE;
+       }
 
        /* Prepare each packet for sending, and add to relevant queue: */
        while (skb_queue_len(list)) {
@@ -916,8 +918,10 @@ int tipc_link_xmit(struct tipc_link *l, struct sk_buff_head *list,
 
                if (likely(skb_queue_len(transmq) < maxwin)) {
                        _skb = skb_clone(skb, GFP_ATOMIC);
-                       if (!_skb)
+                       if (!_skb) {
+                               skb_queue_purge(list);
                                return -ENOBUFS;
+                       }
                        __skb_dequeue(list);
                        __skb_queue_tail(transmq, skb);
                        __skb_queue_tail(xmitq, _skb);
@@ -1958,8 +1962,10 @@ int tipc_nl_add_bc_link(struct net *net, struct tipc_nl_msg *msg)
 
        hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family,
                          NLM_F_MULTI, TIPC_NL_LINK_GET);
-       if (!hdr)
+       if (!hdr) {
+               tipc_bcast_unlock(net);
                return -EMSGSIZE;
+       }
 
        attrs = nla_nest_start(msg->skb, TIPC_NLA_LINK);
        if (!attrs)