]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
st_nci_hci_connectivity_event_received: null check the allocation
authorNavid Emamdoost <navid.emamdoost@gmail.com>
Tue, 23 Jul 2019 22:11:51 +0000 (17:11 -0500)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 4 Sep 2019 06:16:38 +0000 (02:16 -0400)
BugLink: https://bugs.launchpad.net/bugs/1842114
[ Upstream commit 3008e06fdf0973770370f97d5f1fba3701d8281d ]

devm_kzalloc may fail and return NULL. So the null check is needed.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/nfc/st-nci/se.c

index f55d082ace71558c8bf23d1813d70da18c9c5a0d..5d6e7e931bc6cd06bc162a2672acba679d60d782 100644 (file)
@@ -344,6 +344,8 @@ static int st_nci_hci_connectivity_event_received(struct nci_dev *ndev,
 
                transaction = (struct nfc_evt_transaction *)devm_kzalloc(dev,
                                            skb->len - 2, GFP_KERNEL);
+               if (!transaction)
+                       return -ENOMEM;
 
                transaction->aid_len = skb->data[1];
                memcpy(transaction->aid, &skb->data[2], transaction->aid_len);