dmaengine: idxd: move out percpu_ref_exit() to ensure it's outside submission
authorDave Jiang <dave.jiang@intel.com>
Wed, 29 Sep 2021 19:15:38 +0000 (12:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:59 +0000 (19:16 +0100)
commit46a2f79455532910be40eb171f1b1fc3676847ea
tree06d28437bbd31f5af28b41b4b7be7f29ace82d8f
parentc31b0fe8e116354cbfbea52e49a29095f42ec9bd
dmaengine: idxd: move out percpu_ref_exit() to ensure it's outside submission

[ Upstream commit 85f604af9c83a4656b1d07bec73298c3ba7d7c1e ]

percpu_ref_tryget_live() is safe to call as long as ref is between init and
exit according to the function comment. Move percpu_ref_exit() so it is
called after the dma channel is no longer valid to ensure this holds true.

Fixes: 93a40a6d7428 ("dmaengine: idxd: add percpu_ref to descriptor submission path")
Suggested-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/163294293832.914350.10326422026738506152.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/dma/idxd/device.c
drivers/dma/idxd/dma.c