All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hellstrom <thellstrom@vmware.com>
To: Devendra Naga <develkernel412222@gmail.com>
Cc: Dave Airlie <airlied@redhat.com>,
	linux-graphics-maintainer@vmware.com,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] vmwgfx: add missing mutex_unlocks
Date: Mon, 06 Aug 2012 10:07:05 +0200	[thread overview]
Message-ID: <501F7B29.3040602@vmware.com> (raw)
In-Reply-To: <1344058420-18329-1-git-send-email-develkernel412222@gmail.com>

NAK,

The mutex unlock is done in vmw_fifo_commit. The mutex is protecting the 
fifo memory against multiple simultaneous reservers.

/Thomas



On 08/04/2012 07:33 AM, Devendra Naga wrote:
> we have done a proper mutex_unlock in the error cases of the vmw_fifo_reserve, but
> there are missing mutex unlocks where we return a valid pointer in vmw_fifo_reserve.
>
> Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
> ---
>   drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c |    7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
> index a0c2f12..e3abd7a 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
> @@ -355,6 +355,7 @@ void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes)
>   				if (reserveable)
>   					iowrite32(bytes, fifo_mem +
>   						  SVGA_FIFO_RESERVED);
> +				mutex_unlock(&fifo_state->fifo_mutex);
>   				return fifo_mem + (next_cmd >> 2);
>   			} else {
>   				need_bounce = true;
> @@ -363,10 +364,12 @@ void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes)
>   
>   		if (need_bounce) {
>   			fifo_state->using_bounce_buffer = true;
> -			if (bytes < fifo_state->static_buffer_size)
> +			if (bytes < fifo_state->static_buffer_size) {
> +				mutex_unlock(&fifo_state->fifo_mutex);
>   				return fifo_state->static_buffer;
> -			else {
> +			} else {
>   				fifo_state->dynamic_buffer = vmalloc(bytes);
> +				mutex_unlock(&fifo_state->fifo_mutex);
>   				return fifo_state->dynamic_buffer;
>   			}
>   		}

  reply	other threads:[~2012-08-06  8:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-04  5:33 [PATCH] vmwgfx: add missing mutex_unlocks Devendra Naga
2012-08-06  8:07 ` Thomas Hellstrom [this message]
2012-08-06  8:12   ` Devendra Naga

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=501F7B29.3040602@vmware.com \
    --to=thellstrom@vmware.com \
    --cc=airlied@redhat.com \
    --cc=develkernel412222@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-graphics-maintainer@vmware.com \
    /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 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.