]> git.itanic.dy.fi Git - linux-stable/commitdiff
dmaengine: idxd: fix wq size store permission state
authorDave Jiang <dave.jiang@intel.com>
Wed, 7 Apr 2021 19:59:47 +0000 (12:59 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Apr 2021 11:00:50 +0000 (13:00 +0200)
[ 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 <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>
drivers/dma/idxd/sysfs.c

index b3ab86ced3550a1a80dda355b1a4e3b78020e6e3..ad46b3c648afefabac43b575b36792c014e9a151 100644 (file)
@@ -923,7 +923,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)