From: Dave Jiang Date: Wed, 7 Apr 2021 19:59:47 +0000 (-0700) Subject: dmaengine: idxd: fix wq size store permission state X-Git-Tag: v5.11.16~111 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05b7791c4c4aa8304368fdc55ae911f6b34e7281;p=thirdparty%2Fkernel%2Fstable.git dmaengine: idxd: fix wq size store permission state [ Upstream commit 0fff71c5a311e1264988179f7dcc217fda15fadd ] 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 Link: https://lore.kernel.org/r/161782558755.107710.18138252584838406025.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c index c27ca01cf8b2e..5f7bc4b1621a0 100644 --- a/drivers/dma/idxd/sysfs.c +++ b/drivers/dma/idxd/sysfs.c @@ -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)