Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3412610rwa; Tue, 23 Aug 2022 04:28:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR7RUUeHJY8nSbt/RtWpytM/qCNP+00Q232mZDSCLtNSra2YSN7d2EN+5ylZqLNGVTHkR5DV X-Received: by 2002:a63:5f49:0:b0:41d:85a1:c4da with SMTP id t70-20020a635f49000000b0041d85a1c4damr20264157pgb.366.1661254130384; Tue, 23 Aug 2022 04:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254130; cv=none; d=google.com; s=arc-20160816; b=W04hvgtUMBqdUjrsY216oCosZgDfO632szazVcI8Z6Yi5E/YYtAIvVuZX361TQ8C5T e7+jePTRuD1uz8efQFKfv7j8HVUzTZOPhwIJYRPA1jaWhLi4sWbLmd2s3WsQTJBhmbxh sjKIVOiDX6Xb3pMXwEYVuas1ae4HDQ6be17QkJlhPaygCHu0YRy4a10yJFXXESBslO0f 1nfrcJFjPulFBpzFAqQfqKyqpTDjQ8YfKui/7WZFu0qpS3XculxkmNFpoVEKMeDrngs6 2oBeGdlUlv5XG3ZyiRaAmA1AtetnRkg1jsGgTm8KCKiqxBXCg77QwKVDS7BPFH9X+tBp wxaA== 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=zBPA4nh6WKjj3N/TpbFzp3B1267R9wq4ktWVYM4bzNs=; b=WD/qnX78bGNuCTTNjvcvnyDJo/+Z1oDCs8jaYjn2koI98go2mSrcArHNk1eZ+Nn8lB gxdqTCT0Rrju45rh4HB6FNq2tnKIRcC5/RImIxtJUMqqSvwdhVePYJTU7viagtxZyb05 w2yRPtB+VSd55zqNjXexFCxEvwcw8ar364F/LI1JKCZ+yCzbTENmATNlW9NfxFfhipzg a6kb181wfRNSnFc7VRqWbGdEsySyRy5FpfgsbDFCq4r74ceINncHNgEfSo9c3069ZAeX jNPwtE4pO813FIJIevmQcL+BNGy7+a5+qFiJk+en5LNZ8EIA91hWpyAdbaOvXFWar7Aq QkVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bbdj7+cO; 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 w2-20020a170902e88200b0017271ea0ebfsi17187636plg.142.2022.08.23.04.28.39; Tue, 23 Aug 2022 04:28:50 -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=Bbdj7+cO; 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 S1356809AbiHWK7I (ORCPT + 99 others); Tue, 23 Aug 2022 06:59:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356285AbiHWK5a (ORCPT ); Tue, 23 Aug 2022 06:57:30 -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 92A9683F1C; Tue, 23 Aug 2022 02:13:44 -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 766DD61224; Tue, 23 Aug 2022 09:13:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64C44C433D6; Tue, 23 Aug 2022 09:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661246022; bh=VNknJr8nYr0dzeiUWFTgY649fGVvL9DKEOfXsU2hyI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bbdj7+cOzWrZDYvlnYOf2o3TExgZk4ytRjhzf2/qIvQQ2L6kPiTKpkZAC0XGvDS1N g+YMnSJPO8CRpDMikHGcbRVdj1yAp6w5VKk8pRrtYffna8PmvxTCHOIYqCfsKavEW3 uGWu2eYEWQIfpI2GJinWoxU9dI4Pe8ZY+WEc/1Wc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jozef Martiniak , Sasha Levin Subject: [PATCH 4.19 264/287] gadgetfs: ep_io - wait until IRQ finishes Date: Tue, 23 Aug 2022 10:27:13 +0200 Message-Id: <20220823080110.216375674@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 3ebcbd199a79..b0a2b8805f41 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c @@ -361,6 +361,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