Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1477974rwd; Thu, 18 May 2023 12:30:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7oslQNMzFbUgV/eG9/c38VKb8I/V16Av9Frl/xraLrl9MGWmPeUT7wT7Drp65G3c/JZdIT X-Received: by 2002:a05:6a00:1308:b0:648:1311:fbc4 with SMTP id j8-20020a056a00130800b006481311fbc4mr5938185pfu.33.1684438258506; Thu, 18 May 2023 12:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684438258; cv=none; d=google.com; s=arc-20160816; b=t3NGFNo/kbq0zLZ637aGxv/Me8saDqXmJQZkR/C3JDElYQKvi73bwcrE2R8ZTfoSNN KStvYUIysHrF78XF09AAKRIjcDdZpatVfq2ijB5NtQPZg7ggwrQHQqpT4J9UOLMz8p+h 9rk8oAqA6dKEag6WG9Dsm5UojcY8YiBGgBMaZGdDVwNJzeTiKvnkwvt4DWy3bFQpPI3S G5NB1w7ymb3xKKnl/V1RbsI5el8sLAFaE8GFaKWHjEeYUPvShbzBeAro4in8x5Ms9KdW LXgcpfJcvKuQw+AzDuoFJEjVSo7Xyxgn9Vii+91i30TVY0CA5ZXfUJ0cPKWz3Mmy4ISU lkjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:ui-outboundreport :in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:dkim-signature; bh=2XrcEV1AmD/1Hiz1jXbp9RYYJH8FHt4BovglG910gdk=; b=GRVyMqP3IO5h/0QzhEWSNB6CbdU6/NuAm91qrvPlduWyohviz5bQtzro28ECY8HdDb HcCG1M9Y0Bdy6iFfUCVc2mYMcXfcpc9zP4RRtk9TEkYzmhB5GNBcCKE1pCW4tq0UBxSe WMhbCNmxxtb8CsatgS27xcV+6Qvbu+q85lxafMEdZimzjZ6DNKQ7ceWpo402uR2GrwGW VTNPJfwiejB2izoEByC157fvausn6UO7mGpEtM0ISaCkDm9mGQ3smORofPF2k/e708Q8 OeitzCCi1zcILJPYFcGZw3rIOI/+c4BKU3g2T6c5qseRj/HN0+0RVLCyeKPNzZPyOUEC Miwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b="GW3ynz/D"; 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=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 139-20020a630091000000b005346b80d198si2079145pga.517.2023.05.18.12.30.45; Thu, 18 May 2023 12:30:58 -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=@gmx.de header.s=s31663417 header.b="GW3ynz/D"; 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=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230186AbjERTGZ (ORCPT + 99 others); Thu, 18 May 2023 15:06:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbjERTGX (ORCPT ); Thu, 18 May 2023 15:06:23 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0959FCA; Thu, 18 May 2023 12:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1684436774; i=deller@gmx.de; bh=pBy6GELUpzGIiCShn/8+5zqDsJlsfeiFiD+3uO8JbY4=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=GW3ynz/DbLLzEQGUdqVylIi+hc3P+CxSdGHqGnRDPIU7MUlCu/VYRt2psVDzp7v3c EIknENG18my1GD9v4SzuuZnfDmmijFT4QR9k5SkfFqWEuWhpk9YR9xuo13dlDDKAVn Jx6V9JdZxNAhmhw6eL2zL/REpW3MT4D3dVbLraqoiqKDCqbursJ+/Tgi/6KiwNtgBv +Nw3c8FozrBE1ql2uybHnSzCHIBgEEb1PY4QBWFl1cbJCgbnuLDB7AdDjBkyrip8tC W3G8wJcIzwVwgcbHkWv0HHG756lTimjCJ8oJ2fUo+EbC/2xSubh+wvD296U4hlGT2x OllpUAsKCYchw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from ls3530 ([94.134.154.30]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N0XD2-1qKfeU2SEG-00wZAK; Thu, 18 May 2023 21:06:14 +0200 Date: Thu, 18 May 2023 21:06:12 +0200 From: Helge Deller To: Alan Stern , linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: syzbot , bernie@plugable.com, linux-usb@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [fbdev?] [usb?] WARNING in dlfb_submit_urb/usb_submit_urb (2) Message-ID: References: <0000000000004a222005fbf00461@google.com> <4cd17511-2b60-4c37-baf3-c477cf6d1761@rowland.harvard.edu> <2905a85f-4a3b-4a4f-b8fb-a4d037d6c591@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2905a85f-4a3b-4a4f-b8fb-a4d037d6c591@rowland.harvard.edu> X-Provags-ID: V03:K1:Q3nIu3LTT7sasw5uCAZngX5+JzZttsCCWf+9S/T/gP2tfMnOCUW Bwp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c4aOnQY72I r1nQ1XFoPVsuQaESOIXn46IOfbu8oB1Z1QNmuDF3ZRRRQ9ZWmtKmiCoDvfk4LRj+SR5Qn4wIJ WJNz/xyp7ysdprpKDGXkPz4pgSw= Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,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 * Alan Stern : > On Thu, May 18, 2023 at 04:16:33PM +0200, Helge Deller wrote: > > On 5/18/23 15:54, Alan Stern wrote: > > > On Thu, May 18, 2023 at 09:34:24AM +0200, Helge Deller wrote: > > > > I think this is an informational warning from the USB stack, > > > > > > It is not informational. It is a warning that the caller has a bug. > > > > I'm not a USB expert, so I searched for such bug reports, and it seems > > people sometimes faced this warning with different USB devices. > > Yes. > > > > You can't fix a bug by changing the line that reports it from dev_WA= RN > > > to printk! > > > > Of course this patch wasn't intended as "fix". > > It was intended to see how the udlfb driver behaves in this situation,= e.g. > > if the driver then crashes afterwards. > > > > Furthermore, why does usb_submit_urb() prints this WARNING and then co= ntinues? > > If it's a real bug, why doesn't it returns an error instead? > > So, in principle I still think this warning is kind of informational, > > which of course points to some kind of problem which should be fixed. > > Depending on the situation, the bug may or may not lead to an error. At > the time the dev_WARN was added, we were less careful about these sorts > of checks; I did not want to cause previously working devices to stop > working by failing the URB submission. Fair enough. > > > In this case it looks like dlfb_usb_probe() or one of the routines i= t > > > calls is wrong; it assumes that an endpoint has the expected type > > > without checking. More precisely, it thinks an endpoint is BULK whe= n > > > actually it is INTERRUPT. That's what needs to be fixed. > > > > Maybe usb_submit_urb() should return an error so that drivers can > > react on it, instead of adding the same kind of checks to all drivers? > > Feel free to submit a patch doing this. As you wrote above, this may break other drivers too, so I'd leave that discussion & decision to the USB maintainers (like you). > But the checks should be added > in any case; without them the drivers are simply wrong. I pushed the hackish patch below through the syz tests which gives this lo= g: (see https://syzkaller.appspot.com/text?tag=3DCrashLog&x=3D160b7509280000) [ 77.559566][ T9] usb 1-1: Unable to get valid EDID from device/displ= ay [ 77.587021][ T9] WARNING: BOGUS urb xfer, pipe 3 !=3D type 1 (fix dr= iver to choose correct endpoint) [ 77.596448][ T9] usb 1-1: dlfb_urb_completion - nonzero write bulk s= tatus received: -115 [ 77.605308][ T9] usb 1-1: submit urb error: -22 [ 77.613225][ T9] udlfb: probe of 1-1:0.52 failed with error -22 So, basically there is no urgent fix needed for the dlfb fbdev driver, as it will gracefully fail as is (which is correct). What do you suggest we should do with this syzkaller-bug ? I'd rate it as false-alarm, but it will continue to complain because of the dev_WARN() in urb.c Helge =2D-- From: Helge Deller Date: Thu, 18 May 2023 19:03:56 +0200 Subject: [PATCH] fbdev: udlfb: check endpoint type, again Temporary patch to anaylze syzbot regression: https://syzkaller.appspot.com/bug?extid=3D0e22d63dcebb802b9bc8 It's not planned to apply as-is! Fixes: aaf7dbe07385 ("video: fbdev: udlfb: properly check endpoint type") Signed-off-by: Helge Deller diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 9f3c54032556..bb889a1da3ef 100644 =2D-- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c @@ -500,9 +500,12 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) */ /* Check that the pipe's type matches the endpoint's type */ - if (usb_pipe_type_check(urb->dev, urb->pipe)) - dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x !=3D type %x\n", + if (usb_pipe_type_check(urb->dev, urb->pipe)) { + /* temporarily use printk() instead of WARN() to fix bug in udlfb drive= r */ + printk("WARNING: BOGUS urb xfer, pipe %x !=3D type %x (fix driver to ch= oose correct endpoint)\n", usb_pipetype(urb->pipe), pipetypes[xfertype]); + return -EINVAL; + } /* Check against a simple/standard policy */ allowed =3D (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK | diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c index 216d49c9d47e..5e56b2889c8c 100644 =2D-- a/drivers/video/fbdev/udlfb.c +++ b/drivers/video/fbdev/udlfb.c @@ -1667,8 +1667,9 @@ static int dlfb_usb_probe(struct usb_interface *intf= , usb_set_intfdata(intf, dlfb); retval =3D usb_find_common_endpoints(intf->cur_altsetting, NULL, &out, N= ULL, NULL); - if (retval) { - dev_err(&intf->dev, "Device should have at lease 1 bulk endpoint!\n"); + if (retval || out =3D=3D NULL) { + retval =3D -ENODEV; + dev_err(&intf->dev, "Device should have at least one bulk endpoint!\n")= ; goto error; }