Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2477682imm; Mon, 24 Sep 2018 05:10:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV632WmEDmLFzhT5pv8KNiFNURHwHZjmJ+52nKcnyfu6rHddO04lVCyH36bwJlEvmX6XYk4cD X-Received: by 2002:a63:5955:: with SMTP id j21-v6mr249684pgm.210.1537791055607; Mon, 24 Sep 2018 05:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537791055; cv=none; d=google.com; s=arc-20160816; b=hqD/dkUxDxQ7VpQen/+vn+V++17HDG1TVPe7QmpoFJ2nSsnqbldAmEe9h6sXfcPBIY bSDSn5ZEPFj2oKmnSurwybM+z4mUN7k2Plerk3kWSiUfWGCB0xKA4RHajFPW1EhIYrbf 6PlClJgfaASycgp37QgH2J7+ZYa2TaTBFPR0PfLYOWwSCzNyiF55R0PVQL100YWeKMVd MJXa4jXZHx1bVoDFf+eGUFNO/2QvsBTN+EHxcqJgTrqPWr/Dalgl+6uCly3Z46QFQ3rY 9YboLh+cpM3cK65KCbTG0HcpB9lAsctFtRlEsUV/n583uw04XOiRp7K32bA4Wfn9hrlm LCmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=1ApwyXSG7/0dtQJWFYhH/dhLDvjmvcAQIprE6Xr/lMc=; b=fMPmvDZm8mAGxAWoIwtRqWD+iEVe37bCfwWmcgnyNWdytSaqmMrqdWPeszLfxRFbIg t8WVQ7sVBYcwAj7PAVb6Qg7rC5uP496q7y7OO55TiPyAZwq7E6xn3MDa1HeM9dbaW3cf +AWdHhwQ1eWflVuFNUMamdavWEQfataDDb7/mCcM1ZalsK6Ib4OtCWFwQG5MphsicHHZ 8Mcii7UP5gQEwbmIoQkX8DQBWq+Amg5F1IL61LNTdJND+87+sJZTqd4aUptQ7hkNWHlR FR5QUOLIJ9De+xAIAlT2jLebBUfCuRutGoqrBofSnNgm0krXAn2OtXu7GqWkAWQepkBh 483Q== 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 32-v6si10340362plh.374.2018.09.24.05.10.40; Mon, 24 Sep 2018 05:10:55 -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 S1730796AbeIXSLn (ORCPT + 99 others); Mon, 24 Sep 2018 14:11:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53824 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729250AbeIXSGP (ORCPT ); Mon, 24 Sep 2018 14:06:15 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 19EFA107A; Mon, 24 Sep 2018 12:04:27 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Johan Hovold Subject: [PATCH 4.9 063/111] USB: serial: io_ti: fix array underflow in completion handler Date: Mon, 24 Sep 2018 13:52:30 +0200 Message-Id: <20180924113111.149387021@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.337261320@linuxfoundation.org> References: <20180924113103.337261320@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 691a03cfe8ca483f9c48153b869d354e4ae3abef upstream. As reported by Dan Carpenter, a malicious USB device could set port_number to a negative value and we would underflow the port array in the interrupt completion handler. As these devices only have one or two ports, fix this by making sure we only consider the seventh bit when determining the port number (and ignore bits 0xb0 which are typically set to 0x30). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable Reported-by: Dan Carpenter Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/io_ti.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/serial/io_ti.h +++ b/drivers/usb/serial/io_ti.h @@ -178,7 +178,7 @@ struct ump_interrupt { } __attribute__((packed)); -#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 4) - 3) +#define TIUMP_GET_PORT_FROM_CODE(c) (((c) >> 6) & 0x01) #define TIUMP_GET_FUNC_FROM_CODE(c) ((c) & 0x0f) #define TIUMP_INTERRUPT_CODE_LSR 0x03 #define TIUMP_INTERRUPT_CODE_MSR 0x04