diff mbox series

dmaengine: idxd: fix wq size store permission state

Message ID 161782558755.107710.18138252584838406025.stgit@djiang5-desk3.ch.intel.com (mailing list archive)
State Accepted
Headers show
Series dmaengine: idxd: fix wq size store permission state | expand

Commit Message

Dave Jiang April 7, 2021, 7:59 p.m. UTC
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: c52ca478233c ("dmaengine: idxd: add configuration component of driver")
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/dma/idxd/sysfs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vinod Koul April 12, 2021, 9:16 a.m. UTC | #1
On 07-04-21, 12:59, Dave Jiang wrote:
> 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.

Applied, thanks
diff mbox series

Patch

diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
index f08d45f4570e..581ce56ae4f5 100644
--- a/drivers/dma/idxd/sysfs.c
+++ b/drivers/dma/idxd/sysfs.c
@@ -889,7 +889,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)