Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp931524iog; Thu, 30 Jun 2022 13:08:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tPW0sfk3aMRW1qdnhDuNJHSi0jlvsoZw9FiqHiCXPRTQbvfz4E0xxINQNq9CwBiLIn5BnW X-Received: by 2002:a17:902:e5c9:b0:16b:7c53:9f01 with SMTP id u9-20020a170902e5c900b0016b7c539f01mr15952427plf.151.1656619702553; Thu, 30 Jun 2022 13:08:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656619702; cv=none; d=google.com; s=arc-20160816; b=hDax0hVn/bISNcr8yX/kySThLVaRPdvoYyNnsyLvcjfkaL4gW0FD3f6BROi2TWRGwz qUAEwUrwUnS65rpWo0Xq+6gFLQkySM/GJrKse7vV3Z3KLKJ3y4NEHm+jvYUzaZx30OWJ 10WOtMrgUPWlgUDZfBhAz+vKl8dZRAQu8dtXU5OcsW0qANIbPvcO1OBbXgEQ2sYjE3Mj X8IPFbZNwWziBMBO5gKBEzIeGeoYgod8cVE6oUPmCV36QxhvQxrEcGAWC3YGHt8NZTH3 gAG78pVYsjBjc0nBegH2Z0pa/FypRiWVFUlaOamtvnx9ZsCTM51ycGXTY9AjL5WhdUK+ Z6bA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=F9cBI67V6YvmBWLT1tRjNoMJ6qW0tM9UmmQWlQWIaAM=; b=GAlYQ6pUiORhb+YBr/DCmQaUOXMsVvoBFeM2VLgqf+Y6lG6RJdxJbtm9kJy0kej4EW ooIR6E5ZiZxe6R9yOBE/g02Qy7zgpcaq1NiEVr+mlkF5Kc0R00jj8FJzcON23uQCuA5J raRHrSUMSJWAJNu/B8HTF0NuhgS+J9XU4XM1BaHSbxcz61Of89RVuPCFup+vbelRpzDP xUWhfifm3UwaABWzFlURWfEAW9TZwdO6hPszFzaMMqhXFmwp/Z5xMTmrQXtM0JuhyXG4 gmTGCJ7Kbe1yq3yQwDL1ZVZ1hxcrCsxWZFPQS9Ujn5A1cfHcDE0sqdg2tkXJXfE6dm6D 4c/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=JuBi+bZr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a17090aba9200b001ec8884707esi3298608pjr.61.2022.06.30.13.08.09; Thu, 30 Jun 2022 13:08:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=JuBi+bZr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236852AbiF3UBc (ORCPT + 99 others); Thu, 30 Jun 2022 16:01:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236741AbiF3UBa (ORCPT ); Thu, 30 Jun 2022 16:01:30 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A74541634 for ; Thu, 30 Jun 2022 13:01:29 -0700 (PDT) Received: from dimapc.. (109-252-118-164.nat.spd-mgts.ru [109.252.118.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madras.collabora.co.uk (Postfix) with ESMTPSA id 77BE46601970; Thu, 30 Jun 2022 21:01:27 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1656619288; bh=agNXiubhmlWUmhyiQk+T0pYhjXgAeStRlj8Az7MpTQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JuBi+bZrxnpFbtWnBwe1kxV/vDW7SljTqNoClO+PIyMibkOeIUNxMRB2m132KNaBP n3Knbr6COwq8PyG2Yq6gaN/76DBNUtQ2JdsUpYWoyjdZn9iemz1nzStqcMJGhigPfn SlEgCTCVJY4LqqHeDqnzaB1GbRKxej8WPMVpAGP8lU3ef2dqEBDln6kI/ehK/A3vip eroO3ZsJzzAVufygpD2ACtvqfkp5gMl8eqjShmBt/zrn64nirKyY8Oh3pSt8qNKKEW inHPvUNQvDUNc6WAFrr/l7G7B79aVQFud2oC+5ZV2llDA9ZDEPhFplptyeqb5gkkzs IZN42CPRz5gOQ== From: Dmitry Osipenko To: David Airlie , Daniel Vetter , Maxime Ripard , Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Dmitry Osipenko , kernel@collabora.com Subject: [PATCH v7 1/2] drm/shmem-helper: Add missing vunmap on error Date: Thu, 30 Jun 2022 23:00:57 +0300 Message-Id: <20220630200058.1883506-2-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220630200058.1883506-1-dmitry.osipenko@collabora.com> References: <20220630200058.1883506-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The vmapping of dma-buf may succeed, but DRM SHMEM rejects the IOMEM mapping, and thus, drm_gem_shmem_vmap_locked() should unvmap the IOMEM before erroring out. Cc: stable@vger.kernel.org Fixes: 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends") Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c index 8ad0e02991ca..904fc893c905 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -302,6 +302,7 @@ static int drm_gem_shmem_vmap_locked(struct drm_gem_shmem_object *shmem, ret = dma_buf_vmap(obj->import_attach->dmabuf, map); if (!ret) { if (WARN_ON(map->is_iomem)) { + dma_buf_vunmap(obj->import_attach->dmabuf, map); ret = -EIO; goto err_put_pages; } -- 2.36.1