All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: sysfs input of wq incorrect wq type should return error
@ 2020-02-19 17:24 Dave Jiang
  2020-02-24 16:32 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jiang @ 2020-02-19 17:24 UTC (permalink / raw)
  To: vkoul; +Cc: dmaengine, jerry.t.chen, yixin.zhang

Currently when inputing an unrecognized wq type, we set the wq type to
"none". It really should return error and not change the existing wq type
that's in the kernel.

Fixes: c52ca478233c ("dmaengine: idxd: add configuration component of driver")
Reported-by: Yixin Zhang <yixin.zhang@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/dma/idxd/sysfs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
index edbfe83325eb..b4a7885e79ed 100644
--- a/drivers/dma/idxd/sysfs.c
+++ b/drivers/dma/idxd/sysfs.c
@@ -1002,12 +1002,14 @@ static ssize_t wq_type_store(struct device *dev,
 		return -EPERM;
 
 	old_type = wq->type;
-	if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_KERNEL]))
+	if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_NONE]))
+		wq->type = IDXD_WQT_NONE;
+	else if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_KERNEL]))
 		wq->type = IDXD_WQT_KERNEL;
 	else if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_USER]))
 		wq->type = IDXD_WQT_USER;
 	else
-		wq->type = IDXD_WQT_NONE;
+		return -EINVAL;
 
 	/* If we are changing queue type, clear the name */
 	if (wq->type != old_type)


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

* Re: [PATCH] dmaengine: idxd: sysfs input of wq incorrect wq type should return error
  2020-02-19 17:24 [PATCH] dmaengine: idxd: sysfs input of wq incorrect wq type should return error Dave Jiang
@ 2020-02-24 16:32 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2020-02-24 16:32 UTC (permalink / raw)
  To: Dave Jiang; +Cc: dmaengine, jerry.t.chen, yixin.zhang

On 19-02-20, 10:24, Dave Jiang wrote:
> Currently when inputing an unrecognized wq type, we set the wq type to
> "none". It really should return error and not change the existing wq type
> that's in the kernel.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2020-02-24 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-19 17:24 [PATCH] dmaengine: idxd: sysfs input of wq incorrect wq type should return error Dave Jiang
2020-02-24 16:32 ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.