Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd5f5006 authored by Takashi Iwai's avatar Takashi Iwai Committed by Greg Kroah-Hartman
Browse files

usbcore: Fix wrong device in an error message in hub_port_connect()



The commit [5ee0f803: usbcore: don't log on consecutive debounce
failures of the same port] added the check of the reliable port, but
it also replaced the device argument to dev_err() wrongly, which leads
to a NULL dereference.

This patch restores the right device, port_dev->dev.  Also, since
dev_err() itself shows the port number, reduce the port number shown
in the error message, essentially reverting to the state before the
commit 5ee0f803.

[The fix suggested by Hannes, and the error message cleanup suggested
 by Alan Stern]

Fixes: 5ee0f803 ('usbcore: don't log on consecutive debounce failures of the same port')
Reported-by: default avatarHannes Reinecke <hare@suse.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7d1311b9
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -4631,9 +4631,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
			if (status != -ENODEV &&
			if (status != -ENODEV &&
				port1 != unreliable_port &&
				port1 != unreliable_port &&
				printk_ratelimit())
				printk_ratelimit())
				dev_err(&udev->dev, "connect-debounce failed, port %d disabled\n",
				dev_err(&port_dev->dev, "connect-debounce failed\n");
					port1);

			portstatus &= ~USB_PORT_STAT_CONNECTION;
			portstatus &= ~USB_PORT_STAT_CONNECTION;
			unreliable_port = port1;
			unreliable_port = port1;
		} else {
		} else {