Received: by 10.223.185.111 with SMTP id b44csp1324632wrg; Sat, 10 Mar 2018 03:27:45 -0800 (PST) X-Google-Smtp-Source: AG47ELuXjOemJrudhrc/IUlJRAE4pvHr6O8dwkALAwMG920BSS1buDTbC8d7lwQO0dQWMKJdx+sI X-Received: by 2002:a17:902:4481:: with SMTP id l1-v6mr619156pld.43.1520681265376; Sat, 10 Mar 2018 03:27:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520681265; cv=none; d=google.com; s=arc-20160816; b=tnSInAntsr0m+L3txPIrV7WKwpBNwNrqGI4KOTF0JyYdKYf5iamRDyXDSDKQKLCWuG fcUlIbuXj4ZRVcJQXSDJEOTjGT30HJCds4hUyeOaSeh347jtTUg9mtm/YFvjdR7KTwas V3rUpxxbMScuI34YCFXFbVEaUGoD4jcip4Tz088Gh9n8ZlINjag0U3lq8hqqtar/roSU f+WtRYTY2yie/yPzLYB0TSR3AGaZBj/KQwgklaeZvqIue3dGSpCDzYZWXwSY9SyyBosb Rq7oNbcB5i88hafzMqY3FVjvgqP+l3xAoJxYW6dkRym3DAEeqeCTQWvdxNg9JavMxm3d ZCzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=cDHHxmR5cqEz7K+b2TvQeW/6tArkX+rt8HcVKJOYGqk=; b=VEBIVhovQEIJrGBYh5HMHnA1roy3UTSOZUdGB1u4jOHbY7ciZ2tgJLqBJnxmvHcUAK vAOroSPlYhj93Tohsj/N4LDzzkfxzFN4n/ve7BjAH/jp2Ayt1CdRGlhsqww+IQjfP1+o 4swdVFxavFzqZLerB+LVgGws8vifEuHbU9H/MIp5wRlLtze3y47znfgUTqPxDxLI2k0c uJFzxH6PX5lYCYGOhC9UbVYEP6UJiAb9qxp/gy4bn4JtO/NppoeMtI4e4NaJNi2UTuzk F9VtA4spU+dfwDCAWYG7zRL8G0dwWPHPFHzBdK8U/S6rNr0WZjWjo/ev4qNtHt+mo8F8 DdpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g24si2617161pfe.107.2018.03.10.03.27.30; Sat, 10 Mar 2018 03:27:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752143AbeCJL0i (ORCPT + 99 others); Sat, 10 Mar 2018 06:26:38 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:44875 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752067AbeCJL0g (ORCPT ); Sat, 10 Mar 2018 06:26:36 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 3C6B28032E; Sat, 10 Mar 2018 12:26:35 +0100 (CET) Date: Sat, 10 Mar 2018 12:26:34 +0100 From: Pavel Machek To: Suman Anna Cc: Robin Murphy , ivo.g.dimitrov.75@gmail.com, khilman@kernel.org, Tony Lindgren , aaro.koskinen@iki.fi, kernel list , sre@kernel.org, martijn@brixit.nl, Filip =?utf-8?Q?Matijevi=C4=87?= , abcloriens@gmail.com, sakari.ailus@linux.intel.com, pali.rohar@gmail.com, clayton@craftyguy.net, linux-omap@vger.kernel.org, patrikbachan@gmail.com, linux-arm-kernel , serge@hallyn.com, Laurent Pinchart Subject: Re: Nokia N900: refcount_t underflow, use after free Message-ID: <20180310112634.GA31614@amd> References: <20180308143053.GA17267@amd> <20180308165903.GM5799@atomide.com> <57c9f17b-fc9d-8506-4b5d-70ac216c9248@ti.com> <20180308185046.GA22796@amd> <1dfc05fe-1612-f5a5-b5f1-9038b3cecfe5@arm.com> <1643b74a-62ba-bea6-71c2-a2dd02430463@ti.com> <20180309221834.GA15476@amd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TB36FDmn/VVEgNH/" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > >>> Well, there certainly seems to be an obvious bug wherein > >>> isp_detach_iommu() just releases the mapping directly without calling > >>> arm_iommu_detach_device() to balance the equivalent attach. That can't > >>> be helping. > >> > >> Indeed, I have been able to reproduce the same warning using a > >> standalone test module, and the missing arm_iommu_detach_device() is > >> causing the warning after probe (during failure path) or during > >> remove. > >=20 > > Ok do you have an idea how to fix the isp error paths? Untested patch > > would be fine... But it seems that you know what needs to be fixed and > > I don't. > >=20 >=20 > OK, see if the following fixes the issue for you, only build tested. Word-wrapped, so I applied by hand. And yes, the oops at boot is gone. Thanks! (Camera still does not work in -next... kills system. Oh well. Lets debug that some other day.) > 8< --------------------- > >From bac9a48fb646dc51f2030d676a0dbe3298c3b134 Mon Sep 17 00:00:00 2001 > From: Suman Anna > Date: Fri, 9 Mar 2018 16:39:59 -0600 > Subject: [PATCH] media: omap3isp: fix unbalanced dma_iommu_mapping >=20 > The OMAP3 ISP driver manages its MMU mappings through the IOMMU-aware > ARM DMA backend. The current code creates a dma_iommu_mapping and > attaches this to the ISP device, but never detaches the mapping in > either the probe failure paths or the driver remove path resulting > in an unbalanced mapping refcount and a memory leak. Fix this properly. >=20 > Reported-by: Pavel Machek > Signed-off-by: Suman Anna Tested-by: Pavel Machek Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --TB36FDmn/VVEgNH/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlqjwOoACgkQMOfwapXb+vJJbgCfVSUWcrQSvbEH+6yJBquFBb8I 1cMAnA/8EDcPBiOy5Ljr1mXZR07zUmX9 =hZzt -----END PGP SIGNATURE----- --TB36FDmn/VVEgNH/--