From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH] iommu/dma: Don't put uninitialised IOVA domains Date: Tue, 9 Aug 2016 17:01:57 +0200 Message-ID: <20160809150157.GF1437@8bytes.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: 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: Robin Murphy Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Wed, Jul 27, 2016 at 04:46:06PM +0100, Robin Murphy wrote: > Due to the limitations of having to wait until we see a device's DMA > restrictions before we know how we want an IOVA domain initialised, > there is a window for error if a DMA ops domain is allocated but later > freed without ever being used. In that case, init_iova_domain() was > never called, so calling put_iova_domain() from iommu_put_dma_cookie() > ends up trying to take an uninitialised lock and crashing. > > Make things robust by skipping the call unless the IOVA domain actually > has been initialised, as we probably should have done from the start. > Missing 'Fixes:' and probably 'Cc: stable' lines? > Reported-by: Nate Watterson > Signed-off-by: Robin Murphy > --- > > I'm not sure this warrants a cc stable, as with the code currently in > mainline it's only at all likely if other things have already failed > elsewhere in a manner they should not be expected to. Yes, I think this qualifies for stable. Please re-send with the Acks and Reviewed-by lines too. I'll queue this in my fixes branch and send it upstream asap. Joerg