From patchwork Tue Aug 21 09:59:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 10571323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E701139B for ; Tue, 21 Aug 2018 10:00:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BC4529D50 for ; Tue, 21 Aug 2018 10:00:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 39E4929DA0; Tue, 21 Aug 2018 10:00:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE5E729D50 for ; Tue, 21 Aug 2018 10:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726853AbeHUNTr (ORCPT ); Tue, 21 Aug 2018 09:19:47 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:32830 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726641AbeHUNTr (ORCPT ); Tue, 21 Aug 2018 09:19:47 -0400 Received: by mail-lj1-f196.google.com with SMTP id s12-v6so13849900ljj.0; Tue, 21 Aug 2018 03:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=JHI1Uz9g6147c/zTDO//jTCDi+odeHbl/VZaKcaogRI=; b=X7iD2iO59k3ycqtlULBPLwMtrGK8PysN187s44lKNCUOYOf6WyTJ6aV98xyCCQ1R4N iDCJIF17eeEeU9E+adjn6oe/SexciD/PfF/Hfduv1qJS64BTOrWRY1m0Nw+7gWSI7Dp5 x8K7FqmOFsBN6PU7ORGmlOmKqoSSi0l9zSYQAchvsvKPeQIfgFrmZLLRj46jV02L7VNn x6H5xPIIscuLnZiNDZjrGa+zlQi0izw4mrS+tI+IwT+iXnlMWn4+Im1LCcDKBhbnDsf/ 3Y/PtHwwUHszjeEcQn/SvYDQsVPCPH+wfv4eWGyjTbO8ZdFKTmCdoEFKWtSKeBMLLD8K UatQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=JHI1Uz9g6147c/zTDO//jTCDi+odeHbl/VZaKcaogRI=; b=ZZmUEfIzUQmW8mSvLjNpkRXKctY90HMKHZpQjTclW56xn4DWCYcB2R/yOL183/ayS0 gL+xPb5kGYK5aTMiydNJDILVGLgLCmTqD0g0WdFdqRohrsIuPo1xfYf4RIlGQYcQyw0C MF7VW4wIuPnTsKQHZvkwXNNaUlzS9Obj2FBThzSTWnGJphJhgQSbqLsQQaFyoXwjgrF0 dDILVfdeAi7JBahV7VUKcHXZOOKTJaQPK1HQS1Obw9q22yUYVpR5NS8u76qtOYabANAY jhOwJZdGXGd4FwmE/efW66fBJXdZWiEKvsM/Qk1+EbwO4IfuoJAlPwkurNvQQIybUFNL dMjw== X-Gm-Message-State: APzg51BfvUeudJGc5RHsJX4E37hflWFfHzWgeh9TdFtMgwRvpXz8y1NY yJNdPwj+XaISerPh1pi1Yi0= X-Google-Smtp-Source: ANB0VdYNX98pM7pUKjiRXXIRK8wXt8ZvMzdlNkR+nMAIQv9+rWUapxUDiH++Fl2WYRB99Ec7ebX//Q== X-Received: by 2002:a2e:1bd7:: with SMTP id c84-v6mr1898357ljf.0.1534845615367; Tue, 21 Aug 2018 03:00:15 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id r138-v6sm600832lfr.50.2018.08.21.03.00.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Aug 2018 03:00:14 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1fs3SR-00059J-AW; Tue, 21 Aug 2018 12:00:15 +0200 From: Johan Hovold To: Johan Hovold Cc: Dan Carpenter , Greg Kroah-Hartman , linux-usb@vger.kernel.org, stable Subject: [PATCH 2/2] USB: serial: ti_usb_3410_5052: fix array underflow in completion handler Date: Tue, 21 Aug 2018 11:59:53 +0200 Message-Id: <20180821095953.19728-2-johan@kernel.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180821095953.19728-1-johan@kernel.org> References: <20180821095953.19728-1-johan@kernel.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Similarly to a recently reported bug in io_ti, a malicious USB device could set port_number to -3 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 Signed-off-by: Johan Hovold --- drivers/usb/serial/ti_usb_3410_5052.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 3010878f7f8e..e3c5832337e0 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -1119,7 +1119,7 @@ static void ti_break(struct tty_struct *tty, int break_state) static int ti_get_port_from_code(unsigned char code) { - return (code >> 4) - 3; + return (code >> 6) & 0x01; } static int ti_get_func_from_code(unsigned char code)