Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2042640imm; Mon, 16 Jul 2018 00:45:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfgVyU4tNO6M4DwGzYKaBEhMoV1LDc1MycjU4ZLR182kEY0P0WXRjocHky4hn4lIVjkecHb X-Received: by 2002:a17:902:123:: with SMTP id 32-v6mr15330523plb.181.1531727105477; Mon, 16 Jul 2018 00:45:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531727105; cv=none; d=google.com; s=arc-20160816; b=AZzUk2JX5MdynajvQi/TxFXSklyBNcO3VLWRFWt4doqGBYymPq5Khqs0azpPcCJ9qK Pee2igpSgrlKDCzp3wWfzFc7SvFzu9CLibP1MxIRJNCwAcjqeZpuN3P23C4rFtSVA4OA ZuCK/mh8DUM5lCOY3sGUxmIboIrN2IY88jjisBj7vpW3wsikcKrpj8NmU42fDWB51H9B ZFxt8ryeoeQFRwTW4bSiekfILbJcJk8dkLezXz/zM0XdBZWBo4DIH0kHNyrr80QFw2S9 Cc8a51dxg2XWOwXQZxFKkDyAwf5+3mk4j0BiDhhJzVsxCHHsrZB4sNAVNOQQN2f61AMz /UHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=BidTMXJqbQxsXxYamMfnUQ4qgl6s4taO8obdfGQSA/0=; b=g4Jodh3ZMcD7NnXdLKp58hM4xKWp6HkoxGfHwRR3xHbGCmQLCPMMxEELthlFNy5FUR CmybIE9QA/7Qlxt4ZQSIMa+i/KCB3jTerkvjNd6r87JIHwuUjXr84ZABVJ/q3hA5ZOAA ytv1lAZA7BAo2RfQpPNKmqy0Th742Yo66T9xaNDixbpGwUqlif60qMCW4JqRrn7ONTxk FYzVKPwpsZKBV9feClyC6qaTcVP9faXnCN0Y8ds6zE+0vrm1nhmVlfsgqd1OR81+3Tic dAXePV+ijAEhGSA1Q3MriZPk2Gkknj/RfPwahBnROqNfJU64Xz+v8Dw4GPBxpt1G1NnN RFww== 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 p3-v6si29962444pld.408.2018.07.16.00.44.50; Mon, 16 Jul 2018 00:45:05 -0700 (PDT) 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 S2389097AbeGPIJk (ORCPT + 99 others); Mon, 16 Jul 2018 04:09:40 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48030 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731619AbeGPIJj (ORCPT ); Mon, 16 Jul 2018 04:09:39 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A6562C03; Mon, 16 Jul 2018 07:43:36 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold Subject: [PATCH 4.9 15/32] USB: serial: mos7840: fix status-register error handling Date: Mon, 16 Jul 2018 09:36:23 +0200 Message-Id: <20180716073506.246221923@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180716073504.433996952@linuxfoundation.org> References: <20180716073504.433996952@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable 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") Cc: stable # 2.6.19 Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/mos7840.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -482,6 +482,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;