public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: "zdi-disclosures@trendmicro.com" <zdi-disclosures@trendmicro.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"valentina.manea.m@gmail.com" <valentina.manea.m@gmail.com>,
	"shuah@kernel.org" <shuah@kernel.org>,
	"i@zenithal.me" <i@zenithal.me>
Subject: Re: ZDI-CAN-22273: New Vulnerability Report
Date: Mon, 19 Feb 2024 13:24:07 +0100	[thread overview]
Message-ID: <b0a28cf4-93f4-47a6-b9fe-af82eacfd970@suse.com> (raw)
In-Reply-To: <DM5PR0102MB3477B499A8A3292D6BFFBE80804C2@DM5PR0102MB3477.prod.exchangelabs.com>

[-- Attachment #1: Type: text/plain, Size: 144 bytes --]



On 16.02.24 18:58, zdi-disclosures@trendmicro.com wrote:
> Hi Greg,
> Thanks for the update :)

Hi,

does this do the job?

	Regards
		Oliver

[-- Attachment #2: 0001-usbip-get-new-count-before-dropping-the-old.patch --]
[-- Type: text/x-patch, Size: 1168 bytes --]

From f7ed821da13fae6c80d65f9c0dba4c926970535e Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@suse.com>
Date: Mon, 19 Feb 2024 13:21:44 +0100
Subject: [PATCH] usbip: get new count before dropping the old

Those devices can be identical. In that case dropping
the old reference first leads to a use after free.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/usb/usbip/vhci_hcd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index 82650c11e451..76f629031005 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -757,12 +757,13 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
 
 		switch (ctrlreq->bRequest) {
 		case USB_REQ_SET_ADDRESS:
+			struct usb_device *ud = vdev->udev;
 			/* set_address may come when a device is reset */
 			dev_info(dev, "SetAddress Request (%d) to port %d\n",
 				 ctrlreq->wValue, vdev->rhport);
 
-			usb_put_dev(vdev->udev);
 			vdev->udev = usb_get_dev(urb->dev);
+			usb_put_dev(ud);
 
 			spin_lock(&vdev->ud.lock);
 			vdev->ud.status = VDEV_ST_USED;
-- 
2.43.0


      reply	other threads:[~2024-02-19 12:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 15:25 ZDI-CAN-22273: New Vulnerability Report zdi-disclosures
2023-10-21 10:10 ` gregkh
2024-02-16 17:27   ` zdi-disclosures
2024-02-16 17:37     ` gregkh
2024-02-16 17:58       ` zdi-disclosures
2024-02-19 12:24         ` Oliver Neukum [this message]

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=b0a28cf4-93f4-47a6-b9fe-af82eacfd970@suse.com \
    --to=oneukum@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=i@zenithal.me \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    --cc=zdi-disclosures@trendmicro.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