Received: by 10.223.185.116 with SMTP id b49csp6417677wrg; Wed, 28 Feb 2018 09:04:22 -0800 (PST) X-Google-Smtp-Source: AH8x225vJzGHRxjnN9ldZuJIlwTKJWeYZBS/Wspde7xRB6otsZbdSxo9U6YzwcFD9AqRurp/iTKl X-Received: by 2002:a17:902:b942:: with SMTP id h2-v6mr18670153pls.45.1519837461869; Wed, 28 Feb 2018 09:04:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519837461; cv=none; d=google.com; s=arc-20160816; b=IkO2Ql8a0S9WbVT4CqhVKwD8TGnajRsrXFhV+rVXKfD7sc0nnbcmbAtxp8qTnlCsYc Dv0/a3/H03Cb9CvWPIRk1dJw/u2kJ4Bfmkjw7HBZJPi73/Z/k5waWXqNUNS/zSwDwduL vSLQZ+P+Y9jNtszWozfe5/AjovGbPIXZLDcikQQoWgJq3unJHoeEAkuEEqkw9n12V6SO lFwFBWutkKJyr3S8igqVJBhH4FgcD448nU2beTm2wH3dvkUofxHpc+sWudz/t3o2lEED 0OSCpc1XLFJw2SgFbY4t5rg9XUZHK/l9k6cNJTK59OBxRXXh50IqW04Dgwcly6ddwtxB whMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=sC1tqxrc8NzviiJ6wH4YRniPuRGXrO6lrlsO/mqP4So=; b=ZLEf711lJ4aFc7gqpkExW7EbB9K0qqhhgIQr/f8uUbQV0AY1FTGeDNT+9mPjaeSTPF 2ERV9sVchEu0y4rFs5MC1CHYauTOKYXsN9A/9DUwJvspryUSIocPSiIx0+qT9C7KUe2+ J+MhwLp23rX8V4o6t+NEPpYbLX34kehXHt6IlDn5dkSxQJqDkEhMTkn3IlP4f36DTwHf zxMoUw09vWqjIHjbe+K+9co+qNVfGEvxjBbPw4pLmoDI0tJ2hyBQdPhQ269N7nlPZ0m1 /QZGH3rJvtJ2Tm+dPt2mA+VeIh9p1Gvvrp5mkq0JCWXI1pmw9ZNJI10gkgPRvjJkPyVs 9Z2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si1218685pgf.230.2018.02.28.09.04.01; Wed, 28 Feb 2018 09:04:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752953AbeB1RCN (ORCPT + 99 others); Wed, 28 Feb 2018 12:02:13 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34365 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933677AbeB1Pv6 (ORCPT ); Wed, 28 Feb 2018 10:51:58 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yi-0006Xl-Dj; Wed, 28 Feb 2018 15:22:20 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yh-00007O-4W; Wed, 28 Feb 2018 15:22:19 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Shuah Khan" , "Greg Kroah-Hartman" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 129/254] usbip: prevent leaking socket pointer address in messages In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Shuah Khan 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 Signed-off-by: Greg Kroah-Hartman [bwh: Backported to 3.16: adjust filenames, context] Signed-off-by: Ben Hutchings --- --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c @@ -190,8 +190,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/staging/usbip/usbip_common.c +++ b/drivers/staging/usbip/usbip_common.c @@ -333,13 +333,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; @@ -352,11 +349,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/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -767,7 +767,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); }