DMA Engine development
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Dave Jiang <dave.jiang@intel.com>
Cc: dmaengine@vger.kernel.org
Subject: Re: [PATCH] dmaengine: idxd: fix off by one on cdev dwq refcount
Date: Wed, 11 Mar 2020 15:04:01 +0530	[thread overview]
Message-ID: <20200311093401.GO4885@vkoul-mobl> (raw)
In-Reply-To: <158385554998.72352.12513554686212831620.stgit@djiang5-desk3.ch.intel.com>

On 10-03-20, 08:52, Dave Jiang wrote:
> The refcount check for dedicuated workqueue (dwq) is off by one and allows
                        
s/dedicuated/dedicated

> more than 1 user to open the char device. Fix check so only a single user
> can open the device.
> 
> Fixes: 42d279f9137a ("dmaengine: idxd: add char driver to expose submission portal to userland")
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/dma/idxd/cdev.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
> index e4379ba04a9a..f5e43f65a5ed 100644
> --- a/drivers/dma/idxd/cdev.c
> +++ b/drivers/dma/idxd/cdev.c
> @@ -84,9 +84,9 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp)
>  	dev = &idxd->pdev->dev;
>  	idxd_cdev = &wq->idxd_cdev;
>  
> -	dev_dbg(dev, "%s called\n", __func__);
> +	dev_dbg(dev, "%s called: %d\n", __func__, idxd_wq_refcount(wq));
>  
> -	if (idxd_wq_refcount(wq) > 1 && wq_dedicated(wq))
> +	if (idxd_wq_refcount(wq) > 0 && wq_dedicated(wq))
>  		return -EBUSY;
>  
>  	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);

-- 
~Vinod

      reply	other threads:[~2020-03-11  9:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10 15:52 [PATCH] dmaengine: idxd: fix off by one on cdev dwq refcount Dave Jiang
2020-03-11  9:34 ` Vinod Koul [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200311093401.GO4885@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox