From: Greg Kroah-Hartman Date: Fri, 23 Feb 2018 09:48:43 +0000 (+0100) Subject: 3.18-stable patches X-Git-Tag: v3.18.96~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7dfe01fe9d1d66f80d5ef3d94e6c2e31b90d4f71;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: usbip-keep-usbip_device-sockfd-state-in-sync-with-tcp_socket.patch --- diff --git a/queue-3.18/series b/queue-3.18/series index 43658a8efda..57ac9c260af 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -31,3 +31,4 @@ selinux-ensure-the-context-is-nul-terminated-in-security_context_to_sid_core.pat asoc-ux500-add-module_license-tag.patch video-fbdev-mmp-add-module_license.patch dn_getsockoptdecnet-move-nf_-get-set-sockopt-outside-sock-lock.patch +usbip-keep-usbip_device-sockfd-state-in-sync-with-tcp_socket.patch diff --git a/queue-3.18/usbip-keep-usbip_device-sockfd-state-in-sync-with-tcp_socket.patch b/queue-3.18/usbip-keep-usbip_device-sockfd-state-in-sync-with-tcp_socket.patch new file mode 100644 index 00000000000..58f04b5113a --- /dev/null +++ b/queue-3.18/usbip-keep-usbip_device-sockfd-state-in-sync-with-tcp_socket.patch @@ -0,0 +1,65 @@ +From 009f41aed4b3e11e6dc1e3c07377a10c20f1a5ed Mon Sep 17 00:00:00 2001 +From: Shuah Khan +Date: Fri, 26 Jan 2018 11:56:50 -0700 +Subject: usbip: keep usbip_device sockfd state in sync with tcp_socket + +From: Shuah Khan + +commit 009f41aed4b3e11e6dc1e3c07377a10c20f1a5ed upstream. + +Keep usbip_device sockfd state in sync with tcp_socket. When tcp_socket +is reset to null, reset sockfd to -1 to keep it in sync. + +Signed-off-by: Shuah Khan +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/usbip/stub_dev.c | 3 +++ + drivers/usb/usbip/vhci_hcd.c | 2 ++ + 2 files changed, 5 insertions(+) + +--- a/drivers/usb/usbip/stub_dev.c ++++ b/drivers/usb/usbip/stub_dev.c +@@ -87,6 +87,7 @@ static ssize_t store_sockfd(struct devic + goto err; + + sdev->ud.tcp_socket = socket; ++ sdev->ud.sockfd = sockfd; + + spin_unlock_irq(&sdev->ud.lock); + +@@ -186,6 +187,7 @@ static void stub_shutdown_connection(str + if (ud->tcp_socket) { + sockfd_put(ud->tcp_socket); + ud->tcp_socket = NULL; ++ ud->sockfd = -1; + } + + /* 3. free used data */ +@@ -280,6 +282,7 @@ static struct stub_device *stub_device_a + sdev->ud.status = SDEV_ST_AVAILABLE; + spin_lock_init(&sdev->ud.lock); + sdev->ud.tcp_socket = NULL; ++ sdev->ud.sockfd = -1; + + INIT_LIST_HEAD(&sdev->priv_init); + INIT_LIST_HEAD(&sdev->priv_tx); +--- a/drivers/usb/usbip/vhci_hcd.c ++++ b/drivers/usb/usbip/vhci_hcd.c +@@ -791,6 +791,7 @@ static void vhci_shutdown_connection(str + if (vdev->ud.tcp_socket) { + sockfd_put(vdev->ud.tcp_socket); + vdev->ud.tcp_socket = NULL; ++ vdev->ud.sockfd = -1; + } + pr_info("release socket\n"); + +@@ -839,6 +840,7 @@ static void vhci_device_reset(struct usb + if (ud->tcp_socket) { + sockfd_put(ud->tcp_socket); + ud->tcp_socket = NULL; ++ ud->sockfd = -1; + } + ud->status = VDEV_ST_NULL; +