Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp613891pxb; Fri, 16 Apr 2021 13:43:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXqamCSz1F5CORUG0A234gpwCGDu0R70ItcT/Yd1RoTxtwR+2Aq8JlWAypZo7GvMovqva6 X-Received: by 2002:a05:6402:1ad9:: with SMTP id ba25mr12195582edb.264.1618605811214; Fri, 16 Apr 2021 13:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618605811; cv=none; d=google.com; s=arc-20160816; b=ZJ01YQjmZPWt/E6O/pUKwLnfDmkx4NlFU1cvsrPA6pdNGjIHNCiP5+/q/bSOD6CmQ9 lfAMZcz4dL+vg0UGgo9POKyQxutK3iZJrI1vPHdP9jwl065OoHaylUgLRD1ud/5pa8wM jnWfovE8jz8IX1Librbi1rI5FagjKKhq2WCys3nl7e1AFGM5G1C7+T7VepFdqDeo8wmG tZXokFGNQv6FMdZ9kpmmu3rizep7qkRunMkceqKZD8v03a8OCQ336PcUCpg78MATzUDO 84SVXIn8TTAaqfgHpQYQVc2V9y/h87sKC17COX2un1AEYz2uJRTYZ8SYNZrL3T4oAhma 65wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=kMEUUK1bv7IB8scsKrDONs+9O6OWeN2kQhE0txvYmRY=; b=ttGwjmFNtao7v/Y9DEVp/jRI5AECtj4kyvH9ZJMl8nclp6Dh/yne6CYkDfBu72w2aB Z+KfxhBue1sy3/91tQBI/4V3MuW3CKDGLy+69fj87GZ81aRAtv1Q16qAXqpq18z3tpgI DNOLF4GosagNZyh5Ax/D6/iH0jWkNbkP7xy8SIEP8/fovrrpabhIImNrP5zImQVqsMnY vXMq4o9P9mTMJoWFeZdSWpeAjpJzCevmTfi1EGXdd3pyCAW9OzO89es/4+ldlKI09RTF ZU26VTykEH2DXP5bmRKj1NT4W0i89HBYX3bFtlvLVAd7VyD8J/M5jUlFNTSrZd27YDo5 /GZg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j16si2531686edj.357.2021.04.16.13.43.08; Fri, 16 Apr 2021 13:43:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243509AbhDPRqa (ORCPT + 99 others); Fri, 16 Apr 2021 13:46:30 -0400 Received: from netrider.rowland.org ([192.131.102.5]:36825 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S235877AbhDPRqa (ORCPT ); Fri, 16 Apr 2021 13:46:30 -0400 Received: (qmail 48215 invoked by uid 1000); 16 Apr 2021 13:46:04 -0400 Date: Fri, 16 Apr 2021 13:46:04 -0400 From: Alan Stern To: Anirudh Rayabharam Cc: Dmitry Vyukov , syzbot , Andrey Konovalov , Felipe Balbi , Dan Carpenter , Greg Kroah-Hartman , LKML , USB list , syzkaller-bugs Subject: Re: [syzbot] general protection fault in gadget_setup Message-ID: <20210416174604.GA47856@rowland.harvard.edu> References: <00000000000075c58405bfd6228c@google.com> <20210413161311.GC1454681@rowland.harvard.edu> <20210416152734.GB42403@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 16, 2021 at 10:35:20PM +0530, Anirudh Rayabharam wrote: > On Fri, Apr 16, 2021 at 11:27:34AM -0400, Alan Stern wrote: > > Actually, I wanted to move this emulation code into a new subroutine and > > then call that subroutine from _both_ places. Would you like to write > > Does it really need to be called from both places? You know, I was going to say Yes, but now I think you're right; it's not needed in dummy_udc_stop. This is because core.c always calls usb_gadget_disconnect before usb_gadget_udc_stop. And we can rely on this behavior; it's obviously necessary to disconnect from the host before stopping the UDC driver. On the other hand, while checking that fact I noticed that soft_connect_store in core.c doesn't call synchronize_irq in between the other two, the way usb_gadget_remove_driver does. That seems like a bug -- if it's necessary to synchronize with the IRQ handler on one path, it should be necessary on the other path as well. But that's a matter for a separate patch. Alan Stern > > and submit a patch that does this? > > Sure! I will do that. > > Thanks! > > - Anirudh.