From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Hellstrom Subject: Re: [PATCH] vmwgfx: add missing mutex_unlocks Date: Mon, 06 Aug 2012 10:07:05 +0200 Message-ID: <501F7B29.3040602@vmware.com> References: <1344058420-18329-1-git-send-email-develkernel412222@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from smtp-outbound-1.vmware.com (smtp-outbound-1.vmware.com [208.91.2.12]) by gabe.freedesktop.org (Postfix) with ESMTP id A23F79EEC2 for ; Mon, 6 Aug 2012 01:07:10 -0700 (PDT) In-Reply-To: <1344058420-18329-1-git-send-email-develkernel412222@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Devendra Naga Cc: Dave Airlie , linux-graphics-maintainer@vmware.com, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org 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 > --- > 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; > } > }