From patchwork Thu Sep 1 13:39:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 9309065 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E8CC8607D2 for ; Thu, 1 Sep 2016 13:39:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC82F29420 for ; Thu, 1 Sep 2016 13:39:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCEF129422; Thu, 1 Sep 2016 13:39:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 631D129420 for ; Thu, 1 Sep 2016 13:39:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8286C6E236; Thu, 1 Sep 2016 13:39:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by gabe.freedesktop.org (Postfix) with ESMTPS id 792FF6E236 for ; Thu, 1 Sep 2016 13:39:32 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id u81DdQim005914; Thu, 1 Sep 2016 08:39:26 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u81DdPlk023887; Thu, 1 Sep 2016 08:39:25 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Thu, 1 Sep 2016 08:39:24 -0500 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u81DdMlF015111; Thu, 1 Sep 2016 08:39:23 -0500 From: Jyri Sarha To: Subject: [PATCH RFC] drm: Fix property handling for mode object without object type Date: Thu, 1 Sep 2016 16:39:22 +0300 Message-ID: <1472737162-3507-1-git-send-email-jsarha@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Cc: tomi.valkeinen@ti.com, Jyri Sarha , laurent.pinchart@ideasonboard.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Fix property handling for mode object without mode object type. drm_property_change_valid_get() crashes if atomic ioctl for mode object does not specify the mode object type. This patch makes drm_property_change_valid_get() to tolerate such requests. Signed-off-by: Jyri Sarha --- This used to work in v4.8, but I have no idea if this is a right fix or should we just gracefully reject ioctls to mode object properties without mode object type. In such a case we need to fix our test tool [1]. [1] https://github.com/tomba/kmsxx drivers/gpu/drm/drm_property.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index 4139afb..67261a2 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c @@ -877,7 +877,9 @@ bool drm_property_change_valid_get(struct drm_property *property, return true; *ref = __drm_mode_object_find(property->dev, value, - property->values[0]); + property->num_values ? + property->values[0] : + DRM_MODE_OBJECT_ANY); return *ref != NULL; }