dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: add RO check for wq max_batch_size write
@ 2022-04-11 22:08 Dave Jiang
  2022-04-20 11:48 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2022-04-11 22:08 UTC (permalink / raw)
  To: vkoul; +Cc: dmaengine

Block wq_max_batch_size_store() when the device is configured as read-only
and not configurable.

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;
 



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dmaengine: idxd: add RO check for wq max_batch_size write
  2022-04-11 22:08 [PATCH] dmaengine: idxd: add RO check for wq max_batch_size write Dave Jiang
@ 2022-04-20 11:48 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2022-04-20 11:48 UTC (permalink / raw)
  To: Dave Jiang; +Cc: dmaengine

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;
>  
> 

-- 
~Vinod

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-20 11:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 22:08 [PATCH] dmaengine: idxd: add RO check for wq max_batch_size write Dave Jiang
2022-04-20 11:48 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).