diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2014-09-13 04:28:44 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-09-23 20:02:23 -0400 |
commit | ecc6522b0804d8102d57a9eac36448bda416ce8c (patch) | |
tree | 24e93b3db2448137cc2bc4a98306ddcfddb11122 /drivers/nfc/st21nfca | |
parent | cc3faac9d88faebe59556f3754ad306117e53b72 (diff) |
NFC: st21nfca: Fix potential skb leaks in NFC-DEP code
After a unsuccessful call to nfc_hci_send_event the skb was not
freed and might lead to memory leak.
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/st21nfca')
-rw-r--r-- | drivers/nfc/st21nfca/st21nfca_dep.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/nfc/st21nfca/st21nfca_dep.c b/drivers/nfc/st21nfca/st21nfca_dep.c index 03dacc6550bc..bf3132ba743c 100644 --- a/drivers/nfc/st21nfca/st21nfca_dep.c +++ b/drivers/nfc/st21nfca/st21nfca_dep.c | |||
@@ -185,8 +185,10 @@ static int st21nfca_tm_send_atr_res(struct nfc_hci_dev *hdev, | |||
185 | 185 | ||
186 | info->dep_info.curr_nfc_dep_pni = 0; | 186 | info->dep_info.curr_nfc_dep_pni = 0; |
187 | 187 | ||
188 | return nfc_hci_send_event(hdev, ST21NFCA_RF_CARD_F_GATE, | 188 | r = nfc_hci_send_event(hdev, ST21NFCA_RF_CARD_F_GATE, |
189 | ST21NFCA_EVT_SEND_DATA, skb->data, skb->len); | 189 | ST21NFCA_EVT_SEND_DATA, skb->data, skb->len); |
190 | kfree_skb(skb); | ||
191 | return r; | ||
190 | } | 192 | } |
191 | 193 | ||
192 | static int st21nfca_tm_recv_atr_req(struct nfc_hci_dev *hdev, | 194 | static int st21nfca_tm_recv_atr_req(struct nfc_hci_dev *hdev, |
@@ -254,6 +256,8 @@ static int st21nfca_tm_send_psl_res(struct nfc_hci_dev *hdev, | |||
254 | 256 | ||
255 | r = nfc_hci_send_event(hdev, ST21NFCA_RF_CARD_F_GATE, | 257 | r = nfc_hci_send_event(hdev, ST21NFCA_RF_CARD_F_GATE, |
256 | ST21NFCA_EVT_SEND_DATA, skb->data, skb->len); | 258 | ST21NFCA_EVT_SEND_DATA, skb->data, skb->len); |
259 | if (r < 0) | ||
260 | goto error; | ||
257 | 261 | ||
258 | /* | 262 | /* |
259 | * ST21NFCA only support P2P passive. | 263 | * ST21NFCA only support P2P passive. |
@@ -269,8 +273,11 @@ static int st21nfca_tm_send_psl_res(struct nfc_hci_dev *hdev, | |||
269 | } | 273 | } |
270 | 274 | ||
271 | /* Send an event to change bitrate change event to card f */ | 275 | /* Send an event to change bitrate change event to card f */ |
272 | return nfc_hci_send_event(hdev, ST21NFCA_RF_CARD_F_GATE, | 276 | r = nfc_hci_send_event(hdev, ST21NFCA_RF_CARD_F_GATE, |
273 | ST21NFCA_EVT_CARD_F_BITRATE, bitrate, 2); | 277 | ST21NFCA_EVT_CARD_F_BITRATE, bitrate, 2); |
278 | error: | ||
279 | kfree_skb(skb); | ||
280 | return r; | ||
274 | } | 281 | } |
275 | 282 | ||
276 | static int st21nfca_tm_recv_psl_req(struct nfc_hci_dev *hdev, | 283 | static int st21nfca_tm_recv_psl_req(struct nfc_hci_dev *hdev, |