Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3407840rwa; Tue, 23 Aug 2022 04:23:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR7RK3M10sozJareAZ0n5hi/lpuE9rd6XlMU7khE1yoal4Wz4WEtuCALsO6yKr6e/Mt0CIwV X-Received: by 2002:a17:90b:3ec9:b0:1f5:62d5:4157 with SMTP id rm9-20020a17090b3ec900b001f562d54157mr2787791pjb.183.1661253816340; Tue, 23 Aug 2022 04:23:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253816; cv=none; d=google.com; s=arc-20160816; b=N1bqHOUsiqorfFb3Yx0dRKVarUZ5JS55e921VqUsnUIHoheFe9xmaTccYR/43yPZXR 0llzwiC5VvhnE9Mb8jKKTYZGSp1mvGIupPTNtkQ8CZ7g9uAhPQ4OG1E2b8E+ZCaxvDmp Hk12GQVRq3KYJs1JqxFv06CSN6ZWMudd66A2BiDH8Ge6nTHCNhYrJ58jfHUkpENBK04E 8TX/5/C774Ze2W8H1mIE1fgRcKLVckD8Jx91h8Zq0m2xTf56Fmpf00nFWGMD81bsNKEr TtiRFoquTTDNNyaIzFkycGbJ5fjqqQcydbpgipMWahysAvVE2yOAB2GmEXM52nlRWaaX SSnQ== 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=NM8+y61Up8I6IXWUTGn1lNu1uDCyC8z5tpe5kmx+bjQ=; b=F5Y4anqLYlcYaFgNKyA0LwhFnqjdM1Qz4mAqmuTvycocJZL5zk7BMlJ/NaYMJCAr/l xXJmqrwnCj9AUd1qCjEVvwy8fZr1DV7RaJ1eQEf2XcqCPWIpnDAdaJR5hy13pYcWOOaN LBaglDlrjlvZ2gzw0BzT4d/SfAHCK3XhhYrQxPgNoUHJbuQDeqQn0qmizkRh0Hqe9n84 F+nKiC4848ogk55sQeh+QyLZXkm62O21+LJSRuWlmb1ldZHI8Yl+/zghvUcnjNL34VpW 9teerrPhbECRzy6tFEPYn7+k2Bl6siNPgeM8+j1xeP327OPuwzyKpduqqBWzWDSn1qy+ 7ukQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RXsXeRIZ; 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 y71-20020a638a4a000000b0042af7ef1bf4si929390pgd.569.2022.08.23.04.23.25; Tue, 23 Aug 2022 04:23:36 -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=RXsXeRIZ; 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 S1355115AbiHWKWy (ORCPT + 99 others); Tue, 23 Aug 2022 06:22:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353311AbiHWKLO (ORCPT ); Tue, 23 Aug 2022 06:11:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECA9B7EFEB; Tue, 23 Aug 2022 01:56:29 -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 ams.source.kernel.org (Postfix) with ESMTPS id 9C4BFB81C28; Tue, 23 Aug 2022 08:56:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09A33C433C1; Tue, 23 Aug 2022 08:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244987; bh=QwleLkPpMUtNrPJ2hpugjtXEVqvUzO1wsjJ02z4FvRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RXsXeRIZgZhEXRBysTa7xXGvHMbCgbzJaLU2Z9IWAK0LN/XnI4v/cGSng7U/6rlT9 K6iIeqLkFatlygsDbE77XGDRuCx072DZtT0gu2tpy35EycfPma7T0vLqm6lvat4/l/ iHfptDfgOstOsnCsgG5EXBsCcRmC5YWO4hJeMnZc= 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.15 184/244] gadgetfs: ep_io - wait until IRQ finishes Date: Tue, 23 Aug 2022 10:25:43 +0200 Message-Id: <20220823080105.481741365@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@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 3279b4767424..9e8b678f0548 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