From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751597AbbJXGNO (ORCPT ); Sat, 24 Oct 2015 02:13:14 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:59879 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750915AbbJXGNM (ORCPT ); Sat, 24 Oct 2015 02:13:12 -0400 Message-ID: <1445667176.2395.16.camel@decadent.org.uk> Subject: Re: [PATCH 4.2 41/54] drm/nouveau/fbcon: take runpm reference when userspace has an open fd From: Ben Hutchings To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Ben Skeggs Date: Sat, 24 Oct 2015 15:12:56 +0900 In-Reply-To: <20151023174520.319262395@linuxfoundation.org> References: <20151023174519.086915553@linuxfoundation.org> <20151023174520.319262395@linuxfoundation.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-/hv8FYAvOV/2VIO3cVA3" X-Mailer: Evolution 3.18.1-1 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 220.118.178.92 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-/hv8FYAvOV/2VIO3cVA3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2015-10-23 at 10:45 -0700, Greg Kroah-Hartman wrote: > 4.2-stable review patch.=C2=A0=C2=A0If anyone has any objections, please = let me know. >=20 > ------------------ >=20 > From: Ben Skeggs >=20 > commit f231976c2e8964ceaa9250e57d27c35ff03825c2 upstream. >=20 > We need to do this in order to prevent accesses to the device while it's > powered down.=C2=A0=C2=A0Userspace may have an mmap of the fb, and there'= s no good > way (that I know of) to prevent it from touching the device otherwise. >=20 > This fixes some nasty races between runpm and plymouth on some systems, > which result in the GPU getting very upset and hanging the boot. >=20 > Signed-off-by: Ben Skeggs > Signed-off-by: Greg Kroah-Hartman >=20 > --- > =C2=A0drivers/gpu/drm/nouveau/nouveau_fbcon.c |=C2=A0=C2=A0=C2=A024 +++++= +++++++++++++++++++ > =C2=A01 file changed, 24 insertions(+) >=20 > --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c > +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c > @@ -178,8 +178,30 @@ nouveau_fbcon_sync(struct fb_info *info) > =C2=A0> > return 0; > =C2=A0} > =C2=A0 > +static int > +nouveau_fbcon_open(struct fb_info *info, int user) > +{ > +> > struct nouveau_fbdev *fbcon =3D info->par; > +> > struct nouveau_drm *drm =3D nouveau_drm(fbcon->dev); > +> > int ret =3D pm_runtime_get_sync(drm->dev->dev); > + if (ret < 0 && ret !=3D -EACCES) > + return ret; > +> > return 0; > +} [...] As pm_runtime_get_sync() always bumps the usage count, the error path here should call pm_runtime_put(). Ben. >=20 --=20 Ben Hutchings Beware of bugs in the above code; I have only proved it correct, not tried it. - Donald Knuth --=-/hv8FYAvOV/2VIO3cVA3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUAVishaOe/yOyVhhEJAQrMKA//eqpqfPeBist9qrSPtMU/3Qfu/0uOql6e tC5sOmNQJYB6RGD5GWAssVM8/rhZFKzjZ/6N76Sb8S7+gelyI3OMlwjW20d5ZYD6 GgkBJKSrYPdF0NAEb91VNPUdBwNVZZRAlRT8zBzFmcCYKWCh7mSFrUZqZUD3TpyS GEvkTGdwudRIOjov/T0QGtvJJb0p1bzB0nscSzLUDPOFFbPHvQHEPypFpUyKfdLA 0V6iefiaW3Sdv4ZvrBd551fWmWpDIkO7wEk0vvqcDpgRB4h0xC8QPcxe079LEdZg 97coYKHLsPoHa8z2Avw9ijIKiquwmJDc2dQehf4J0n8RNskKk2FXPKKL7XPGE+WB hkMZtxdSinOmi0ZJQUvSFRKvBjTKccFYklQ68WUWNZKlif9rRvEZpdNXHc1hmYjA dRx/Dcs786Bs4LqTm12XxVg30uTzway5tBL0u51wWNqVwMkUw2qwbYUW7suKBjHt Q+G1ol6ddFiCAqdDx+aRGFAXY4v/cIxvh0E1yujVuG7EgsbPZTdxaefOXHpUf6fh dXI+AP5b7po09BP33T5wqd5L7a7LXBePiSmPX0i3+BGya4nx04sUM2VkTnfe13Mh 6E7kWcy91ufFP5w1QIqXvIuXTVbLbutzmxfC2nvlvZHQRdxC2HxPnYTUKI7JqPUV FXEyZUTrpKA= =VFL5 -----END PGP SIGNATURE----- --=-/hv8FYAvOV/2VIO3cVA3--