Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp972992ioo; Thu, 26 May 2022 21:08:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh19PvzK/fgKENV+g2SEGLfQ7ljFZiohzm14xrqOsnoj2gHCXEt+sV1YeKbh7DcIQM00II X-Received: by 2002:a05:6402:4411:b0:42b:a773:4800 with SMTP id y17-20020a056402441100b0042ba7734800mr15117896eda.37.1653624480899; Thu, 26 May 2022 21:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653624480; cv=none; d=google.com; s=arc-20160816; b=Coqm4KGO2Y1MTTa0IdQqr8ALQUxnBYoMW4rByn7YkR4AMFAzXYVNOdzg5/WwM1Awe0 UD0ESDdsqLyu7u91FLiwZFbB9m8MNkvMrZeWaKQ+zP23vAXggk0Yn5D20IDZt4DWpf+q vJGi8X7I3sj6EVEYu/ZRMWn6dFWQtDzWlUwnxZpc3WPNDTXdu4Qb8Ji6BSS308Il6A3A IrhzPhxTrLVmylH4ni5FRrK7jSikP59xbtsrk1Cx0h79SCIrtxVaKTnKB57T8jLBWVFM BslARvsnHJPH4sCCbk6l751qOVkRsJ1aAuN93rdeIlyaMoMGLVik2KDRpoh0u/AYwgEg vh+g== 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=tiAlstuRyebN/rUzwPiPsyktk85NNOXqH/NrPGQrJn4=; b=ruhkEnrVg3GI58Q+wt0F/TFd21ohQyGFuFWRI+X1zLNn8rFguTnascHy2kqXI47lyv KV5EwlChjsQwQkCYYm3UKh7tl8Lxa18gb0HX78mFHWoAvW4A0s33nWd6uweXnK9XVdZm HcHqKAGlwoLH8KtJiP3UL6K3Y3bD/9qZAcc6JIIU0KgJRmLV7P+xH27kYvqiRJu7UYP8 mlIYBH1+1G9hKNyg5PorqfMXSnGjJaOGawSm7XBwQq2pctVw4OI+H6661FHC5rmHHTNu L+9LQz7tkOJ0AhqCUvYdhxgN1xXakUz4kG96e/YMwRW21Yk10IcSSgtYlk47/EWyssNH 5npg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=eJE7wbdh; 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 x19-20020a05640226d300b0042bb1eac23fsi3696783edd.463.2022.05.26.21.07.34; Thu, 26 May 2022 21:08:00 -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=eJE7wbdh; 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 S1349603AbiEZXzK (ORCPT + 99 others); Thu, 26 May 2022 19:55:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349701AbiEZXyr (ORCPT ); Thu, 26 May 2022 19:54:47 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8016EBAAB; Thu, 26 May 2022 16:54:40 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dmitry.osipenko) with ESMTPSA id AF11D1F459E1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1653609279; bh=+dsYPBe0MtL9U6A9MrplQ6Fk/h2u9i7WdSCVoC7x6z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eJE7wbdhuCKQ7ARuAxD2jakaOllV4XZp+wGbuzmwdjZ3AIJXdidlMp45UgBjdSOOD glpNR2ysMVh/exq/dF/BlNApylcmRvmKbtxJTe3lAZ9yCQHa0gOmlq6OmSU4HNZ8AQ j/1OuqQJfB6lruRLryGyl0wPtlwowLPhFkznUgbswyosxFmRIUNzNITJOclCMrRhnn 65Fat7aAvOkrbl9cliJKjoeEIg4SJmxvXHlZ44NBvwxUzbEvT10c6y0M8rp7mmWGF4 9tQvQ9uNi7WLf/gkC4tjw1g2Jff4+nRrg4Fick8NUGQ+gbgjFX/RBeFTv37OoCYeNg FRZZFSrdn9H4w== From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Daniel Almeida , Gert Wollny , Gustavo Padovan , Daniel Stone , Tomeu Vizoso , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Steven Price , Alyssa Rosenzweig , Rob Clark , Emil Velikov , Robin Murphy , Qiang Yu , Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , Thierry Reding , Tomasz Figa , Marek Szyprowski , Mauro Carvalho Chehab , Alex Deucher , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Dmitry Osipenko , Dmitry Osipenko , linux-tegra@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, kernel@collabora.com Subject: [PATCH v6 10/22] drm/shmem-helper: Add missing vunmap on error Date: Fri, 27 May 2022 02:50:28 +0300 Message-Id: <20220526235040.678984-11-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220526235040.678984-1-dmitry.osipenko@collabora.com> References: <20220526235040.678984-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_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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 mappings, 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 6190f5018986..54b0ba28aa0a 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.35.3