From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH 3/6] drm/atomic: Don't overrun the connector array when hotplugging Date: Thu, 20 Nov 2014 09:53:34 +0100 Message-ID: <20141120085328.GA23043@ulmo> References: <1416418691-24747-1-git-send-email-daniel.vetter@ffwll.ch> <1416418691-24747-3-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1163918690==" Return-path: In-Reply-To: <1416418691-24747-3-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Daniel Vetter Cc: Daniel Vetter , Intel Graphics Development , DRI Development List-Id: dri-devel@lists.freedesktop.org --===============1163918690== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3MwIy2ne0vdjdPXF" Content-Disposition: inline --3MwIy2ne0vdjdPXF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 19, 2014 at 06:38:08PM +0100, Daniel Vetter wrote: [...] > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c [...] > @@ -304,6 +306,21 @@ drm_atomic_get_connector_state(struct drm_atomic_sta= te *state, > =20 > index =3D drm_connector_index(connector); > =20 > + /* > + * Construction of atomic state updates can race with a connector > + * hot-add which might overflow. In this case flip the table and just > + * restart the entire ioctl - no one is fast enough to livelock a cpu > + * with physical hotplug events anyway. > + * > + * Note that we only grab the indexes once we have the right lock to > + * prevent hotplug/unplugging of connectors. So removal is no problem, > + * at most the array is a bit too large. > + */ > + if (index >=3D state->num_connector) { > + DRM_DEBUG_KMS("Hot-added connector would overflow state array, restart= ing\n"); > + return -EAGAIN; This function returns a pointer, so this needs to be ERR_PTR(-EAGAIN). Thierry --3MwIy2ne0vdjdPXF Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJUbawIAAoJEN0jrNd/PrOhCfYP/2h/VXgAxr5+PZBbmHkMzBGc v5CpbhJ6jfeFfm0rab8A2zd4gu6YRZUQc9rwIS+wvSv3AIqiHUODHiRdLLdQh3ct b95gLVJ9jCQSrvLY/+Ox+QwM467twv3hL3OsfGGLvNkYO2aWw7CnMR+YkVR+WNTg RDHs/+JHl9QnXEHMuBwmkNoV7TnrgxzFtuvhZ0t+oh5PWjWI8sO7WTakVDRCxu+Y LB2XuaV0cnG8vNXqLB/8v1ZwUdpFXs6QYUlmHZ+1l2Jt/BOK2QDJJcXu3CR+L7IK 66z0mRay27aKTe2Zne4xU0zQukMBS6l8G+YHoIe8VFiNVUo5Hq1nnI7IUg0cWzas 054QTteUKlxxbTI545cjPQuTjLZnwVucnfUk1PR8oZYmynGeNRE0URakcnpsY0Rt DHdw4tQn8tPIy2XeR9PNgqSWSmZyqarEACZgcaZeskeLkJ8QeD2GZoqMidKoTv5U EI4QupI1D89rUPVzooIySNJPjqvrQ6oyQeH3dx3+HZ7s9rbXAKg2qcUv1mKt5s+D smvyaG6bIKTB0nSGKgqj8RUAOYNFBrKLAWlldDneNsvURFHV0NkOcmN06lj2Y/cR 6ZopsLJBIG6kNTtuelJxOc7sZ2P56Rqg+pr1w/V/p5SsM46EWcgXZTcGMjhtkH7M AxsVaXqyY/db5hrCp0QM =/7e2 -----END PGP SIGNATURE----- --3MwIy2ne0vdjdPXF-- --===============1163918690== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK --===============1163918690==--