Skip to content

Commit

Permalink
NFC: rawsock: Fix a memory leak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thierry Escande authored and Samuel Ortiz committed Sep 25, 2013
1 parent e44666b commit 4cf7e03
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions net/nfc/rawsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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);
Expand Down

0 comments on commit 4cf7e03

Please sign in to comment.