linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: usbip: stub_dev: Fixed oops during removal of usbip_host
@ 2012-09-18  4:00 navin patidar
  2012-09-18  7:40 ` Dan Carpenter
  0 siblings, 1 reply; 16+ messages in thread
From: navin patidar @ 2012-09-18  4:00 UTC (permalink / raw)
  To: gregkh, mfm; +Cc: linux-usb, devel, linux-kernel, 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.

Signed-off-by: navin patidar <navinp@cdac.in>
---
 drivers/staging/usbip/stub_dev.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c
index 92ced35..447a98c 100644
--- a/drivers/staging/usbip/stub_dev.c
+++ b/drivers/staging/usbip/stub_dev.c
@@ -198,10 +198,8 @@ static void stub_shutdown_connection(struct usbip_device *ud)
 	 * 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 +231,9 @@ static void stub_device_reset(struct usbip_device *ud)
 
 	dev_dbg(&udev->dev, "device reset");
 
+	ud->tcp_socket = NULL;
+	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");
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH] staging: usbip: stub_dev: Fixed oops during removal of usbip_host
@ 2012-09-14 13:21 navin patidar
  2012-09-14 14:16 ` Dan Carpenter
  0 siblings, 1 reply; 16+ messages in thread
From: navin patidar @ 2012-09-14 13:21 UTC (permalink / raw)
  To: gregkh, mfm; +Cc: linux-usb, devel, linux-kernel, 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.

Signed-off-by: navin patidar <navinp@cdac.in>
---
 drivers/staging/usbip/stub_dev.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c
index 92ced35..447a98c 100644
--- a/drivers/staging/usbip/stub_dev.c
+++ b/drivers/staging/usbip/stub_dev.c
@@ -198,10 +198,8 @@ static void stub_shutdown_connection(struct usbip_device *ud)
 	 * 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 +231,9 @@ static void stub_device_reset(struct usbip_device *ud)
 
 	dev_dbg(&udev->dev, "device reset");
 
+	ud->tcp_socket = NULL;
+	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");
-- 
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.
-------------------------------------------------------------------------------------------------------------------------------


^ permalink raw reply related	[flat|nested] 16+ messages in thread
* [PATCH] staging: usbip: stub_dev: Fixed oops during removal of usbip_host
@ 2012-09-14  9:53 navin patidar
  2012-09-14 11:42 ` Sergei Shtylyov
  2012-09-17 12:19 ` Greg KH
  0 siblings, 2 replies; 16+ messages in thread
From: navin patidar @ 2012-09-14  9:53 UTC (permalink / raw)
  To: gregkh, mfm; +Cc: linux-usb, devel, linux-kernel, 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.

Signed-off-by: navin patidar <navinp@cdac.in>
---
 drivers/staging/usbip/stub_dev.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c
index 92ced35..f584af8 100644
--- a/drivers/staging/usbip/stub_dev.c
+++ b/drivers/staging/usbip/stub_dev.c
@@ -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");
-- 
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.
-------------------------------------------------------------------------------------------------------------------------------


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-09-18 13:16 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-18  4:00 [PATCH] staging: usbip: stub_dev: Fixed oops during removal of usbip_host navin patidar
2012-09-18  7:40 ` Dan Carpenter
2012-09-18  9:32   ` navin patidar
2012-09-18  9:36     ` Dan Carpenter
2012-09-18 11:44       ` navin patidar
2012-09-18 13:15         ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2012-09-14 13:21 navin patidar
2012-09-14 14:16 ` Dan Carpenter
2012-09-14 14:28   ` Sebastian Andrzej Siewior
2012-09-14 14:41     ` Dan Carpenter
2012-09-14  9:53 navin patidar
2012-09-14 11:42 ` Sergei Shtylyov
2012-09-14 12:04   ` Sebastian Andrzej Siewior
2012-09-14 14:29     ` navin patidar
     [not found]   ` <CAPV97yfV27x8hB2WUCVmGWEU7i21Y5K5trig2fzQBx+VB_Yk2g@mail.gmail.com>
2012-09-14 14:16     ` Sergei Shtylyov
2012-09-17 12:19 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).