mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
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.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
cbcc5072c2
2 changed files with 13 additions and 4 deletions
|
@ -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)
|
||||||
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,
|
||||||
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,
|
||||||
|
|
Loading…
Add table
Reference in a new issue