From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1E9C7261A for ; Sun, 19 Jul 2026 16:39:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784479163; cv=none; b=Xw+c6/Tax5KR3GcNsJvLQw8+lbBCmBknXDCcZ734juB3nJaBqVx/xZMxjBorsMQAQphFVlLm3ySkXK3oljqBiST2UWPWnTSVKDbrVxyHBF9kzIElX5B11Grz3egRl6X4CyfUk8jYf/6diTHbaNuT1bXbYdTFGwoKqlsdGzJBNiA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784479163; c=relaxed/simple; bh=II1U675J9HklzPHQr0aS/W7hOBPgx1YgAuqJCzb6CZo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kTpAx4k1UCUpYNaXgbdOi1QUztRgIA4sjeXDy0GcSJq43K0ubeOEUu1Js2y0Pi7nwrSnkzS6/j5gXsWI0W13vRGEO1DpiW59zVy3VY225Dm4WLJrUm1WdxPUiC9/bnhOsXAQrbqIoXEbUvMBDM9g/RNUUUH8sqMpOyGwzP8oDeA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jh2nAfi3; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jh2nAfi3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 016891F000E9; Sun, 19 Jul 2026 16:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784479161; bh=xLH0pfPm0eg06eglucCTnUz2zwNJKEvNz3zU5lhi7BE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jh2nAfi31wxVI3SReo2nFrdzv8IeysctcM1h/zMqN7QR8io9m3B0k3NtUXBvUdZBW RyUCn333pDrFDHcINjk2S1SO1kiwiIB0Nd6h4M5HkcXC/S07urLbtcge92BoX7eRNL GHpCQJiT5JTPh72aZZlL7e6jRaw9m/iblRqAwKBTbLKnbrZ5XOQ/3140ZNESUPjT48 vgmBhgppiwpp9gzXP/FU4+GQzyqAJ2+XV6KPuT+RZuSFaFAf8hvfCi3ogzQUl9fsJP ExFOwqa7hN5J4xfZbpAwoYQpdG49uCKp//Z+rMW0VABD7Ved5E8HcoHvY7qlqrL9k/ 6KTqoSvrv0D3g== From: Sasha Levin To: stable@vger.kernel.org Cc: Oliver Neukum , Greg Kroah-Hartman , Sasha Levin Subject: [PATCH 5.10.y 1/2] usb: iowarrior: remove inherent race with minor number Date: Sun, 19 Jul 2026 12:39:18 -0400 Message-ID: <20260719163919.650822-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026071456-raider-refocus-2e33@gregkh> References: <2026071456-raider-refocus-2e33@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Oliver Neukum [ Upstream commit 56dd29088c9d9510c48a8ebad2465248fde36551 ] The driver saves the minor number it gets upon registration in its descriptor for debugging purposes. However, there is inevitably a window between registration and saving the correct minor in a descriptor. During this window the debugging output will be wrong. As wrong debug output is worse than no debug output, just remove it. Signed-off-by: Oliver Neukum Link: https://patch.msgid.link/20260312094619.1590556-1-oneukum@suse.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: c602254ba4c1 ("USB: iowarrior: fix use-after-free on disconnect race") Signed-off-by: Sasha Levin --- drivers/usb/misc/iowarrior.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 2a0036d8fc2926..7c217b1f71f293 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -74,7 +74,6 @@ struct iowarrior { struct mutex mutex; /* locks this structure */ struct usb_device *udev; /* save off the usb device pointer */ struct usb_interface *interface; /* the interface for this device */ - unsigned char minor; /* the starting minor number for this device */ struct usb_endpoint_descriptor *int_out_endpoint; /* endpoint for reading (needed for IOW56 only) */ struct usb_endpoint_descriptor *int_in_endpoint; /* endpoint for reading */ struct urb *int_in_urb; /* the urb for reading data */ @@ -246,7 +245,6 @@ static void iowarrior_write_callback(struct urb *urb) */ static inline void iowarrior_delete(struct iowarrior *dev) { - dev_dbg(&dev->interface->dev, "minor %d\n", dev->minor); kfree(dev->int_in_buffer); usb_free_urb(dev->int_in_urb); kfree(dev->read_queue); @@ -297,9 +295,6 @@ static ssize_t iowarrior_read(struct file *file, char __user *buffer, goto exit; } - dev_dbg(&dev->interface->dev, "minor %d, count = %zd\n", - dev->minor, count); - /* read count must be packet size (+ time stamp) */ if ((count != dev->report_size) && (count != (dev->report_size + 1))) { @@ -379,8 +374,6 @@ static ssize_t iowarrior_write(struct file *file, retval = -ENODEV; goto exit; } - dev_dbg(&dev->interface->dev, "minor %d, count = %zd\n", - dev->minor, count); /* if count is 0 we're already done */ if (count == 0) { retval = 0; @@ -526,9 +519,6 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd, goto error_out; } - dev_dbg(&dev->interface->dev, "minor %d, cmd 0x%.4x, arg %ld\n", - dev->minor, cmd, arg); - retval = 0; io_res = 0; switch (cmd) { @@ -675,8 +665,6 @@ static int iowarrior_release(struct inode *inode, struct file *file) if (!dev) return -ENODEV; - dev_dbg(&dev->interface->dev, "minor %d\n", dev->minor); - /* lock our device */ mutex_lock(&dev->mutex); @@ -779,6 +767,7 @@ static int iowarrior_probe(struct usb_interface *interface, struct usb_host_interface *iface_desc; int retval = -ENOMEM; int res; + int minor; /* allocate memory for our device state and initialize it */ dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL); @@ -894,12 +883,12 @@ static int iowarrior_probe(struct usb_interface *interface, goto error; } - dev->minor = interface->minor; + minor = interface->minor; /* let the user know what node this device is now attached to */ dev_info(&interface->dev, "IOWarrior product=0x%x, serial=%s interface=%d " "now attached to iowarrior%d\n", dev->product_id, dev->chip_serial, - iface_desc->desc.bInterfaceNumber, dev->minor - IOWARRIOR_MINOR_BASE); + iface_desc->desc.bInterfaceNumber, minor - IOWARRIOR_MINOR_BASE); return retval; error: -- 2.53.0