Skip to contentSkip to conversation

usbip: Fix incorrect double assignment to udc->ud.tcp_rx

PATCH In review Colin King 2 participants 3 messages Mar 11, 2021

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 usbip: Fix incorrect double assignment to udc->ud.tcp_rx

From: Colin Ian King <[email protected]>

Currently udc->ud.tcp_rx is being assigned twice, the second assignment is incorrect, it should be to udc->ud.tcp_tx instead of rx. Fix this.

Addresses-Coverity: ("Unused value")

Fixes 46613c9dfa96 ("usbip: fix vudc usbip_sockfd_store races leading to gpf")
---
 drivers/usb/usbip/vudc_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/usbip/vudc_sysfs.c +1 -1
index a3ec39fc6177..7383a543c6d1 100644
@@ -174,7 +174,7 @@ static ssize_t usbip_sockfd_store(struct device *dev,
 
 		udc->ud.tcp_socket = socket;
 		udc->ud.tcp_rx = tcp_rx;
-		udc->ud.tcp_rx = tcp_tx;
+		udc->ud.tcp_tx = tcp_tx;
 		udc->ud.status = SDEV_ST_USED;
 
 		spin_unlock_irq(&udc->ud.lock);
Signature · 1 line
2.30.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines · Colin King

From: Colin Ian King <[email protected]>

Currently udc->ud.tcp_rx is being assigned twice, the second assignment is incorrect, it should be to udc->ud.tcp_tx instead of rx. Fix this.

Addresses-Coverity: ("Unused value")

Fixes 46613c9dfa96 ("usbip: fix vudc usbip_sockfd_store races leading to gpf")
---
  drivers/usb/usbip/vudc_sysfs.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/usbip/vudc_sysfs.c +0 -0
index a3ec39fc6177..7383a543c6d1 100644

drivers/usb/usbip/vudc_sysfs.c static ssize_t usbip_sockfd_store(struct device *dev, · line 180

Quoted 8 lines
drivers/usb/usbip/vudc_sysfs.c +1 -1
@@ -174,7 +174,7 @@ static ssize_t usbip_sockfd_store(struct device *dev,
 
  		udc->ud.tcp_socket = socket;
  		udc->ud.tcp_rx = tcp_rx;
-		udc->ud.tcp_rx = tcp_tx;
+		udc->ud.tcp_tx = tcp_tx;
  		udc->ud.status = SDEV_ST_USED;
 
  		spin_unlock_irq(&udc->ud.lock);

Thank you for finding and fixing this. This is my bad.

thanks,
-- Shuah

maintainer
#2 lore raw
Quoted 28 lines · Shuah Khan
Quoted 17 lines · Colin King

From: Colin Ian King <[email protected]>

Currently udc->ud.tcp_rx is being assigned twice, the second assignment is incorrect, it should be to udc->ud.tcp_tx instead of rx. Fix this.

Addresses-Coverity: ("Unused value")

Fixes 46613c9dfa96 ("usbip: fix vudc usbip_sockfd_store races leading to gpf")

---
  drivers/usb/usbip/vudc_sysfs.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/usbip/vudc_sysfs.c +0 -0
index a3ec39fc6177..7383a543c6d1 100644

drivers/usb/usbip/vudc_sysfs.c static ssize_t usbip_sockfd_store(struct device *dev, · line 179

Quoted 7 lines
drivers/usb/usbip/vudc_sysfs.c +1 -1
@@ -174,7 +174,7 @@ static ssize_t usbip_sockfd_store(struct device *dev,
           udc->ud.tcp_socket = socket;
           udc->ud.tcp_rx = tcp_rx;
-        udc->ud.tcp_rx = tcp_tx;
+        udc->ud.tcp_tx = tcp_tx;
           udc->ud.status = SDEV_ST_USED;
           spin_unlock_irq(&udc->ud.lock);
 

Thank you for finding and fixing this. This is my bad.

Quoted 2 lines

Applies to stables as well since the 46613c9dfa96 is marked for stables.

thanks,
-- Shuah