Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3319016rwa; Tue, 23 Aug 2022 02:44:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR6NOHSOVftBeV9RsiTVAJt/fqT6IY/mT0vALkR4U4GKpYB4SvPwF/OQmYsKlpGzwrPzc/cd X-Received: by 2002:a65:49c8:0:b0:415:e89d:ea1a with SMTP id t8-20020a6549c8000000b00415e89dea1amr19992533pgs.266.1661247865957; Tue, 23 Aug 2022 02:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661247865; cv=none; d=google.com; s=arc-20160816; b=t8Zsn1kl+dmikkpHATEBWT9/320eLygDK5Biu0wuP9V7BNoAv7TXqEK7dMn3xB7jsl HskUOxc3E75A2WHG6PdaL0NRmYGWopYpSOj48pkx6+Lc9eCyBbC5mFGWybSRwTa2In/n dcOET90jRd79V2+r4bTrEnjQ40JYsp8sjt6iA8lEzugnFlasKu284xcsmxPDFRGJkE8m VvlXFvCnHgPJOsXqSqyUvR6T5oeuQLErpbzxN5uP3dxfHHTZwj4IHqjGQiObNrnBDNjg mmLXPsiyXPBW2lLq1YqexqdHfP/mpRovHrsdawCBq03gg+WPIRWqtZ2Nc3y5kJu8lRXI Tw2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d7ymiMHJpta3CYeTwVkLJBjPIfiSHtFIwc9Kkj7XaYQ=; b=fMHzYMG5tHk1nFgmBn0UQDxU5zu9C+6upTkpnBojV7b7WSEA1N5ZosHlNGgCZUXRRB 0L/AQ8636Eh5YG7PHdWHTfywMe/dk1OM0m65HJHYBtRRXDuv9NRJrP4kaJDfSLJhVB0n MHS/BG1HaaL2PAW1H1h+ZAYOI3jxaGoBqDJgv+lvoLRXsuZ7prtjCuJna6R9P5Zd2ifk usMXjF2xHd6tt+MGz08+nRJlGZNpkKHJ9bE1BYA0RGFu0HVsxz6ClZN8G/qQ8z+pxchX 77V7J+k9n5qyGrOl3V5tWuFK4uAh1w2E4la7iraGtCTDbN8gZcY6UploYlgvGgseEp11 oyBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="d9j/R096"; 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 na8-20020a17090b4c0800b001f537a6e47csi2931274pjb.7.2022.08.23.02.44.15; Tue, 23 Aug 2022 02:44: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="d9j/R096"; 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 S1348726AbiHWJMe (ORCPT + 99 others); Tue, 23 Aug 2022 05:12:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348468AbiHWJKU (ORCPT ); Tue, 23 Aug 2022 05:10:20 -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 45A096CD3B; Tue, 23 Aug 2022 01:31:07 -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 EB5BB614CA; Tue, 23 Aug 2022 08:31:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6231C433C1; Tue, 23 Aug 2022 08:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243466; bh=QT4ELwD36/p5x2JGWEwyso4qQpwPkC03HMsNuMjrIMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d9j/R096LBHlVT9fh0kKf23cZ/08mLAjxoTnPw1pRAB4dQMHgMhceH3j4P/HbMjJT NFmMH8KWDLPE5LeHu9W5O4G2LZ/90axBrY9mbnMvUljTFz7jfqm2PDVOfCaL0wksdJ Z1ebGvJSviS7mM9eHG5WWHzLe/JBYHumShkJaC1M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jozef Martiniak , Sasha Levin Subject: [PATCH 5.19 286/365] gadgetfs: ep_io - wait until IRQ finishes Date: Tue, 23 Aug 2022 10:03:07 +0200 Message-Id: <20220823080130.159590630@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 From: Jozef Martiniak [ Upstream commit 04cb742d4d8f30dc2e83b46ac317eec09191c68e ] after usb_ep_queue() if wait_for_completion_interruptible() is interrupted we need to wait until IRQ gets finished. Otherwise complete() from epio_complete() can corrupt stack. Signed-off-by: Jozef Martiniak Link: https://lore.kernel.org/r/20220708070645.6130-1-jomajm@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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.35.1