Message ID | 164971493551.2201159.1942042593642155209.stgit@djiang5-desk3.ch.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 66903461ffed0b66fc3e0200082d4e09365aacdc |
Headers | show |
Series | dmaengine: idxd: add RO check for wq max_batch_size write | expand |
On 11-04-22, 15:08, Dave Jiang wrote: > Block wq_max_batch_size_store() when the device is configured as read-only > and not configurable. Applied, thanks > > Fixes: e7184b159dd3 ("dmaengine: idxd: add support for configurable max wq batch size") > Reported-by: Bernice Zhang <bernice.zhang@intel.com> > Tested-by: Bernice Zhang <bernice.zhang@intel.com> > Signed-off-by: Dave Jiang <dave.jiang@intel.com> > --- > drivers/dma/idxd/sysfs.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c > index ec13ca4808f9..dfd549685c46 100644 > --- a/drivers/dma/idxd/sysfs.c > +++ b/drivers/dma/idxd/sysfs.c > @@ -942,6 +942,9 @@ static ssize_t wq_max_batch_size_store(struct device *dev, struct device_attribu > u64 batch_size; > int rc; > > + if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags)) > + return -EPERM; > + > if (wq->state != IDXD_WQ_DISABLED) > return -EPERM; > >
diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c index ec13ca4808f9..dfd549685c46 100644 --- a/drivers/dma/idxd/sysfs.c +++ b/drivers/dma/idxd/sysfs.c @@ -942,6 +942,9 @@ static ssize_t wq_max_batch_size_store(struct device *dev, struct device_attribu u64 batch_size; int rc; + if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags)) + return -EPERM; + if (wq->state != IDXD_WQ_DISABLED) return -EPERM;