Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3353204rwa; Tue, 23 Aug 2022 03:25:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR6e9p3g24V/oCUWULulDklwaAqf1BqxyQz/u9kBX18Wnus9FKqz9taC3/i6locUXTdyB6Pv X-Received: by 2002:a17:907:6e17:b0:73d:8d0a:f450 with SMTP id sd23-20020a1709076e1700b0073d8d0af450mr4218834ejc.452.1661250306206; Tue, 23 Aug 2022 03:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661250306; cv=none; d=google.com; s=arc-20160816; b=A9X9YfMPz+3t/h1To1aUI0bq6a2iThShwFJPCP/AzvdJCpSkBYqWOrsYPv5zrTOjOs mBnWjUyoXycNHjhxh/gUx+sVCj5w/IBHJyWe0so/I3a2iLouin3mpEyqTk690CNDqY3g QwrrhtrDcLyTyha63Y178GkrFZjYIxCoSvSgPdTpepWEjNy7yEGdaFGhlaS53JTsWCRG EIsRAZ5LXeovsrdaLv4W1Oq+ItB8XDiTGHwryRE6ajfzhxCCEKAVZnC/gusDxdOq5chg qjkRESYzxyjam/+Fu0MImn8tuJ5ZiA2Ckp2kio3gNEQG9knCvd2AiJqQG0j6kuDiA7er yLOw== 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=xGNT5zj+GF8IEFAN3zNbkvuZvkVVPMpHblwTfUPxpSk=; b=hyocmPSlwIhXvJoAME8FuhhP3FDmKD+lSQozRc2TP8X2acLkuMK+4PyluAy4nVgk9S 6IdsvvWWthLcdKA5yhSOM7QBPFIxG1HVDMsgfjL3fGCtuUTwT+GKNkHJXhHeNysYsjH+ vO1H75dtp9HFYO3LHNlHBqnSirMB8V4Ndt7W9iSAmUl9HCj7qXOGPMZE2/ax6QRS1va/ 14UR+3BdXJNYD1CphPJkI54vyWjSqT7NaKWuoO8lGpE55B/73lthpUf4UHfIqS4zAiWO YCum9eMLlR7ONg9fiM1oRzWGD01y0HrhGjHb6HgzY+HxQweiSamTuFvP+QHQLfBbJPSk slRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HVHvHTDw; 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 bv14-20020a170906b1ce00b007330c08fe49si10248265ejb.206.2022.08.23.03.24.40; Tue, 23 Aug 2022 03:25:06 -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=HVHvHTDw; 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 S1354589AbiHWKVr (ORCPT + 99 others); Tue, 23 Aug 2022 06:21:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352555AbiHWKJk (ORCPT ); Tue, 23 Aug 2022 06:09:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 013C37DF6C; Tue, 23 Aug 2022 01:55:49 -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 924C16155E; Tue, 23 Aug 2022 08:55:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9729EC433D6; Tue, 23 Aug 2022 08:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244948; bh=2IANWfcDXn8gdk1Z4gv51ItWI+UvkHS6CpqklXgJFeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HVHvHTDwPpUwJrQeq0MmZbPc9f+4Zz0GEzkb1MsrIAIl/QNh/wIYMeVUkrn6gZZPo GrWdhDRCNq15ibtqiI6XwCqrUHF8nZxexW0DO8sSUZHwDO1A6a9OOWlowbW5le61XR trEuAW2Sbl+1L1kZtMefQmc0fBUZLL9XMZNnupc0= 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.14 216/229] gadgetfs: ep_io - wait until IRQ finishes Date: Tue, 23 Aug 2022 10:26:17 +0200 Message-Id: <20220823080101.366251007@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 53d17e1bb65a..f0f41cc8b2f1 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c @@ -365,6 +365,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