From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH 4/5] iommu: Make sure a device is always attached to a domain Date: Fri, 30 Jan 2015 13:29:19 +0100 Message-ID: <20150130122919.GD3702@8bytes.org> References: <1422317339-22620-1-git-send-email-joro@8bytes.org> <1422317339-22620-5-git-send-email-joro@8bytes.org> <20150128143852.GS1569@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20150128143852.GS1569-5wv7dgnIgG8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Will Deacon Cc: "jroedel-l3A5Bk7waGM@public.gmane.org" , Laurent Pinchart , Heiko Stuebner , Arnd Bergmann , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" , Thierry Reding , Kukjin Kim , David Woodhouse List-Id: iommu@lists.linux-foundation.org On Wed, Jan 28, 2015 at 02:38:52PM +0000, Will Deacon wrote: > On Tue, Jan 27, 2015 at 12:08:58AM +0000, Joerg Roedel wrote: > > - return iommu_group_for_each_dev(group, domain, > > - iommu_group_do_attach_device); > > + int ret; > > + > > + if (group->default_domain && group->domain != group->default_domain) > > + return -EBUSY; > > I think this is now racy with itself and detach, whereas before we always > held the group->mutex by virtue of iommu_group_for_each_dev. You are right, thanks. I will update the code with correct locking. Joerg