]> git.karo-electronics.de Git - linux-beck.git/commitdiff
NFC: rawsock: Fix a memory leak
authorThierry Escande <thierry.escande@linux.intel.com>
Wed, 10 Jul 2013 08:55:37 +0000 (10:55 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 25 Sep 2013 00:02:40 +0000 (02:02 +0200)
In the rawsock data exchange callback, the sk_buff is not freed
on error.

Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
net/nfc/rawsock.c

index 313bf1bc848a8c45b755e838fc9cd595e1a833c2..cd958b381f9615911b1acfc6da6aceb39d373401 100644 (file)
@@ -142,11 +142,11 @@ static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb,
 
        err = rawsock_add_header(skb);
        if (err)
-               goto error;
+               goto error_skb;
 
        err = sock_queue_rcv_skb(sk, skb);
        if (err)
-               goto error;
+               goto error_skb;
 
        spin_lock_bh(&sk->sk_write_queue.lock);
        if (!skb_queue_empty(&sk->sk_write_queue))
@@ -158,6 +158,9 @@ static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb,
        sock_put(sk);
        return;
 
+error_skb:
+       kfree_skb(skb);
+
 error:
        rawsock_report_error(sk, err);
        sock_put(sk);