Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3258461yba; Tue, 16 Apr 2019 07:49:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3BOlBbTd6HFppDYvdjJ3bj8Exf0Ue6TtfRybcNcDfqnzY5q8qvd1F2RR4db4QnhDlbz8M X-Received: by 2002:a62:ab13:: with SMTP id p19mr84535717pff.131.1555426193749; Tue, 16 Apr 2019 07:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555426193; cv=none; d=google.com; s=arc-20160816; b=Pn/9oqZeMeHYEwNDz/zEmM5CqWBQPoKIUDUN2S3x4GAbKCfDcVWROeV2ZfVfJgrYfS Wf/qzU8ePJo2EtcL6L1LtLXmmV/xSCREiqWUCXP+6K+AR2MAewRgl1waBkqiFL7mq4yc sBeOihBN/qF5yFne616nRWotfonLqlNDKwT0yxZws30FKQP/tvc2YLrioANJdYUp8Cfi +/VCvH73lhMZAyXzAkcz88Mm0GOStoJK0hXcR8FYv6UGcv35J/MCJDpSfBqwfGJx0Hr/ E5dPrnmZ+NDVkUj2bgIIHqn8ipeY76YS5MRB1mJ1bWkbq9HtoaEZ4JkIXLgnMcHSGGwm vOaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=csGUzGL6i+UbznxQv+mETgDita093lM9dgXQUH+q7sQ=; b=b2KPsTM3otx1zA7NYg8ZerwFYcS1DUUCd2DAlIDjZ2c9uDq6rU1enx2h7+GBazjmZL lxNMu1J7cPvkiILAwVxaxgYeJOfXERI3EeYlvc9q391QOQJ9QLY8wY/7Oi/bnRRcZht2 a2SpYOKmsKa7cEh6W/EYHxjk2bO/irnl5pJWTX1bgEkJflxtzPakOn7MmNJ62cyDr9+E 5/EoCr6XxSJRYt3HDq5fx3p9dN1Sc5S18hly94jrsfLAowZf5BdrAZ1a3hBF3ydaJwrD FcBms6Sb3I7/xhhCsBK1nM8OvCA8kaqcKf5mNsQUmpMfxMDeNnVFZki8uCYwntxHaeHh OYKg== 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 e6si47856586pgb.435.2019.04.16.07.49.37; Tue, 16 Apr 2019 07:49:53 -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 S1729654AbfDPOsq convert rfc822-to-8bit (ORCPT + 99 others); Tue, 16 Apr 2019 10:48:46 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:2918 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726641AbfDPOsq (ORCPT ); Tue, 16 Apr 2019 10:48:46 -0400 Received: from DGGEMM406-HUB.china.huawei.com (unknown [172.30.72.57]) by Forcepoint Email with ESMTP id B3F1F7A639216F101BD3; Tue, 16 Apr 2019 22:48:41 +0800 (CST) Received: from dggeme759-chm.china.huawei.com (10.3.19.105) by DGGEMM406-HUB.china.huawei.com (10.3.20.214) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 16 Apr 2019 22:48:41 +0800 Received: from dggeme762-chm.china.huawei.com (10.3.19.108) by dggeme759-chm.china.huawei.com (10.3.19.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 16 Apr 2019 22:48:40 +0800 Received: from dggeme762-chm.china.huawei.com ([10.8.68.53]) by dggeme762-chm.china.huawei.com ([10.8.68.53]) with mapi id 15.01.1591.008; Tue, 16 Apr 2019 22:48:41 +0800 From: "zhuyan (M)" To: Greg KH CC: "anton@enomsg.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "zhuyan (M)" Subject: Re: [PATCH] usb:host: fix divide-by-zero in function fhci_queue_urb Thread-Topic: [PATCH] usb:host: fix divide-by-zero in function fhci_queue_urb Thread-Index: AdT0UyQ3T4H9dWZMSiWXXsWu+YIp3w== Date: Tue, 16 Apr 2019 14:48:40 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.40.99.186] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 16 Apr 2019 at 11:45:45 +0200, Greg KH wrote: > On Tue, Apr 09, 2019 at 10:37:12PM +0800, zhuyan wrote: > > In function fhci_queue_urb, the divisor of expression > > (urb->transfer_buffer_length % usb_maxpacket(urb->dev, urb->pipe, > > usb_pipeout(urb->pipe))) may be zero. > > How can you hit that? > > > When it is zero, unexpected results may occur, so it is necessary to > > ensure that the divisor is not zero. > > > > Signed-off-by: zhuyan > > I need a "Full" name here, not just a single name. Whatever you use to sign documents is good. > > thanks, > > greg k-h In function usb_maxpacket, when ep is NULL, its return value is 0. Then, in function fhci_queue_urb, the divisor of expression (urb->transfer_buffer_length % usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe))) is zero. It will lead to unpredictable results. Thanks! Yan Zhu