From patchwork Tue Dec 20 15:54:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Crouse X-Patchwork-Id: 9481721 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 1FF40601C0 for ; Tue, 20 Dec 2016 15:54:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F7972844B for ; Tue, 20 Dec 2016 15:54:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0249B2841B; Tue, 20 Dec 2016 15:54:54 +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=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 9D7532841B for ; Tue, 20 Dec 2016 15:54:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E6C76EEA0; Tue, 20 Dec 2016 15:54:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id B66E96EE9C; Tue, 20 Dec 2016 15:54:37 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A4D72615C0; Tue, 20 Dec 2016 15:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1482249277; bh=/82dhcjIPuYXCDHC9c6IT8bsy53Qmhslr19CGycKHd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPGuYJvYD2Q7viBSR6y5JbGfdAqE5ZfTmdItKPUPrKpT0f1gUVG8nhL9Lv5aKeyK9 FTfNecALxeXyewniI8M5Di/AzusuY1J1MUGBl7fjO39XZNAyGjubHS1eUMQEKKQ9ft Z+pV/o9Onbf9Nx5fbIFWdi4sW3t+u8IJubel96mY= Received: from jcrouse-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 0EA36615C0; Tue, 20 Dec 2016 15:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1482249277; bh=/82dhcjIPuYXCDHC9c6IT8bsy53Qmhslr19CGycKHd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPGuYJvYD2Q7viBSR6y5JbGfdAqE5ZfTmdItKPUPrKpT0f1gUVG8nhL9Lv5aKeyK9 FTfNecALxeXyewniI8M5Di/AzusuY1J1MUGBl7fjO39XZNAyGjubHS1eUMQEKKQ9ft Z+pV/o9Onbf9Nx5fbIFWdi4sW3t+u8IJubel96mY= DMARC-Filter: OpenDMARC Filter v1.3.1 smtp.codeaurora.org 0EA36615C0 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=pass smtp.mailfrom=jcrouse@codeaurora.org From: Jordan Crouse To: freedreno@lists.freedesktop.org Subject: [PATCH 3/3] drm/msm: Verify that MSM_SUBMIT_BO_FLAGS are set Date: Tue, 20 Dec 2016 08:54:31 -0700 Message-Id: <1482249271-16043-4-git-send-email-jcrouse@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1482249271-16043-1-git-send-email-jcrouse@codeaurora.org> References: <1482249271-16043-1-git-send-email-jcrouse@codeaurora.org> Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org 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 For every submission buffer object one of MSM_SUBMIT_BO_WRITE and MSM_SUBMIT_BO_READ must be set (and nothing else). If we allowed zero then the buffer object would never get queued to be unreferenced. Signed-off-by: Jordan Crouse --- drivers/gpu/drm/msm/msm_gem_submit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index 2697b32..2982702 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -106,7 +106,8 @@ static int submit_lookup_objects(struct msm_gem_submit *submit, pagefault_disable(); } - if (submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) { + if ((submit_bo.flags & ~MSM_SUBMIT_BO_FLAGS) || + !(submit_bo.flags & MSM_SUBMIT_BO_FLAGS)) { DRM_ERROR("invalid flags: %x\n", submit_bo.flags); ret = -EINVAL; goto out_unlock;