Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3306902imu; Sun, 11 Nov 2018 12:03:16 -0800 (PST) X-Google-Smtp-Source: AJdET5c+zMkFlPLVyd/lghykZgzY6FeRk3jPoLDBoObhEDSf1ISxfaGk973EtCQN286UiNhVE74i X-Received: by 2002:a63:fe0a:: with SMTP id p10mr14778631pgh.265.1541966596868; Sun, 11 Nov 2018 12:03:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966596; cv=none; d=google.com; s=arc-20160816; b=srTl92+qjt43qaU5dFVk3r8vFc94TIYXiRJrFVkJ6xtz51FaXUCtcMh/KCBrXTxouN rYfDGQoaaOj8LYjwOdLd1ocxQTnyY+JNO+ehkGONUtJZIxcBSKQMKl3JkspCHMqNUA/X iyQxMAuFWDXpPlPedA+3gQRBaLpzet0uHNyp49r8HY9swqv195ywDxXey6f/KOi9eoNk 1i7twvIVABIj7lh9GejhQPXjTQIaOhYrqzJ4dCxZVHalYmV/oXf+zMaj4chhye3yRPti ZSTacs8reESvbCM1KyhUaNG4sHXi1FDtghM/AQUkFW7X4mNPGsQby1rQs/qpssj4PPRM ozbQ== 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; bh=VlwyGicC1B8J9T5qHktbAyHqvWb//30KVvcAQhVZERc=; b=NyzyJHu7nXNlIXGGm7RBJatM/fGCrRbW2dRwikOVc5gsQnv9yOuqstrll8LO1SSjDx /ovTVx+SH1aJ7XGsreF5FX/vNeFMDlyTsjmK8PMXZRmmuLK4QGfsH2J3lso9dWDv+1tH naTOVBh/+3xuRlXkjLCWk1IY96dBMNPEViXIMLlllR1y+FXm/Z80NS7Bz2+V0aODMNmh EbmN2StisZiNqsBFjewr3MXqJ451Je28vlfLlPxCQF0R1QzXIETlUvYkPd7XHKXUlruU Qk/kGRQdZv3lG3JgIQ63PqhrRWb1fOyDnNmqOVmy/lf3Cz5yYx89XyZKOGVEyqtg5Dmz 7Jqg== 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 p189-v6si15503982pfg.235.2018.11.11.12.03.01; Sun, 11 Nov 2018 12:03:16 -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 S1729668AbeKLFvQ (ORCPT + 99 others); Mon, 12 Nov 2018 00:51:16 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51198 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730731AbeKLFsc (ORCPT ); Mon, 12 Nov 2018 00:48:32 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvss-0000oO-6Q; Sun, 11 Nov 2018 19:59:02 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsV-0001hS-Pi; Sun, 11 Nov 2018 19:58:39 +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, "Johan Hovold" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 236/366] USB: serial: mos7840: fix status-register error handling In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 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.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 794744abfffef8b1f3c0c8a4896177d6d13d653d upstream. Add missing transfer-length sanity check to the status-register completion handler to avoid leaking bits of uninitialised slab data to user space. Fixes: 3f5429746d91 ("USB: Moschip 7840 USB-Serial Driver") Signed-off-by: Johan Hovold Signed-off-by: Ben Hutchings --- drivers/usb/serial/mos7840.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -471,6 +471,9 @@ static void mos7840_control_callback(str } dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); + if (urb->actual_length < 1) + goto out; + dev_dbg(dev, "%s mos7840_port->MsrLsr is %d port %d\n", __func__, mos7840_port->MsrLsr, mos7840_port->port_num); data = urb->transfer_buffer;