diff options
author | Thierry Escande <thierry.escande@linux.intel.com> | 2013-07-10 04:55:37 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-09-24 20:02:40 -0400 |
commit | 4cf7e032960a945f813784a68bf0b982a4035bf9 (patch) | |
tree | 744f67660b82de2eb6dd6dd36719602f3a6b6a5a /net/nfc | |
parent | e44666b98111e64efae974c3e91357d991dba0ca (diff) |
NFC: rawsock: Fix a memory leak
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>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/rawsock.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c index 313bf1bc848a..cd958b381f96 100644 --- a/net/nfc/rawsock.c +++ b/net/nfc/rawsock.c | |||
@@ -142,11 +142,11 @@ static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb, | |||
142 | 142 | ||
143 | err = rawsock_add_header(skb); | 143 | err = rawsock_add_header(skb); |
144 | if (err) | 144 | if (err) |
145 | goto error; | 145 | goto error_skb; |
146 | 146 | ||
147 | err = sock_queue_rcv_skb(sk, skb); | 147 | err = sock_queue_rcv_skb(sk, skb); |
148 | if (err) | 148 | if (err) |
149 | goto error; | 149 | goto error_skb; |
150 | 150 | ||
151 | spin_lock_bh(&sk->sk_write_queue.lock); | 151 | spin_lock_bh(&sk->sk_write_queue.lock); |
152 | if (!skb_queue_empty(&sk->sk_write_queue)) | 152 | 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 | sock_put(sk); | 158 | sock_put(sk); |
159 | return; | 159 | return; |
160 | 160 | ||
161 | error_skb: | ||
162 | kfree_skb(skb); | ||
163 | |||
161 | error: | 164 | error: |
162 | rawsock_report_error(sk, err); | 165 | rawsock_report_error(sk, err); |
163 | sock_put(sk); | 166 | sock_put(sk); |