Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1359770rwb; Fri, 19 Aug 2022 02:10:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR5CIAbAtSVVsFyvO8UJdwvRwv8c3C4JblGKz+txgrtwf33cs+P5YzDpbid8BL7sMQ8+y/Os X-Received: by 2002:a17:90b:380d:b0:1f5:2c6d:7de8 with SMTP id mq13-20020a17090b380d00b001f52c6d7de8mr12824740pjb.18.1660900225397; Fri, 19 Aug 2022 02:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660900225; cv=none; d=google.com; s=arc-20160816; b=eQdb+xUscLfjFcclWol3kPNqiX3YIa5gZskVv0wZd2jmOkqhydJCzMi2n075b9Awny zldYw3EUzvZzwCFc3xq8BNqphsepvSur8RTEU0KbO/uWFFRj2kDWb+b9AsbiwwzZTQqf pHrkzcs1jVQIpXOHAgaJmeb2+zr8oZ6bxIDRoLFToOqbt50cQS7ZSVI1GoBDG/PMdyBZ OKgW6wbWM6koU2CCGyRxPqErqCQk+OpwTLM7LZ5zg/9/Xux0npkD/dmzr2hMrVmx6/QM JOjbjvQlw3aCF9u3NdaiXT+kMik7IapzDe4mom5ztvSdYR74TMtmr/70Kwr34uZkox3e fodA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=43E4leJXkt9O2t1xnX1mWYSVsD79yt0r0z/wzcWdJL0=; b=Zzug+bJHo1//NczQLYuyZ26ZzbcoLBI6Amguxg3O0H11GabkPxIwmj9F3JStXCOvmh P7/yEnrj89mHsX+kCOWt1LWRzZE88qhO+WMUbTlKQgFWv3x7Kih0OpKE+RnsDgsb8Vsz AQqvRyLuRb5uj1YW6mphF5vOTuP1WyBYj5ocgzgVaoeb92ZfvWZDTAoGwlrXysA+lnDu 65KoUMcWzGX2Hu0mJRioR1bGwu8eefLDxbpcU8TWv8+sfX9NdFC3z3KCamiywJVuo3hW 7dnSWGe69EmZFn2V44jmjhIyL8VyNNaEW+D6jORa+93jht8BM9hYmbxh+0/+jQ82SQZn qcpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BpZwiSe9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a170902e40d00b0017297dce1d0si126276ple.369.2022.08.19.02.10.14; Fri, 19 Aug 2022 02:10:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BpZwiSe9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347521AbiHSIiL (ORCPT + 99 others); Fri, 19 Aug 2022 04:38:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347522AbiHSIhf (ORCPT ); Fri, 19 Aug 2022 04:37:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5D824963; Fri, 19 Aug 2022 01:36:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1AE1761736; Fri, 19 Aug 2022 08:36:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F19F9C433D6; Fri, 19 Aug 2022 08:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660898185; bh=37pTA/oFRMsALSTQ50ISevTazTRGybq+TCbIbtOvcrA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BpZwiSe9p3y0Om5R2ul7ilZ5MrO+dprUGIxtu0Vv8WCkI0OMx0u6H+2rDRKNT+P6j L910bdZXZ07GoRnvrcvioW9J1ET9UO9Tcb36kg+ZkU4W441DV//8vNiCHL7N2MuC3N o7U11RVI9Fy+QtslZwguShifYWf4jlMXWXrcq+YA= Date: Fri, 19 Aug 2022 10:36:22 +0200 From: Greg Kroah-Hartman To: Andrey Strachuk Cc: Peter Chen , Pawel Laszczak , Roger Quadros , Aswath Govindraju , Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: Re: [PATCH v2] usb: cdns3: change place of NULL check in cdns3_gadget_ep_enable() Message-ID: References: <16589929667170@kroah.com> <20220728163014.247082-1-strochuk@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220728163014.247082-1-strochuk@ispras.ru> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 28, 2022 at 07:30:14PM +0300, Andrey Strachuk wrote: > If 'ep' is NULL, result of ep_to_cdns3_ep(ep) is invalid and > priv_ep->cdns3_dev causes panic. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Signed-off-by: Andrey Strachuk > Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") > --- > drivers/usb/cdns3/cdns3-gadget.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) No information on what changed from v1 to v2 :( > > diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c > index 5c15c48952a6..51de7457a3b8 100644 > --- a/drivers/usb/cdns3/cdns3-gadget.c > +++ b/drivers/usb/cdns3/cdns3-gadget.c > @@ -2284,11 +2284,14 @@ static int cdns3_gadget_ep_enable(struct usb_ep *ep, > int ret = 0; > int val; > > + if (!ep) > + return -EINVAL; How can ep ever be NULL at all? Why does this need to be checked? thanks, greg k-h