Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2366727pxb; Wed, 9 Feb 2022 17:21:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzG7OYuRhW103POYqUKzoXpUEzLHjI0aPja5a6UBJaeMuq5zZeokQfaSAaycajkGgA+LfBg X-Received: by 2002:a63:fa41:: with SMTP id g1mr4233797pgk.224.1644456070289; Wed, 09 Feb 2022 17:21:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644456070; cv=none; d=google.com; s=arc-20160816; b=LWkGCgVyCCYxeN9snfXTs+7Oh74N6CEEd9Lrdel/aGDQmmV6JVr1HHuiypaWmWHArc K+HsEeWyHIc6+86F++fY0dT/2GcPYubIJBQiS47SH5s4JxG3+y11nTzXNwfj/MOEQURp 5KEB++U69Gxur53YmDxSr0u++IVTxM1JSHqEHyNa0rnGt/RlOfnnc7uUCxxC95+iHpx/ bEf2VlnHug/0L4mxsNfJfiFnPYW7zVEpNoLRo588FV9p1tokF+7PsC9NcIIMsQCktYOT nmB0vo6De5943khaP2WYniKPdeqw65QoIOGFaBczBSi3cnC8D0KxrwpgIWGQQOOd+AFO vVyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=/eZu4VgpxDKh5XJ3dKu047n8NPkm87kAT3Lzlug/6LU=; b=QkJh5dHpn3FGUvHruHoZMy9hv08Moo0O8UkDAFnwINS+bE8awxMVkwAXHlD8pTuSES KX6mWjj1+dRlFf6t5ZpsSM4l54VTxXLzzf8PYKCoZKpGu9iJaS4N3wnSp/b13hRTbkAg frgaop8b6VHnrUTGFi1TrmGvho5H7+zDAq938srZGOfOrpBNAuGylHVMW0cYdRftISSG EZ4/qDLn50RHrbls/D1SWo1rSm82RdUi3TaHgthxJ2ImJoAeVxxmxsMmL5ol9F475GNy 2OmDbVHVzlUKuTjLuQxUDTH/J9Ce9Y0JbsN28GzYNGoL+LbSzGJ22zUxYR/4EAXSZwWy mxxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j32si17239558pgb.452.2022.02.09.17.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 17:21:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 72AEB1EC52; Wed, 9 Feb 2022 17:20:56 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230400AbiBJBU0 (ORCPT + 99 others); Wed, 9 Feb 2022 20:20:26 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:36226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiBJBUV (ORCPT ); Wed, 9 Feb 2022 20:20:21 -0500 Received: from nksmu.kylinos.cn (mailgw.kylinos.cn [123.150.8.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42C92E84; Wed, 9 Feb 2022 17:20:18 -0800 (PST) X-UUID: f752996293804c03af1205c5fae73d9a-20220210 X-CPASD-INFO: 10bbcf6a07a64175b9b2a3889822b914@eoCcgpCYZJFcV6OCg3SCb4JqkmKRX1i He3JSYpBpXVSVhH5xTWJsXVKBfG5QZWNdYVN_eGpQYl9gZFB5i3-XblBgXoZgUZB3gHKcgpOUZg== X-CPASD-FEATURE: 0.0 X-CLOUD-ID: 10bbcf6a07a64175b9b2a3889822b914 X-CPASD-SUMMARY: SIP:-1,APTIP:-2.0,KEY:0.0,FROMBLOCK:1,EXT:0.0,OB:0.0,URL:-5,T VAL:133.0,ESV:0.0,ECOM:-5.0,ML:0.0,FD:0.0,CUTS:151.0,IP:-2.0,MAL:0.0,ATTNUM:0 .0,PHF:-5.0,PHC:-5.0,SPF:4.0,EDMS:-3,IPLABEL:4480.0,FROMTO:0,AD:0,FFOB:0.0,CF OB:0.0,SPC:0.0,SIG:-5,AUF:15,DUF:32547,ACD:190,DCD:292,SL:0,AG:0,CFC:0.522,CF SR:0.063,UAT:0,RAF:2,VERSION:2.3.4 X-CPASD-ID: f752996293804c03af1205c5fae73d9a-20220210 X-CPASD-BLOCK: 1000 X-CPASD-STAGE: 1, 1 X-UUID: f752996293804c03af1205c5fae73d9a-20220210 X-User: xiehongyu1@kylinos.cn Received: from [172.20.4.10] [(116.128.244.169)] by nksmu.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES128-GCM-SHA256 128/128) with ESMTP id 1501960626; Thu, 10 Feb 2022 09:17:13 +0800 Message-ID: <59231732-82a3-3a0c-db0c-eec252b35d3b@kylinos.cn> Date: Thu, 10 Feb 2022 09:04:40 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH -next v2] xhci: fix two places when dealing with return value of function xhci_check_args Content-Language: en-US To: Mathias Nyman , Hongyu Xie , gregkh@linuxfoundation.org, mathias.nyman@intel.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20220209025234.25230-1-xy521521@gmail.com> <89d59749-8ca3-b30b-4da6-a6e567528d1b@linux.intel.com> From: =?UTF-8?B?6LCi5rOT5a6H?= In-Reply-To: <89d59749-8ca3-b30b-4da6-a6e567528d1b@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi, On 2022/2/9 17:29, Mathias Nyman wrote: > On 9.2.2022 4.52, Hongyu Xie wrote: >> From: Hongyu Xie >> >> xhci_check_args returns 4 types of value, -ENODEV, -EINVAL, 1 and 0. >> xhci_urb_enqueue and xhci_check_streams_endpoint return -EINVAL if >> the return value of xhci_check_args <= 0. >> This will cause a problem. >> For example, r8152_submit_rx calling usb_submit_urb in >> drivers/net/usb/r8152.c. >> r8152_submit_rx will never get -ENODEV after submiting an urb >> when xHC is halted, >> because xhci_urb_enqueue returns -EINVAL in the very beginning. >> >> Fixes: 203a86613fb3 ("xhci: Avoid NULL pointer deref when host dies.") >> Cc: stable@vger.kernel.org >> Signed-off-by: Hongyu Xie >> --- > Thanks, added to queue. > Changed the commit message and header a bit: > > "xhci: Prevent futile URB re-submissions due to incorrect return value. > > The -ENODEV return value from xhci_check_args() is incorrectly changed > to -EINVAL in a couple places before propagated further. > > xhci_check_args() returns 4 types of value, -ENODEV, -EINVAL, 1 and 0. > xhci_urb_enqueue and xhci_check_streams_endpoint return -EINVAL if > the return value of xhci_check_args <= 0. > This causes problems for example r8152_submit_rx, calling usb_submit_urb > in drivers/net/usb/r8152.c. > r8152_submit_rx will never get -ENODEV after submiting an urb when xHC > is halted because xhci_urb_enqueue returns -EINVAL in the very beginning." > > Let me know if you disagree with this. > > Thanks > -Mathias Sounds good to me. Do I have to send another patch with commit message and header changed? Thanks Hongyu Xie