]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jan 2018 10:15:24 +0000 (11:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jan 2018 10:15:24 +0000 (11:15 +0100)
added patches:
usbip-fix-usbip-bind-writing-random-string-after-command-in-match_busid.patch
usbip-prevent-leaking-socket-pointer-address-in-messages.patch
usbip-stub-stop-printing-kernel-pointer-addresses-in-messages.patch
usbip-vhci-stop-printing-kernel-pointer-addresses-in-messages.patch

queue-4.9/series
queue-4.9/usbip-fix-usbip-bind-writing-random-string-after-command-in-match_busid.patch [new file with mode: 0644]
queue-4.9/usbip-prevent-leaking-socket-pointer-address-in-messages.patch [new file with mode: 0644]
queue-4.9/usbip-stub-stop-printing-kernel-pointer-addresses-in-messages.patch [new file with mode: 0644]
queue-4.9/usbip-vhci-stop-printing-kernel-pointer-addresses-in-messages.patch [new file with mode: 0644]

index d164c9a557dbabf8177bb51443720c533bc845fe..5f205a76bda2e900249a252fab0386daf6aa7d31 100644 (file)
@@ -54,3 +54,7 @@ s390-qeth-apply-takeover-changes-when-mode-is-toggled.patch
 s390-qeth-don-t-apply-takeover-changes-to-rxip.patch
 s390-qeth-lock-ip-table-while-applying-takeover-changes.patch
 s390-qeth-update-takeover-ips-after-configuration-change.patch
+usbip-fix-usbip-bind-writing-random-string-after-command-in-match_busid.patch
+usbip-prevent-leaking-socket-pointer-address-in-messages.patch
+usbip-stub-stop-printing-kernel-pointer-addresses-in-messages.patch
+usbip-vhci-stop-printing-kernel-pointer-addresses-in-messages.patch
diff --git a/queue-4.9/usbip-fix-usbip-bind-writing-random-string-after-command-in-match_busid.patch b/queue-4.9/usbip-fix-usbip-bind-writing-random-string-after-command-in-match_busid.patch
new file mode 100644 (file)
index 0000000..0024cb1
--- /dev/null
@@ -0,0 +1,49 @@
+From 544c4605acc5ae4afe7dd5914147947db182f2fb Mon Sep 17 00:00:00 2001
+From: Juan Zea <juan.zea@qindel.com>
+Date: Fri, 15 Dec 2017 10:21:20 +0100
+Subject: usbip: fix usbip bind writing random string after command in match_busid
+
+From: Juan Zea <juan.zea@qindel.com>
+
+commit 544c4605acc5ae4afe7dd5914147947db182f2fb upstream.
+
+usbip bind writes commands followed by random string when writing to
+match_busid attribute in sysfs, caused by using full variable size
+instead of string length.
+
+Signed-off-by: Juan Zea <juan.zea@qindel.com>
+Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/usb/usbip/src/utils.c |    9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/tools/usb/usbip/src/utils.c
++++ b/tools/usb/usbip/src/utils.c
+@@ -30,6 +30,7 @@ int modify_match_busid(char *busid, int
+       char command[SYSFS_BUS_ID_SIZE + 4];
+       char match_busid_attr_path[SYSFS_PATH_MAX];
+       int rc;
++      int cmd_size;
+       snprintf(match_busid_attr_path, sizeof(match_busid_attr_path),
+                "%s/%s/%s/%s/%s/%s", SYSFS_MNT_PATH, SYSFS_BUS_NAME,
+@@ -37,12 +38,14 @@ int modify_match_busid(char *busid, int
+                attr_name);
+       if (add)
+-              snprintf(command, SYSFS_BUS_ID_SIZE + 4, "add %s", busid);
++              cmd_size = snprintf(command, SYSFS_BUS_ID_SIZE + 4, "add %s",
++                                  busid);
+       else
+-              snprintf(command, SYSFS_BUS_ID_SIZE + 4, "del %s", busid);
++              cmd_size = snprintf(command, SYSFS_BUS_ID_SIZE + 4, "del %s",
++                                  busid);
+       rc = write_sysfs_attribute(match_busid_attr_path, command,
+-                                 sizeof(command));
++                                 cmd_size);
+       if (rc < 0) {
+               dbg("failed to write match_busid: %s", strerror(errno));
+               return -1;
diff --git a/queue-4.9/usbip-prevent-leaking-socket-pointer-address-in-messages.patch b/queue-4.9/usbip-prevent-leaking-socket-pointer-address-in-messages.patch
new file mode 100644 (file)
index 0000000..9a28188
--- /dev/null
@@ -0,0 +1,77 @@
+From 90120d15f4c397272aaf41077960a157fc4212bf Mon Sep 17 00:00:00 2001
+From: Shuah Khan <shuahkh@osg.samsung.com>
+Date: Fri, 15 Dec 2017 10:50:09 -0700
+Subject: usbip: prevent leaking socket pointer address in messages
+
+From: Shuah Khan <shuahkh@osg.samsung.com>
+
+commit 90120d15f4c397272aaf41077960a157fc4212bf upstream.
+
+usbip driver is leaking socket pointer address in messages. Remove
+the messages that aren't useful and print sockfd in the ones that
+are useful for debugging.
+
+Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/usbip/stub_dev.c     |    3 +--
+ drivers/usb/usbip/usbip_common.c |   14 ++++----------
+ drivers/usb/usbip/vhci_hcd.c     |    2 +-
+ 3 files changed, 6 insertions(+), 13 deletions(-)
+
+--- a/drivers/usb/usbip/stub_dev.c
++++ b/drivers/usb/usbip/stub_dev.c
+@@ -163,8 +163,7 @@ static void stub_shutdown_connection(str
+        * step 1?
+        */
+       if (ud->tcp_socket) {
+-              dev_dbg(&sdev->udev->dev, "shutdown tcp_socket %p\n",
+-                      ud->tcp_socket);
++              dev_dbg(&sdev->udev->dev, "shutdown sockfd %d\n", ud->sockfd);
+               kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR);
+       }
+--- a/drivers/usb/usbip/usbip_common.c
++++ b/drivers/usb/usbip/usbip_common.c
+@@ -335,13 +335,10 @@ int usbip_recv(struct socket *sock, void
+       char *bp = buf;
+       int osize = size;
+-      usbip_dbg_xmit("enter\n");
+-
+-      if (!sock || !buf || !size) {
+-              pr_err("invalid arg, sock %p buff %p size %d\n", sock, buf,
+-                     size);
++      if (!sock || !buf || !size)
+               return -EINVAL;
+-      }
++
++      usbip_dbg_xmit("enter\n");
+       do {
+               sock->sk->sk_allocation = GFP_NOIO;
+@@ -354,11 +351,8 @@ int usbip_recv(struct socket *sock, void
+               msg.msg_flags      = MSG_NOSIGNAL;
+               result = kernel_recvmsg(sock, &msg, &iov, 1, size, MSG_WAITALL);
+-              if (result <= 0) {
+-                      pr_debug("receive sock %p buf %p size %u ret %d total %d\n",
+-                               sock, buf, size, result, total);
++              if (result <= 0)
+                       goto err;
+-              }
+               size -= result;
+               buf += result;
+--- a/drivers/usb/usbip/vhci_hcd.c
++++ b/drivers/usb/usbip/vhci_hcd.c
+@@ -823,7 +823,7 @@ static void vhci_shutdown_connection(str
+       /* need this? see stub_dev.c */
+       if (ud->tcp_socket) {
+-              pr_debug("shutdown tcp_socket %p\n", ud->tcp_socket);
++              pr_debug("shutdown tcp_socket %d\n", ud->sockfd);
+               kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR);
+       }
diff --git a/queue-4.9/usbip-stub-stop-printing-kernel-pointer-addresses-in-messages.patch b/queue-4.9/usbip-stub-stop-printing-kernel-pointer-addresses-in-messages.patch
new file mode 100644 (file)
index 0000000..e782dcd
--- /dev/null
@@ -0,0 +1,83 @@
+From 248a22044366f588d46754c54dfe29ffe4f8b4df Mon Sep 17 00:00:00 2001
+From: Shuah Khan <shuahkh@osg.samsung.com>
+Date: Mon, 18 Dec 2017 17:23:37 -0700
+Subject: usbip: stub: stop printing kernel pointer addresses in messages
+
+From: Shuah Khan <shuahkh@osg.samsung.com>
+
+commit 248a22044366f588d46754c54dfe29ffe4f8b4df upstream.
+
+Remove and/or change debug, info. and error messages to not print
+kernel pointer addresses.
+
+Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/usbip/stub_main.c |    5 +++--
+ drivers/usb/usbip/stub_rx.c   |    7 ++-----
+ drivers/usb/usbip/stub_tx.c   |    6 +++---
+ 3 files changed, 8 insertions(+), 10 deletions(-)
+
+--- a/drivers/usb/usbip/stub_main.c
++++ b/drivers/usb/usbip/stub_main.c
+@@ -252,11 +252,12 @@ void stub_device_cleanup_urbs(struct stu
+       struct stub_priv *priv;
+       struct urb *urb;
+-      dev_dbg(&sdev->udev->dev, "free sdev %p\n", sdev);
++      dev_dbg(&sdev->udev->dev, "Stub device cleaning up urbs\n");
+       while ((priv = stub_priv_pop(sdev))) {
+               urb = priv->urb;
+-              dev_dbg(&sdev->udev->dev, "free urb %p\n", urb);
++              dev_dbg(&sdev->udev->dev, "free urb seqnum %lu\n",
++                      priv->seqnum);
+               usb_kill_urb(urb);
+               kmem_cache_free(stub_priv_cache, priv);
+--- a/drivers/usb/usbip/stub_rx.c
++++ b/drivers/usb/usbip/stub_rx.c
+@@ -225,9 +225,6 @@ static int stub_recv_cmd_unlink(struct s
+               if (priv->seqnum != pdu->u.cmd_unlink.seqnum)
+                       continue;
+-              dev_info(&priv->urb->dev->dev, "unlink urb %p\n",
+-                       priv->urb);
+-
+               /*
+                * This matched urb is not completed yet (i.e., be in
+                * flight in usb hcd hardware/driver). Now we are
+@@ -266,8 +263,8 @@ static int stub_recv_cmd_unlink(struct s
+               ret = usb_unlink_urb(priv->urb);
+               if (ret != -EINPROGRESS)
+                       dev_err(&priv->urb->dev->dev,
+-                              "failed to unlink a urb %p, ret %d\n",
+-                              priv->urb, ret);
++                              "failed to unlink a urb # %lu, ret %d\n",
++                              priv->seqnum, ret);
+               return 0;
+       }
+--- a/drivers/usb/usbip/stub_tx.c
++++ b/drivers/usb/usbip/stub_tx.c
+@@ -102,7 +102,7 @@ void stub_complete(struct urb *urb)
+       /* link a urb to the queue of tx. */
+       spin_lock_irqsave(&sdev->priv_lock, flags);
+       if (sdev->ud.tcp_socket == NULL) {
+-              usbip_dbg_stub_tx("ignore urb for closed connection %p", urb);
++              usbip_dbg_stub_tx("ignore urb for closed connection\n");
+               /* It will be freed in stub_device_cleanup_urbs(). */
+       } else if (priv->unlinking) {
+               stub_enqueue_ret_unlink(sdev, priv->seqnum, urb->status);
+@@ -204,8 +204,8 @@ static int stub_send_ret_submit(struct s
+               /* 1. setup usbip_header */
+               setup_ret_submit_pdu(&pdu_header, urb);
+-              usbip_dbg_stub_tx("setup txdata seqnum: %d urb: %p\n",
+-                                pdu_header.base.seqnum, urb);
++              usbip_dbg_stub_tx("setup txdata seqnum: %d\n",
++                                pdu_header.base.seqnum);
+               usbip_header_correct_endian(&pdu_header, 1);
+               iov[iovnum].iov_base = &pdu_header;
diff --git a/queue-4.9/usbip-vhci-stop-printing-kernel-pointer-addresses-in-messages.patch b/queue-4.9/usbip-vhci-stop-printing-kernel-pointer-addresses-in-messages.patch
new file mode 100644 (file)
index 0000000..07b01f3
--- /dev/null
@@ -0,0 +1,145 @@
+From 8272d099d05f7ab2776cf56a2ab9f9443be18907 Mon Sep 17 00:00:00 2001
+From: Shuah Khan <shuahkh@osg.samsung.com>
+Date: Mon, 18 Dec 2017 17:24:22 -0700
+Subject: usbip: vhci: stop printing kernel pointer addresses in messages
+
+From: Shuah Khan <shuahkh@osg.samsung.com>
+
+commit 8272d099d05f7ab2776cf56a2ab9f9443be18907 upstream.
+
+Remove and/or change debug, info. and error messages to not print
+kernel pointer addresses.
+
+Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/usbip/vhci_hcd.c |   10 ----------
+ drivers/usb/usbip/vhci_rx.c  |   25 ++++++++++++-------------
+ drivers/usb/usbip/vhci_tx.c  |    3 ++-
+ 3 files changed, 14 insertions(+), 24 deletions(-)
+
+--- a/drivers/usb/usbip/vhci_hcd.c
++++ b/drivers/usb/usbip/vhci_hcd.c
+@@ -506,9 +506,6 @@ static int vhci_urb_enqueue(struct usb_h
+       struct vhci_device *vdev;
+       unsigned long flags;
+-      usbip_dbg_vhci_hc("enter, usb_hcd %p urb %p mem_flags %d\n",
+-                        hcd, urb, mem_flags);
+-
+       if (portnum > VHCI_HC_PORTS) {
+               pr_err("invalid port number %d\n", portnum);
+               return -ENODEV;
+@@ -671,8 +668,6 @@ static int vhci_urb_dequeue(struct usb_h
+       struct vhci_device *vdev;
+       unsigned long flags;
+-      pr_info("dequeue a urb %p\n", urb);
+-
+       spin_lock_irqsave(&vhci->lock, flags);
+       priv = urb->hcpriv;
+@@ -700,7 +695,6 @@ static int vhci_urb_dequeue(struct usb_h
+               /* tcp connection is closed */
+               spin_lock(&vdev->priv_lock);
+-              pr_info("device %p seems to be disconnected\n", vdev);
+               list_del(&priv->list);
+               kfree(priv);
+               urb->hcpriv = NULL;
+@@ -712,8 +706,6 @@ static int vhci_urb_dequeue(struct usb_h
+                * vhci_rx will receive RET_UNLINK and give back the URB.
+                * Otherwise, we give back it here.
+                */
+-              pr_info("gives back urb %p\n", urb);
+-
+               usb_hcd_unlink_urb_from_ep(hcd, urb);
+               spin_unlock_irqrestore(&vhci->lock, flags);
+@@ -741,8 +733,6 @@ static int vhci_urb_dequeue(struct usb_h
+               unlink->unlink_seqnum = priv->seqnum;
+-              pr_info("device %p seems to be still connected\n", vdev);
+-
+               /* send cmd_unlink and try to cancel the pending URB in the
+                * peer */
+               list_add_tail(&unlink->list, &vdev->unlink_tx);
+--- a/drivers/usb/usbip/vhci_rx.c
++++ b/drivers/usb/usbip/vhci_rx.c
+@@ -37,24 +37,23 @@ struct urb *pickup_urb_and_free_priv(str
+               urb = priv->urb;
+               status = urb->status;
+-              usbip_dbg_vhci_rx("find urb %p vurb %p seqnum %u\n",
+-                              urb, priv, seqnum);
++              usbip_dbg_vhci_rx("find urb seqnum %u\n", seqnum);
+               switch (status) {
+               case -ENOENT:
+                       /* fall through */
+               case -ECONNRESET:
+-                      dev_info(&urb->dev->dev,
+-                               "urb %p was unlinked %ssynchronuously.\n", urb,
+-                               status == -ENOENT ? "" : "a");
++                      dev_dbg(&urb->dev->dev,
++                               "urb seq# %u was unlinked %ssynchronuously\n",
++                               seqnum, status == -ENOENT ? "" : "a");
+                       break;
+               case -EINPROGRESS:
+                       /* no info output */
+                       break;
+               default:
+-                      dev_info(&urb->dev->dev,
+-                               "urb %p may be in a error, status %d\n", urb,
+-                               status);
++                      dev_dbg(&urb->dev->dev,
++                               "urb seq# %u may be in a error, status %d\n",
++                               seqnum, status);
+               }
+               list_del(&priv->list);
+@@ -80,9 +79,9 @@ static void vhci_recv_ret_submit(struct
+       spin_unlock_irqrestore(&vdev->priv_lock, flags);
+       if (!urb) {
+-              pr_err("cannot find a urb of seqnum %u\n", pdu->base.seqnum);
+-              pr_info("max seqnum %d\n",
+-                      atomic_read(&vhci->seqnum));
++              pr_err("cannot find a urb of seqnum %u max seqnum %d\n",
++                      pdu->base.seqnum,
++                      atomic_read(&vhci_hcd->seqnum));
+               usbip_event_add(ud, VDEV_EVENT_ERROR_TCP);
+               return;
+       }
+@@ -104,7 +103,7 @@ static void vhci_recv_ret_submit(struct
+       if (usbip_dbg_flag_vhci_rx)
+               usbip_dump_urb(urb);
+-      usbip_dbg_vhci_rx("now giveback urb %p\n", urb);
++      usbip_dbg_vhci_rx("now giveback urb %u\n", pdu->base.seqnum);
+       spin_lock_irqsave(&vhci->lock, flags);
+       usb_hcd_unlink_urb_from_ep(vhci_to_hcd(vhci), urb);
+@@ -170,7 +169,7 @@ static void vhci_recv_ret_unlink(struct
+               pr_info("the urb (seqnum %d) was already given back\n",
+                       pdu->base.seqnum);
+       } else {
+-              usbip_dbg_vhci_rx("now giveback urb %p\n", urb);
++              usbip_dbg_vhci_rx("now giveback urb %d\n", pdu->base.seqnum);
+               /* If unlink is successful, status is -ECONNRESET */
+               urb->status = pdu->u.ret_unlink.status;
+--- a/drivers/usb/usbip/vhci_tx.c
++++ b/drivers/usb/usbip/vhci_tx.c
+@@ -83,7 +83,8 @@ static int vhci_send_cmd_submit(struct v
+               memset(&msg, 0, sizeof(msg));
+               memset(&iov, 0, sizeof(iov));
+-              usbip_dbg_vhci_tx("setup txdata urb %p\n", urb);
++              usbip_dbg_vhci_tx("setup txdata urb seqnum %lu\n",
++                                priv->seqnum);
+               /* 1. setup usbip_header */
+               setup_cmd_submit_pdu(&pdu_header, urb);