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 805FEC25B08 for ; Sun, 14 Aug 2022 15:53:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241930AbiHNPwz (ORCPT ); Sun, 14 Aug 2022 11:52:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241880AbiHNPub (ORCPT ); Sun, 14 Aug 2022 11:50:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96CF215838; Sun, 14 Aug 2022 08:35:52 -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 32C5760DB7; Sun, 14 Aug 2022 15:35:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BBD6C433D6; Sun, 14 Aug 2022 15:35:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660491351; bh=8Wq8TnX6A7t44+dksAy9+VlmKZqLfFoW9QkcGmVh7ps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTQJe7HbeGfLq+IE4k0zTs0tcnGXJzVvfDLFF/l4pOr7dXBv1T5rcx/+82wUiJ+yI nNY5Tbn+W8V2QBufSohWeoURmVeTK3C8XcvTecV/y76b+a/cT0st/Jq0iTPVGu4hoh sdoYVfpaYNs29cAcC4duJ6khHpCs/39Y/6PGSAwmWhRE5mRWqPr4+lUNOYhS5hIA+e etDQHxaenUJC376lak25tM+ULl+alqrgacKJdzZ5T6eZX5iW5CqE8F8kV+AyGWbOMZ X11dr9XGZIH5IMvvzLKq6NaCVEz453cBaxr/CUpuo6pXSgCHekihph/+Cz3f2jgXq6 bPUPggd23EAWQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jozef Martiniak , Greg Kroah-Hartman , Sasha Levin , balbi@kernel.org, stern@rowland.harvard.edu, hbh25y@gmail.com, axboe@kernel.dk, rdunlap@infradead.org, mingo@kernel.org, linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 11/21] gadgetfs: ep_io - wait until IRQ finishes Date: Sun, 14 Aug 2022 11:35:21 -0400 Message-Id: <20220814153531.2379705-11-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814153531.2379705-1-sashal@kernel.org> References: <20220814153531.2379705-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@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 9cd80ad075bd..97c73d610eeb 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