]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
NFC: st95hf: Fix memleak in st95hf_in_send_cmd
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Sun, 23 Aug 2020 07:23:43 +0000 (15:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Sep 2020 08:46:26 +0000 (10:46 +0200)
[ Upstream commit f97c04c316d8fea16dca449fdfbe101fbdfee6a2 ]

When down_killable() fails, skb_resp should be freed
just like when st95hf_spi_send() fails.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nfc/st95hf/core.c

index 01acb6e533655d6b6041cbbde43af8c1364aec60..c4b6e29c071920f9c5411a702b95f5d79b1763de 100644 (file)
@@ -981,7 +981,7 @@ static int st95hf_in_send_cmd(struct nfc_digital_dev *ddev,
        rc = down_killable(&stcontext->exchange_lock);
        if (rc) {
                WARN(1, "Semaphore is not found up in st95hf_in_send_cmd\n");
-               return rc;
+               goto free_skb_resp;
        }
 
        rc = st95hf_spi_send(&stcontext->spicontext, skb->data,