From patchwork Tue Aug 14 09:07:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10565195 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 074C71390 for ; Tue, 14 Aug 2018 09:07:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAAC128C53 for ; Tue, 14 Aug 2018 09:07:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC8AC293D5; Tue, 14 Aug 2018 09:07:30 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 7D48628C53 for ; Tue, 14 Aug 2018 09:07:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730923AbeHNLxp (ORCPT ); Tue, 14 Aug 2018 07:53:45 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:50338 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729317AbeHNLxo (ORCPT ); Tue, 14 Aug 2018 07:53:44 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w7E94wga193146; Tue, 14 Aug 2018 09:07:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=zKzbet00uzkQAMcl1wwmWPT4DIOyPVqVqHDE6buYe5k=; b=c0vxMHeg01ObFYsPKrcU5mcchJFSEnMg1oTKmhaYQ5FPhjITMdWqJYTRmKpdH67Esr5k umxCvHXPYNirWs8z38p3AbmCaPpa3/xJkiZll+mLUR6qi4JbLvhPBIBAR1ab4aQYD0oy GwDQ2eqA4qwc97aMB+BE1NdDR4jaxBHi4oowkMvjn8cNZJeWqcOJcZTQ8s7xmKM/hCiP 9iTCDH60NXvZcRLBW0Q0FW4WWV0+2HDyfnLZYhbyVb3lxiyCyohNxeMV4mfvqs7OtjUk zAnOZLCZ/ma8Lhsdo6iBg2L1GkyTICDMZa49v/Mxqy4k+4FYwqB74FLy0l6luHxyYRpI lA== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2ksq7t7mxg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Aug 2018 09:07:25 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w7E97Nti009358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 Aug 2018 09:07:23 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w7E97MO3031628; Tue, 14 Aug 2018 09:07:22 GMT Received: from kili.mountain (/197.232.248.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 14 Aug 2018 02:07:21 -0700 Date: Tue, 14 Aug 2018 12:07:15 +0300 From: Dan Carpenter To: Johan Hovold Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] USB: serial: io_ti: array underflow in edge_interrupt_callback() Message-ID: <20180814090715.z4amswxtv5cwdria@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8984 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=650 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808140094 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 A malicious USB device could set port_number to -3 and we would underflow the edge_serial->serial->port[] array. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Dan Carpenter diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 6d1d6efa3055..fa2af18c6efe 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -1629,7 +1629,7 @@ static void edge_interrupt_callback(struct urb *urb) struct device *dev; unsigned char *data = urb->transfer_buffer; int length = urb->actual_length; - int port_number; + unsigned int port_number; int function; int retval; __u8 lsr;