[syzbot] [PATCH] Test for aea6bf908d73

From: syzbot
Date: Thu Nov 09 2023 - 07:34:20 EST


For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.

***

Subject: [PATCH] Test for aea6bf908d73
Author: eadavis@xxxxxx

please test uaf in nfc_alloc_send_skb

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git aea6bf908d73

diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 6c9592d05120..b463452c507e 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -30,6 +30,7 @@
#include <net/nfc/nci.h>
#include <net/nfc/nci_core.h>
#include <linux/nfc.h>
+#include "../llcp.h"

struct core_conn_create_data {
int length;
@@ -1206,6 +1207,9 @@ EXPORT_SYMBOL(nci_allocate_device);
*/
void nci_free_device(struct nci_dev *ndev)
{
+ struct nfc_llcp_sock *nls = container_of(ndev->nfc_dev,
+ struct nfc_llcp_sock, dev);
+ nls->local = NULL;
nfc_free_device(ndev->nfc_dev);
nci_hci_deallocate(ndev);
kfree(ndev);