Skip to contentSkip to conversation

staging: usbip: stub_dev: Fixed oops during removal of usbip_host

PATCH In review navin patidar 4 participants 6 messages Sep 14, 2012 – Sep 17, 2012 1 message not in the archive Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: usbip: stub_dev: Fixed oops during removal of usbip_host

stub_device_reset should set kernel thread pointers to NULL. so that at the time of usbip_host removal stub_shoutdown_connection doesn't try to kill kernel threads which are already killed.

---
 drivers/staging/usbip/stub_dev.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/staging/usbip/stub_dev.c +9 -5
index 92ced35..f584af8 100644
@@ -192,16 +192,13 @@ static void stub_shutdown_connection(struct usbip_device *ud)
 	if (ud->tcp_tx)
 		kthread_stop_put(ud->tcp_tx);
 
-	/*
-	 * 2. close the socket
+	/* 2. close the socket
 	 *
 	 * tcp_socket is freed after threads are killed so that usbip_xmit does
 	 * not touch NULL socket.
 	 */
-	if (ud->tcp_socket) {
+	if (ud->tcp_socket)
 		sock_release(ud->tcp_socket);
-		ud->tcp_socket = NULL;
-	}
 
 	/* 3. free used data */
 	stub_device_cleanup_urbs(sdev);
@@ -233,6 +230,13 @@ static void stub_device_reset(struct usbip_device *ud)
 
 	dev_dbg(&udev->dev, "device reset");
 
+	/*reset tcp socket*/
+	ud->tcp_socket = NULL;
+
+	/*reset kernel thread pointers */
+	ud->tcp_rx = NULL;
+	ud->tcp_tx = NULL;
+
 	ret = usb_lock_device_for_reset(udev, sdev->interface);
 	if (ret < 0) {
 		dev_err(&udev->dev, "lock for reset\n");
Signature · 12 lines
1.7.9.5


-------------------------------------------------------------------------------------------------------------------------------

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------
#1 lore raw

Hello.

Quoted 14 lines · navin patidar

stub_device_reset should set kernel thread pointers to NULL. so that at the time of usbip_host removal stub_shoutdown_connection doesn't try to kill kernel threads which are already killed.

---
  drivers/staging/usbip/stub_dev.c |   14 +++++++++-----
  1 file changed, 9 insertions(+), 5 deletions(-)
drivers/staging/usbip/stub_dev.c +0 -0
index 92ced35..f584af8 100644

drivers/staging/usbip/stub_dev.c static void stub_shutdown_connection(struct usbip_device *ud) · line 195

Quoted 6 lines
drivers/staging/usbip/stub_dev.c +1 -2
@@ -192,16 +192,13 @@ static void stub_shutdown_connection(struct usbip_device *ud)
  	if (ud->tcp_tx)
  		kthread_stop_put(ud->tcp_tx);
 
-	/*
-	 * 2. close the socket
+	/* 2. close the socket

It's the preferred comment style -- why modify it?

Quoted 13 lines
drivers/staging/usbip/stub_dev.c +1 -3
  	 *
  	 * tcp_socket is freed after threads are killed so that usbip_xmit does
  	 * not touch NULL socket.
  	 */
-	if (ud->tcp_socket) {
+	if (ud->tcp_socket)
  		sock_release(ud->tcp_socket);
-		ud->tcp_socket = NULL;
-	}
 
  	/* 3. free used data */
  	stub_device_cleanup_urbs(sdev);

drivers/staging/usbip/stub_dev.c static void stub_device_reset(struct usbip_device *ud) · line 233

Quoted 4 lines
drivers/staging/usbip/stub_dev.c +1 -0
@@ -233,6 +230,13 @@ static void stub_device_reset(struct usbip_device *ud)
 
  	dev_dbg(&udev->dev, "device reset");
 
+	/*reset tcp socket*/

Add spaces after /* and before */, please.

drivers/staging/usbip/stub_dev.c static void stub_device_reset(struct usbip_device *ud) · line 236

Quoted 3 lines
drivers/staging/usbip/stub_dev.c +3 -0
+	ud->tcp_socket = NULL;
+
+	/*reset kernel thread pointers */

Here too.

WBR, Sergei

#2 lore raw
Quoted 12 lines · Sergei Shtylyov

drivers/staging/usbip/stub_dev.c static void stub_device_reset(struct usbip_device *ud) · line 233

Quoted 9 lines
drivers/staging/usbip/stub_dev.c +1 -0
index 92ced35..f584af8 100644
@@ -233,6 +230,13 @@ static void stub_device_reset(struct usbip_device *ud)
 
 	dev_dbg(&udev->dev, "device reset");
 
+	/*reset tcp socket*/

Add spaces after /* and before */, please.

Quoted 5 lines

drivers/staging/usbip/stub_dev.c static void stub_device_reset(struct usbip_device *ud) · line 236

Quoted 3 lines
drivers/staging/usbip/stub_dev.c +3 -0
+	ud->tcp_socket = NULL;
+
+	/*reset kernel thread pointers */

Here too.

I'm not sure it is required to comment the obvious things.

Quoted 1 line

WBR, Sergei

Sebastian

#3 lore raw

hi,

I have sent this patch again with corrections.
thank for reviewing the patch.

--navin-patidar

Quoted 27 lines · Sebastian Andrzej Siewior
Quoted 14 lines · Sergei Shtylyov

drivers/staging/usbip/stub_dev.c static void stub_device_reset(struct usbip_device · line 234

Quoted 11 lines
drivers/staging/usbip/stub_dev.c +1 -0
index 92ced35..f584af8 100644
@@ -233,6 +230,13 @@ static void stub_device_reset(struct usbip_device
 *ud)
 
 	dev_dbg(&udev->dev, "device reset");
 
+	/*reset tcp socket*/

Add spaces after /* and before */, please.

Quoted 5 lines

drivers/staging/usbip/stub_dev.c static void stub_device_reset(struct usbip_device *ud) · line 236

Quoted 3 lines
drivers/staging/usbip/stub_dev.c +3 -0
+	ud->tcp_socket = NULL;
+
+	/*reset kernel thread pointers */

Here too.

I'm not sure it is required to comment the obvious things.

Quoted 1 line

WBR, Sergei

Sebastian

A message that is not in the archive (sent off-list or not yet received): CAPV97yfV27x8hB2WUCVmGWEU7i21Y5K5trig2fzQBx+VB_Yk2g@mail.gmail.com

#5 lore raw

Hello.

Quoted 3 lines · navin patidar

hi Sergei,
checkpatch.pl <http://checkpatch.pl> didn't complain any thing about patch coding style.

checkpatch.pl only complains about // comments, IIRC. But see
Documentation/CodingStyle chapter 8 about multi-line comments. As for adding spaces, it's more for aesthetic reasons...

Quoted 2 lines

Anyway thanks for reviewing the patch.
i will send this patch again with corrections.

Thanks you.

Quoted 1 line

--navin-patidar

WBR, Sergei

maintainer
#6 lore raw
In reply to navin patidar
Quoted 9 lines · navin patidar

-------------------------------------------------------------------------------------------------------------------------------

This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken.
-------------------------------------------------------------------------------------------------------------------------------

As others have pointed out, I can not accept patches sent with this type of wording in them, sorry. Please fix your email system and try again.

greg k-h