From patchwork Fri Oct 27 13:40:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10032211 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 C32A46039A for ; Mon, 30 Oct 2017 08:18:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B24B9285CE for ; Mon, 30 Oct 2017 08:18:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A72872874A; Mon, 30 Oct 2017 08:18:44 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable 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 49BBE285CE for ; Mon, 30 Oct 2017 08:18:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7154F89F85; Mon, 30 Oct 2017 08:17:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 868696E02C for ; Fri, 27 Oct 2017 13:40:23 +0000 (UTC) Received: by mail-wr0-x244.google.com with SMTP id z55so6221765wrz.1 for ; Fri, 27 Oct 2017 06:40:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=IXMjTOpSyXKtTQ5ZZF/mmgjBTfuSfaZ0zsKT5La4AZE=; b=qdPlDZPV5Nx8HpwVlBTWVZ4byUKdgOKPuFkc4i7sfvnDH/bp6WkFxgHFuxymfOU4f6 V45qaVI/3FPB6E62VFIBxB9/5/kj9LANCXGwh4r+29vAjl+tM2tHMtnFm4SyknkLybsw aGDelLsnAqP/LMATSuemIYNl/ISAbEF6F2WStHPvCKkWMbNXVHwp6RK/GxNlJJ8MEJlz mklQXLlVXYGTvDcIz+a3t+OXBqAMpXXquLuP6wGicyEBmXI3uzbx0jCN5JSVHy0xY2jm UMf3VoB4AaQMsHDOVCEKi25r9YOBU1pvPM7GWMM3/Lg7BpTpqsAahWjhFtN8IWyqn29n 5r6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=IXMjTOpSyXKtTQ5ZZF/mmgjBTfuSfaZ0zsKT5La4AZE=; b=ggT149WrZsX+9viCiczlmgP1iFrCAX7ch0Zp+BSSEkmVvmEWA5ibE0X4bnTZu4CyLu BLwY0BZYNwXmwAfBe36N/VEAPg/c/lnzml7Cp4qHljShQzwMO9dG+Xw73TnY0ZSQ/rnA fDydT+ECFY7yS/LQ5A9xqGVCx7i8MkvXH/YC+3PBdv/q3ftDTnxb5c+fsyfej/+9/gWJ coyQXJ978K2xpFGE3PY1CsazmSYoOaJgdNg/oepK4FPo7tPRnepnsuhBJnttBiZ4hTip JbYJr9ge6gtVSomBRcL5nPBY9NZgzNpbkfqW+ly7qIJb+5dCTGWxILmkJkcaWDCHQxBl kHcg== X-Gm-Message-State: AMCzsaU1NZegwXIq/B6lqqoWwG42vg8sEaVxtNZRXQgZGj44MS2b/UT1 ZQjm2urEwefVq2hAH83oA4wNRQ== X-Google-Smtp-Source: ABhQp+TDnwbr3o6a8RuA4onfDrU7Jy8r6ICUtOWDR/7xJz7mwWA8voL6MVza9XejfghLxzWkHmZjRw== X-Received: by 10.223.157.11 with SMTP id k11mr498000wre.281.1509111622058; Fri, 27 Oct 2017 06:40:22 -0700 (PDT) Received: from t460p.intel ([95.146.151.224]) by smtp.gmail.com with ESMTPSA id 69sm2418517wmp.11.2017.10.27.06.40.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Oct 2017 06:40:21 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Subject: [PATCH 1/3] drm/i915: Reject unknown syncobj flags Date: Fri, 27 Oct 2017 14:40:12 +0100 Message-Id: <20171027134014.23961-1-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.9.5 X-Mailman-Approved-At: Mon, 30 Oct 2017 08:17:31 +0000 Cc: Tvrtko Ursulin , intel-gfx@lists.freedesktop.org, Joonas Lahtinen , dri-devel@lists.freedesktop.org, Jason Ekstrand , Rodrigo Vivi , tursulin@ursulin.net 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin We have to reject unknown flags for uAPI considerations, and also because the curent implementation limits their i915 storage space to two bits. Signed-off-by: Tvrtko Ursulin Fixes: cf6e7bac6357 ("drm/i915: Add support for drm syncobjs") Cc: Jason Ekstrand Cc: Chris Wilson Cc: Jani Nikula Cc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: David Airlie Cc: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 3d7190764f10..3bc723ed6e2f 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -2100,6 +2100,11 @@ get_fence_array(struct drm_i915_gem_execbuffer2 *args, goto err; } + if (fence.flags & ~((typeof(fence.flags))2)) { + err = -EINVAL; + goto err; + } + syncobj = drm_syncobj_find(file, fence.handle); if (!syncobj) { DRM_DEBUG("Invalid syncobj handle provided\n");