Commit cbcc5072 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'fix-two-possible-memory-leak-problems-in-nfc-digital-module'

Ziyang Xuan says:

====================
Fix two possible memory leak problems in NFC digital module.
====================

Link: https://lore.kernel.org/r/cover.1634111083.git.william.xuanziyang@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 0911ab31 291c932f
...@@ -277,6 +277,7 @@ int digital_tg_configure_hw(struct nfc_digital_dev *ddev, int type, int param) ...@@ -277,6 +277,7 @@ int digital_tg_configure_hw(struct nfc_digital_dev *ddev, int type, int param)
static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech)
{ {
struct digital_tg_mdaa_params *params; struct digital_tg_mdaa_params *params;
int rc;
params = kzalloc(sizeof(*params), GFP_KERNEL); params = kzalloc(sizeof(*params), GFP_KERNEL);
if (!params) if (!params)
...@@ -291,8 +292,12 @@ static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) ...@@ -291,8 +292,12 @@ static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech)
get_random_bytes(params->nfcid2 + 2, NFC_NFCID2_MAXSIZE - 2); get_random_bytes(params->nfcid2 + 2, NFC_NFCID2_MAXSIZE - 2);
params->sc = DIGITAL_SENSF_FELICA_SC; params->sc = DIGITAL_SENSF_FELICA_SC;
return digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MDAA, NULL, params, rc = digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MDAA, NULL, params,
500, digital_tg_recv_atr_req, NULL); 500, digital_tg_recv_atr_req, NULL);
if (rc)
kfree(params);
return rc;
} }
static int digital_tg_listen_md(struct nfc_digital_dev *ddev, u8 rf_tech) static int digital_tg_listen_md(struct nfc_digital_dev *ddev, u8 rf_tech)
......
...@@ -465,8 +465,12 @@ static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev, ...@@ -465,8 +465,12 @@ static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev,
skb_put_u8(skb, sel_cmd); skb_put_u8(skb, sel_cmd);
skb_put_u8(skb, DIGITAL_SDD_REQ_SEL_PAR); skb_put_u8(skb, DIGITAL_SDD_REQ_SEL_PAR);
return digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res, rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res,
target); target);
if (rc)
kfree_skb(skb);
return rc;
} }
static void digital_in_recv_sens_res(struct nfc_digital_dev *ddev, void *arg, static void digital_in_recv_sens_res(struct nfc_digital_dev *ddev, void *arg,
......
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