public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+6eb09d75211863f15e3e@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] Private message regarding: [syzbot] [nfc?] memory leak in skb_copy (2)
Date: Mon, 20 Nov 2023 01:20:33 -0800	[thread overview]
Message-ID: <0000000000007eb04f060a91ffad@google.com> (raw)
In-Reply-To: <00000000000075472b06007df4fb@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: Private message regarding: [syzbot] [nfc?] memory leak in skb_copy (2)
Author: phind.uet@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
 master
diff --git a/drivers/nfc/virtual_ncidev.c b/drivers/nfc/virtual_ncidev.c
index b027be0b0b6f..ac8226db54e2 100644
--- a/drivers/nfc/virtual_ncidev.c
+++ b/drivers/nfc/virtual_ncidev.c
@@ -20,26 +20,31 @@
                                 NFC_PROTO_ISO14443_MASK | \
                                 NFC_PROTO_ISO14443_B_MASK | \
                                 NFC_PROTO_ISO15693_MASK)
+#define NCIDEV_RUNNING 0

 struct virtual_nci_dev {
        struct nci_dev *ndev;
        struct mutex mtx;
        struct sk_buff *send_buff;
        struct wait_queue_head wq;
+       bool running;
 };

 static int virtual_nci_open(struct nci_dev *ndev)
 {
+       struct virtual_nci_dev *vdev = nci_get_drvdata(ndev);
+
+       vdev->running = true;
        return 0;
 }

 static int virtual_nci_close(struct nci_dev *ndev)
 {
        struct virtual_nci_dev *vdev = nci_get_drvdata(ndev);
-
        mutex_lock(&vdev->mtx);
        kfree_skb(vdev->send_buff);
        vdev->send_buff = NULL;
+       vdev->running = false;
        mutex_unlock(&vdev->mtx);

        return 0;
@@ -50,7 +55,7 @@ static int virtual_nci_send(struct nci_dev *ndev, struct 
sk_buff *skb)
        struct virtual_nci_dev *vdev = nci_get_drvdata(ndev);

        mutex_lock(&vdev->mtx);
-       if (vdev->send_buff) {
+       if (vdev->send_buff || !vdev->running) {
                mutex_unlock(&vdev->mtx);
                kfree_skb(skb);
                return -1;

  reply	other threads:[~2023-11-20  9:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-15  3:13 [syzbot] [nfc?] memory leak in skb_copy (2) syzbot
2023-11-20  9:20 ` syzbot [this message]
2023-11-20  9:33 ` [syzbot] " syzbot
2023-11-20  9:39 ` syzbot
2023-11-21  7:16 ` [syzbot] Re: [syzbot] [nfc?] memory leak in skb_copy (2)(test updated patch) syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0000000000007eb04f060a91ffad@google.com \
    --to=syzbot+6eb09d75211863f15e3e@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox