Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938624AbcKNCd0 (ORCPT ); Sun, 13 Nov 2016 21:33:26 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:47336 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935920AbcKNCdS (ORCPT ); Sun, 13 Nov 2016 21:33:18 -0500 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Chris Wilson" , "Alexander Potapenko" , "Daniel Vetter" , "Dave Airlie" , "Daniel Vetter" Date: Mon, 14 Nov 2016 00:14:07 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 079/152] drm: Reject page_flip for !DRIVER_MODESET In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 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 Content-Length: 1138 Lines: 35 3.2.84-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Vetter commit 6f00975c619064a18c23fd3aced325ae165a73b9 upstream. Somehow this one slipped through, which means drivers without modeset support can be oopsed (since those also don't call drm_mode_config_init, which means the crtc lookup will chase an uninitalized idr). Reported-by: Alexander Potapenko Cc: Alexander Potapenko Signed-off-by: Daniel Vetter Reviewed-by: Chris Wilson Signed-off-by: Dave Airlie Signed-off-by: Ben Hutchings --- drivers/gpu/drm/drm_crtc.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2675,6 +2675,9 @@ int drm_mode_page_flip_ioctl(struct drm_ unsigned long flags; int ret = -EINVAL; + if (!drm_core_check_feature(dev, DRIVER_MODESET)) + return -EINVAL; + if (page_flip->flags & ~DRM_MODE_PAGE_FLIP_FLAGS || page_flip->reserved != 0) return -EINVAL;