Commit 4cf7e032 authored by Thierry Escande's avatar Thierry Escande Committed by Samuel Ortiz

NFC: rawsock: Fix a memory leak

In the rawsock data exchange callback, the sk_buff is not freed
on error.
Signed-off-by: default avatarThierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent e44666b9
...@@ -142,11 +142,11 @@ static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb, ...@@ -142,11 +142,11 @@ static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb,
err = rawsock_add_header(skb); err = rawsock_add_header(skb);
if (err) if (err)
goto error; goto error_skb;
err = sock_queue_rcv_skb(sk, skb); err = sock_queue_rcv_skb(sk, skb);
if (err) if (err)
goto error; goto error_skb;
spin_lock_bh(&sk->sk_write_queue.lock); spin_lock_bh(&sk->sk_write_queue.lock);
if (!skb_queue_empty(&sk->sk_write_queue)) if (!skb_queue_empty(&sk->sk_write_queue))
...@@ -158,6 +158,9 @@ static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb, ...@@ -158,6 +158,9 @@ static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb,
sock_put(sk); sock_put(sk);
return; return;
error_skb:
kfree_skb(skb);
error: error:
rawsock_report_error(sk, err); rawsock_report_error(sk, err);
sock_put(sk); sock_put(sk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment