From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E333C433EF for ; Fri, 8 Jul 2022 14:39:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238196AbiGHOjL (ORCPT ); Fri, 8 Jul 2022 10:39:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237847AbiGHOjI (ORCPT ); Fri, 8 Jul 2022 10:39:08 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 2D89E1B7AC for ; Fri, 8 Jul 2022 07:39:07 -0700 (PDT) Received: (qmail 7518 invoked by uid 1000); 8 Jul 2022 10:39:06 -0400 Date: Fri, 8 Jul 2022 10:39:06 -0400 From: Alan Stern To: Jozef Martiniak Cc: Felipe Balbi , Greg Kroah-Hartman , Jens Axboe , Hangyu Hua , "Darrick J. Wong" , Wei Ming Chen , Ingo Molnar , Randy Dunlap , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] gadgetfs: ep_io - wait until IRQ finishes Message-ID: References: <20220708070645.6130-1-jomajm@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220708070645.6130-1-jomajm@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 08, 2022 at 09:06:44AM +0200, Jozef Martiniak wrote: > after usb_ep_queue() if wait_for_completion_interruptible() is > interrupted we need to wait until IRQ gets finished. This should say "request" or "I/O request", not "IRQ". Not a big deal. > > Otherwise complete() from epio_complete() can corrupt stack. > > Signed-off-by: Jozef Martiniak > --- Acked-by: Alan Stern > drivers/usb/gadget/legacy/inode.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c > index 79990597c39f..01c3ead7d1b4 100644 > --- a/drivers/usb/gadget/legacy/inode.c > +++ b/drivers/usb/gadget/legacy/inode.c > @@ -362,6 +362,7 @@ ep_io (struct ep_data *epdata, void *buf, unsigned len) > spin_unlock_irq (&epdata->dev->lock); > > DBG (epdata->dev, "endpoint gone\n"); > + wait_for_completion(&done); > epdata->status = -ENODEV; > } > } > -- > 2.25.1 >