Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2476002rdb; Fri, 8 Dec 2023 09:09:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHGxzm082ch3lQzDYtclEXNfp4EYRgmIb+vrzjPzhSzKpQNy2F3MhgCNPOcoY9h1yIQRaGD X-Received: by 2002:a05:6e02:1526:b0:35d:59a2:2bb with SMTP id i6-20020a056e02152600b0035d59a202bbmr562292ilu.91.1702055362834; Fri, 08 Dec 2023 09:09:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702055362; cv=none; d=google.com; s=arc-20160816; b=h7rjI9VoR3mnSnc+LYrqKJtSZ+JmgZO6WrDbj4BB6sqqMfqvkm/LhqL69F71+SKZGi 1NHZnYAOsp1iMERCaXqYKIf1uewR4ISB+2kvunJYW+X3Ctlq79pq7YjnHHJTqKgYBbhf 4crksTxP4TrQFZiqW+XrrNGidSafa1/Ur9fg+XZsfXd5qxiF9ofDuUEURZu7lTNRF75x IWTDe9pXgsDmWQzksmSl75nP8yYgnTjW3s8TQC13FfGpNi5xIn7MoDmcN2pFJniGOkQm XM15J2yUVZXcNnUd0z/B7btwY+72hLHIBW8kuRduxkdPKe/SeNT7YXeKzxvvnA7im1hA 2t0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=XVyGqXIqWznKFmI6wLzi11NM/yRQinuNhq1yEIojuaw=; fh=E6LrSisPZuY1lXu+/CPgIkcE6IaZVl1jLwr/jL1+92s=; b=Sb1M/7Jx6hskdLYlFMBXLCStw4LBgvEMR71lnAOhmDU50zNY1EmlzAsV1tEfAZY/PC z0nzg18i6SgEPV2jmDFUWM1XVZ3u4i2iUoLajTPm4jB6O+obO24r7zA3vvzr4v8ll0qV HslFyUAa3/wSDOg/QKr2TjoL70ruBSXyUuXQk7KWJxIbMOc/ZZSdcpaUW3Xssoo3gpkK x95FHAIg1vy3l5mXHP6EFvnFRH6ptclWMGFzoOxqpmu1yczH6nvK+9poKY4HlRo/BpnM Oh3WDeafhUBKsdVmAuEi62IGH6IWGqWaRe3hVmX+AbpW5ax8SnyFS9sL2x90lS8+Jwdk LmIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=l5SC3H7M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id j27-20020a63231b000000b0058572c8d5d5si1755263pgj.233.2023.12.08.09.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 09:09:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=l5SC3H7M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id E20408087244; Fri, 8 Dec 2023 09:09:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233804AbjLHRI4 (ORCPT + 99 others); Fri, 8 Dec 2023 12:08:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1574187AbjLHRIy (ORCPT ); Fri, 8 Dec 2023 12:08:54 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64161199B for ; Fri, 8 Dec 2023 09:09:00 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40c2c5a8150so18999755e9.2 for ; Fri, 08 Dec 2023 09:09:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702055339; x=1702660139; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XVyGqXIqWznKFmI6wLzi11NM/yRQinuNhq1yEIojuaw=; b=l5SC3H7M1o30t46BXAcrsD8ORY6RI/ftDbPP0otJtBVH85hIUXnmVpWtT9IXBiT3P+ 4ZXNaOlcBts5g8DYZaTF9vtPQnvYd6nUOhE+1pvOjc9+B3g5nJYoG7EFFSjkQIDiNDJl eKnwbGkH+gP5Qjq8dAV5zwyKbww8U5GYFjkqN51hcMfzQiIX7opc8HaBgvduObL8EvC6 2Y/TEXizYKd1hogUhifDB42VZoQqEqzjkUJn24Xu1DnDHlZgvo+4u75X9xp4hCW0HUtQ h9SM81WAJIIk0u1jusrFGDY1p8a8+lfOuysPRoiUBuWMI6EAFpSFhswxsMZFNRnxMEts BvOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702055339; x=1702660139; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XVyGqXIqWznKFmI6wLzi11NM/yRQinuNhq1yEIojuaw=; b=sAoyNLPPGRLJLJu10WDXqFLr4E6jDUvu/cIitmWJfQUeENtPeQP4Li+dTnT7mZ3NBI I8N3Nvf6QzkLcoPAcFSyF9U+bSuoXAzLex7WTDnbBLY8W56uFi4Fmry4TYpUQGlka0Q2 RWRZfh9ZQHlyUEQxxrLljiwBpNtziyZ3yhDli5gCEOnjqTR1Ab0EEhDUWquxfCrHp3Yo 2vNzR7YD0rvED2vgeLF5ltuAeOW/lQ73a03TuHSyNapeYeDyvnfEPXDkiFx8sVIYziXj Ek9eNh6SQIJ00vFl1zEZtSmAOO/rjpd/mc6wGW4runXra93eGiVK8f7QOXjhP3+/SU5m m3rA== X-Gm-Message-State: AOJu0YyvvkugKTcdsTAGwQoWVRJkHjsVuQR7WiwSaweOrxvxiLZWB9HW GAgyJDKEkmmmin5Pg2W2+g== X-Received: by 2002:a05:600c:1d15:b0:40b:5e21:ec49 with SMTP id l21-20020a05600c1d1500b0040b5e21ec49mr151241wms.123.1702055338662; Fri, 08 Dec 2023 09:08:58 -0800 (PST) Received: from U4.lan ([2a02:810b:f40:4300:79e9:c218:2514:2131]) by smtp.gmail.com with ESMTPSA id z17-20020a5d44d1000000b003334a0513dbsm2421835wrr.67.2023.12.08.09.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 09:08:58 -0800 (PST) From: Alex Bee To: Frank Binns , Donald Robson , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: David Airlie , Daniel Vetter , Sarah Walker , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH] drm/imagination: vm: Fix heap lookup condition Date: Fri, 8 Dec 2023 18:08:56 +0100 Message-ID: <20231208170856.1748413-1-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 08 Dec 2023 09:09:14 -0800 (PST) When conditionally checking for heap existence of a certian address in pvr_vm_bind_op_map_init the condition whether the map request comes from a user is incorrect: The context must not be the kernel-context to be a user(space) context and should be looked up in pvr_heaps. That makes addresses coming from userspace not being verfied against the defined ranges and prevents firmware loading for meta cores. Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code") Signed-off-by: Alex Bee --- drivers/gpu/drm/imagination/pvr_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagination/pvr_vm.c index f42345fbe4bf..82690cee978c 100644 --- a/drivers/gpu/drm/imagination/pvr_vm.c +++ b/drivers/gpu/drm/imagination/pvr_vm.c @@ -225,7 +225,7 @@ pvr_vm_bind_op_map_init(struct pvr_vm_bind_op *bind_op, u64 device_addr, u64 size) { struct drm_gem_object *obj = gem_from_pvr_gem(pvr_obj); - const bool is_user = vm_ctx == vm_ctx->pvr_dev->kernel_vm_ctx; + const bool is_user = vm_ctx != vm_ctx->pvr_dev->kernel_vm_ctx; const u64 pvr_obj_size = pvr_gem_object_size(pvr_obj); struct sg_table *sgt; u64 offset_plus_size; -- 2.43.0