From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mailout2.w1.samsung.com ([210.118.77.12]:10731 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751076AbaLCPHa (ORCPT ); Wed, 3 Dec 2014 10:07:30 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NG000L0VI52SJ70@mailout2.w1.samsung.com> for linux-media@vger.kernel.org; Wed, 03 Dec 2014 15:10:14 +0000 (GMT) Message-id: <547F2723.5070907@samsung.com> Date: Wed, 03 Dec 2014 16:07:15 +0100 From: Sylwester Nawrocki MIME-version: 1.0 To: Laurent Pinchart , linux-media@vger.kernel.org Cc: Michal Simek , Chris Kohn , Hyun Kwon Subject: Re: [PATCH v4 07/10] v4l: vb2: Fix race condition in _vb2_fop_release References: <1417464820-6718-1-git-send-email-laurent.pinchart@ideasonboard.com> <1417464820-6718-8-git-send-email-laurent.pinchart@ideasonboard.com> In-reply-to: <1417464820-6718-8-git-send-email-laurent.pinchart@ideasonboard.com> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit Sender: linux-media-owner@vger.kernel.org List-ID: On 01/12/14 21:13, Laurent Pinchart wrote: > The function releases the queue if the file being released is the queue > owner. The check reads the queue->owner field without taking the queue > lock, creating a race condition with functions that set the queue owner, > such as vb2_ioctl_reqbufs() for instance. > > Fix this by moving the queue->owner check within the mutex protected > section. > > Signed-off-by: Laurent Pinchart > Acked-by: Hans Verkuil Acked-by: Sylwester Nawrocki