mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+f115fcf7e49b2ebc902d@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in sk_skb_reason_drop
Date: Tue, 25 Jun 2024 09:30:40 +0800	[thread overview]
Message-ID: <tencent_76254CBA77BBB533DB9E261BD64BF01BF008@qq.com> (raw)
In-Reply-To: <000000000000387998061ba467ac@google.com>

please test uaf in sk_skb_reason_drop

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 84562f9953ec

diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index efea25eb56ce..6f3e2e6cd2f4 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -106,8 +106,10 @@ void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode,
 		hdev->req_result = result;
 		hdev->req_status = HCI_REQ_DONE;
 		if (skb) {
-			kfree_skb(hdev->req_skb);
+			struct sk_buff	*old_skb;
+			old_skb = hdev->req_skb;
 			hdev->req_skb = skb_get(skb);
+			kfree_skb(old_skb);
 		}
 		wake_up_interruptible(&hdev->req_wait_q);
 	}
@@ -120,6 +122,7 @@ int __hci_req_sync(struct hci_dev *hdev, int (*func)(struct hci_request *req,
 {
 	struct hci_request req;
 	int err = 0;
+	struct sk_buff	*req_skb;
 
 	bt_dev_dbg(hdev, "start");
 
@@ -181,8 +184,9 @@ int __hci_req_sync(struct hci_dev *hdev, int (*func)(struct hci_request *req,
 		break;
 	}
 
-	kfree_skb(hdev->req_skb);
+	req_skb = hdev->req_skb;
 	hdev->req_skb = NULL;
+	kfree_skb(req_skb);
 	hdev->req_status = hdev->req_result = 0;
 
 	bt_dev_dbg(hdev, "end: err %d", err);


  reply	other threads:[~2024-06-25  1:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 15:26 syzbot
2024-06-25  1:30 ` Edward Adam Davis [this message]
2024-06-25  1:54   ` syzbot
2024-06-25 10:40 ` Hillf Danton
2024-06-25 11:58   ` 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=tencent_76254CBA77BBB533DB9E261BD64BF01BF008@qq.com \
    --to=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+f115fcf7e49b2ebc902d@syzkaller.appspotmail.com \
    --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

all inboxes | Powered by JetHome®