Skip to content

Commit

Permalink
dmaengine: idxd: fix wq size store permission state
Browse files Browse the repository at this point in the history
[ Upstream commit 0fff71c ]

WQ size can only be changed when the device is disabled. Current code
allows change when device is enabled but wq is disabled. Change the check
to detect device state.

Fixes: c52ca47 ("dmaengine: idxd: add configuration component of driver")
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/161782558755.107710.18138252584838406025.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
davejiang authored and gregkh committed Apr 21, 2021
1 parent 60673d3 commit 05b7791
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/dma/idxd/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ static ssize_t wq_size_store(struct device *dev,
if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
return -EPERM;

if (wq->state != IDXD_WQ_DISABLED)
if (idxd->state == IDXD_DEV_ENABLED)
return -EPERM;

if (size + total_claimed_wq_size(idxd) - wq->size > idxd->max_wq_size)
Expand Down

0 comments on commit 05b7791

Please sign in to comment.