From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Ripard Subject: Re: [PATCH v2 02/12] drm/fb-helper: Avoid race with DRM userspace Date: Tue, 16 Apr 2019 11:26:48 +0200 Message-ID: <20190416092648.ha5x4yvatgmcizql@flea> References: <20190407165243.54043-1-noralf@tronnes.org> <20190407165243.54043-3-noralf@tronnes.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0950729471==" Return-path: In-Reply-To: <20190407165243.54043-3-noralf@tronnes.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Noralf =?utf-8?Q?Tr=C3=B8nnes?= Cc: daniel.vetter@ffwll.ch, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0950729471== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5setl3h3y4woldhj" Content-Disposition: inline --5setl3h3y4woldhj Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Apr 07, 2019 at 06:52:33PM +0200, Noralf Tr=F8nnes wrote: > drm_fb_helper_is_bound() is used to check if DRM userspace is in control. > This is done by looking at the fb on the primary plane. By the time > fb-helper gets around to committing, it's possible that the facts have > changed. > > Avoid this race by holding the drm_device->master_mutex lock while > committing. When DRM userspace does its first open, it will now wait > until fb-helper is done. The helper will stay away if there's a master. > > Locking rule: Always take the fb-helper lock first. > > v2: > - Remove drm_fb_helper_is_bound() (Daniel Vetter) > - No need to check fb_helper->dev->master in > drm_fb_helper_single_fb_probe(), restore_fbdev_mode() has the check. > > Suggested-by: Daniel Vetter > Signed-off-by: Noralf Tr=F8nnes With the changes asked by Daniel, Reviewed-by: Maxime Ripard Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com --5setl3h3y4woldhj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXLWf2AAKCRDj7w1vZxhR xUpwAP4yLjUHi1/w9A9NyEX+TFZkzULHMdLwrP03lCX2DQ6i9gD/UDtI1TWqX0SC oPHTUMIGVV8Lq29KaqVRZQt1dzAbOgY= =6ZYl -----END PGP SIGNATURE----- --5setl3h3y4woldhj-- --===============0950729471== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4 --===============0950729471==--