Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2811445rwb; Mon, 15 Aug 2022 11:49:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR6/aBDkWmNYz9lNOZdc6r/H6HJaeu175aEa6jV2l31CG0N2qtEZQVaSBRDZEnhjtZdMnwj+ X-Received: by 2002:a17:907:6089:b0:734:be0c:e0cd with SMTP id ht9-20020a170907608900b00734be0ce0cdmr11324070ejc.474.1660589377376; Mon, 15 Aug 2022 11:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660589377; cv=none; d=google.com; s=arc-20160816; b=jgbSJhDZO3EvU1JyaUf1hiVYrFxFFh4/bx+Pyp/g6jiyTMCAV4ojBn0YjvM5oViLWe ZLU7oxAWxf0kUulYQlfrj9sf4WFNu9gXxP1bAXffRLfhlq8Z2TQT5wsIZG1gnGz93Go1 ovjmsPtrEGw+SlhP1GkRWUR/B9dy32DJ6wIFA/0Hq0ESewH06hzb22DWc4k77sABcswa b2PyJ7qYGYCXSegA+hxwIoosCwDka4u0ZdIvyt8ZU9wDG4+S7ncS/zrAVObCFoaNEyKi P1/G0wphBEfyhclbul/TsjahGffKlIzQMv/Qbe5Rqldeubr5123Uw83F9AJhY69nEbSf 9c9w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sDXW/lp3LOggRfsfx5gPCC70eqdubN46TKyL9x45L9M=; b=aoLc1V/hw/Q57G1QB6dI3eii8VFVI4/tcClt4nsbKt++SpG4XpqCWaZTPu5X1qvFMb yogwljBxXXr7UnXS3ECxTvn9WNzYyclodEnEtjRZpI6hDkNY7ze5tFkE872HjODl9OIp Yb51+I1W1MGbkN4Rs3xktYPQ3eHax/s85gmyHzaMXncmFItnU9CMflglL6xYapx9LQIg 7UAcyzYGbSe+8VGp/8zh8bUTWViOQqpXC+PCEpNXVX99t17Bb/NPnkp8Rl5IWvLu59UT uMxKNpxF468MN+NrOD2Q8tFOcIJ8jPIsiOdH+KQqa3FZszHbREHyiwOxyu8u6wmuFvWI Q4Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YmYojfom; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020a50ec10000000b0044202417985si7758858edr.108.2022.08.15.11.49.11; Mon, 15 Aug 2022 11:49:37 -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=@linuxfoundation.org header.s=korg header.b=YmYojfom; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241292AbiHOSXz (ORCPT + 99 others); Mon, 15 Aug 2022 14:23:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240497AbiHOSXU (ORCPT ); Mon, 15 Aug 2022 14:23:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D32432DAB4; Mon, 15 Aug 2022 11:17:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9751C60685; Mon, 15 Aug 2022 18:17:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81006C433C1; Mon, 15 Aug 2022 18:17:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587463; bh=FcXVIpsPD1m7e3h1Ko/SBA2xXRf9W5Pg4zZfDjvy3Eg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YmYojfomWWLr33MtZfhxxOnDT55BROJj54w82YMpcqs4A5KT0fPy4Dp7n1Hpveoh+ KZjRvhfjEfB/6oI0pnFaloeI+sJq+wnlhb6KJL/unG6taYY6blwJ/Mx56Lc0GPr7VE DQnXfSn3L1ISKdLPsSmdpIOXtNSMGAdxjYufVsac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Daniel Vetter Subject: [PATCH 5.15 061/779] drm/shmem-helper: Add missing vunmap on error Date: Mon, 15 Aug 2022 19:55:05 +0200 Message-Id: <20220815180339.865246410@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Dmitry Osipenko commit df4aaf015775221dde8a51ee09edb919981f091e upstream. 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 Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220630200058.1883506-2-dmitry.osipenko@collabora.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/drm_gem_shmem_helper.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -275,6 +275,7 @@ static int drm_gem_shmem_vmap_locked(str 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; }