Received: by 10.223.185.116 with SMTP id b49csp821678wrg; Sat, 10 Feb 2018 21:11:04 -0800 (PST) X-Google-Smtp-Source: AH8x224xRRzBkAjQjbMk3I4JvM2z1j8FYLpwqKmlenpHr32+7Ow9OR4KsKvhWAh9cHMb51nO2QYe X-Received: by 2002:a17:902:b60b:: with SMTP id b11-v6mr7196813pls.210.1518325864564; Sat, 10 Feb 2018 21:11:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518325864; cv=none; d=google.com; s=arc-20160816; b=mPLPsK3aR5VvPSHAlP03Wjg3ZUr52o7/APHaIS3wrq+rnKfCafiafUeknyjPx+jRjh dXfPy8ShLNM60HdtOkLoWSg7j7u2FoY6QVjOAbtfWvKqzi+5PEyH9KISszDIivJVDTXW oNvlpyX15BUKCAcirwha87/JzM41VftJVQTKZ0BsYG3OTkZ/PeJ1do7SQGpObX8UkvpN bOP0J6jyudQUJwfOPHmtbjGdEt7rF4GXNe9SA1BmxTtvs3oHRDmV5E45croBpvXY4W/p Y3mw+/EiRyzp2MbL1E7IDRtvAH5h07EQTYo4uw8z2PRMx8F6MsKyt0C3gWPCPzf+v9nb DeAw== 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=/aGKCGAuCxUAiYB/qzwHW+aGTBZ0Y9vqhiufqTjuORU=; b=mxtxSTMLmtgIlvWgF6jSopw6Yzd9XFeQvuRRztsK0Ylw9v+8Ax50Hy0/ZkV4XElNZh 57Q9//LZ7mDpc1ihnESKsbG6wm/c+eoIUfzxN47OgHTcpNxIFYrW/3L4OehC8DtY1v8L qsfkxloef1EDdr9xXMh2mHcmNq+4u5loAF4enSbumOEIxYp0hxy9W7IfdNToq5v2J1AX 3fuPpVrNumZzOj0F8ZxBx+JYBfW0mNOAu76vM1NvTrS684be1UYBbK9bODZwSN5XbuGT AoiElHAvblgJPiZY1v72LR5oNU8fHMkCUiZ8ME0eVH063koJ6fMAqiTwFvlopzv8kcZP 7HHQ== 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 s187si3558540pgb.765.2018.02.10.21.10.50; Sat, 10 Feb 2018 21:11:04 -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 S1753359AbeBKFJ1 (ORCPT + 99 others); Sun, 11 Feb 2018 00:09:27 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41455 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752651AbeBKEdm (ORCPT ); Sat, 10 Feb 2018 23:33:42 -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 1ekjKd-0002hF-0j; Sun, 11 Feb 2018 04:33:39 +0000 Received: from ben by deadeye with local (Exim 4.90) (envelope-from ) id 1ekjKY-0004X9-SV; Sun, 11 Feb 2018 04:33:34 +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, "Alan" , "Greg Kroah-Hartman" , "Alan Cox" Date: Sun, 11 Feb 2018 04:20:06 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 71/79] usbip: Fix sscanf handling 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.2.99-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Alan commit 2d32927127f44d755780aa5fa88c8c34e72558f8 upstream. Scan only to the length permitted by the buffer One of a set of sscanf problems noted by Jackie Chang Signed-off-by: Alan Cox Signed-off-by: Greg Kroah-Hartman Signed-off-by: Ben Hutchings --- drivers/staging/usbip/userspace/libsrc/usbip_common.c | 2 +- drivers/staging/usbip/userspace/libsrc/vhci_driver.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/drivers/staging/usbip/userspace/libsrc/usbip_common.c +++ b/drivers/staging/usbip/userspace/libsrc/usbip_common.c @@ -164,7 +164,7 @@ int read_attr_speed(struct sysfs_device goto err; } - ret = sscanf(attr->value, "%s\n", speed); + ret = sscanf(attr->value, "%99s\n", speed); if (ret < 1) { dbg("sscanf failed"); goto err; --- a/drivers/staging/usbip/userspace/libsrc/vhci_driver.c +++ b/drivers/staging/usbip/userspace/libsrc/vhci_driver.c @@ -66,7 +66,7 @@ static int parse_status(char *value) unsigned long socket; char lbusid[SYSFS_BUS_ID_SIZE]; - ret = sscanf(c, "%d %d %d %x %lx %s\n", + ret = sscanf(c, "%d %d %d %x %lx %31s\n", &port, &status, &speed, &devid, &socket, lbusid);