Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2511051imm; Mon, 24 Sep 2018 05:42:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV63dsQ3a/m1FE/UIEiTGWmnLtLZifTvNDZ+RN7sGqU8Gzcc1UitXlAqmPfTGlAdL1mRQ5HyJ X-Received: by 2002:a17:902:a5c5:: with SMTP id t5-v6mr10468570plq.6.1537792934664; Mon, 24 Sep 2018 05:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792934; cv=none; d=google.com; s=arc-20160816; b=O/0KQOzcMc9RaIzhjMF5DdHfy1LfuA8rDdMPu9aNzft6k5lgFRtklN3I0Jya5enfl8 7/LQpPoc3yzVBs8ptyLTTopOmTV9CDwv2zFmo8+0jiADeJZf4jni6OYDeWAWSPjRJMKm DFMDEs1KbiFXwpVXusxJVgXBhyGv0LO4UykmqCrmU6IzpXXzpsXzgHy81Bwz5sygn2mz YMTPZvb9DB1H/8QvXpUBYNYr2Dw3/EGA3qdcmCPsK+PE8gmn26gBsvZO9J6I1II3qjUz uPenmTTDOeXTt0DIMAgH+s3vlOImNL1dKtpY9PwACTQQJwRhnTz0gTvqYjX4XzrdqJcx BosQ== 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=iDI8l+PNPBgWigStcR06cQymnExGp6ReKc6yDTOyOfY=; b=ch9ClfDS7cedaJu7Mio23A1Z9HAO1VIYod/4K0rm5331ROYb7StvFlDVgzYeF2z3/w q2RM808nWPQDvo4z/6/0x5i1JZKXB9g/apeAeku29ncRwd6LCMUAPWMKStM504zFb6JH gDrmiaJPOu4hNroiQf6PRRs+lbAtizFA9KPBo3CWYoR1z6sh2vz8UNR80fRCtk5gdJHb pEY5I9N1F1wPIZBDOmAy6caz2kEiVETCEoINTYi4JtR0qhaNXP8sJlG+jnMw2f2lhOlg IH1aRe8AGHkQ+rw+A3v9MY8DRWvu/ErE4DwogTauyD1Qq6ORJJ1Q9WnA1NoGHJmAwUq3 v2Yg== 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 l12-v6si178457pfd.22.2018.09.24.05.41.59; Mon, 24 Sep 2018 05:42:14 -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 S2388694AbeIXSm5 (ORCPT + 99 others); Mon, 24 Sep 2018 14:42:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59076 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733116AbeIXSm5 (ORCPT ); Mon, 24 Sep 2018 14:42:57 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6AFBD109E; Mon, 24 Sep 2018 12:40:58 +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.18 128/235] USB: serial: io_ti: fix array underflow in completion handler Date: Mon, 24 Sep 2018 13:51:54 +0200 Message-Id: <20180924113118.783684742@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@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.18-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 @@ -173,7 +173,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