Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2889814rwb; Mon, 15 Aug 2022 13:23:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR7dzBzoXR1MNp1LScYRg5yEa/cMQhYxh89tn/FyaX+9sh1/KuVXZfPCD2IxnK7zElHegsvX X-Received: by 2002:a17:906:ef90:b0:730:9af7:5702 with SMTP id ze16-20020a170906ef9000b007309af75702mr11496383ejb.107.1660595027624; Mon, 15 Aug 2022 13:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660595027; cv=none; d=google.com; s=arc-20160816; b=qb/lJCw94QVWhWc6uTow9hT0tGDDjUUs7/ssgZvLCNXn3FD8uXfR50uvjliIUvrwwd PgIvob6q+X+cDp9t9zeqFRlM6b8Kcr1HuN1wbWnPeWh9nL/0dInmBMmrNWym42ZflUO6 AiSMjEk/KIAaL8JF34kuNd17qW2cYQAa0o/OA6y7F1J4YPx6QVeDqsR/NjjPuub6fBIF jq1MHusBQOTjscWnClvquz2dntVZx15oqxfJnwHbRr+OAi7T+6mZ8FMkPYpIxh0UbFRd sTlOeO4KoionwumMOzISj6FDbRaKDTO5TgVVAhHKD67N8wpqhl1l+0WziZSR+z2JNjiG /VpQ== 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=1sj4MCt+LD85dDNxjqtfXAS7ROesrYAaUQas7OYUAQk=; b=LXSzsEIPXQ99hfu7CvwX3FKW8tiL1J5eNSeZ+J2mE7UaU54A2I6i4UmsrKSMBp1kez /zmv6u2flsBIOupWDFlRQ83czhnyDAYjr4Jk3NWltEEjwmKCsdyNDFmrWZkB392HYWuy sta49svAjT44UoXiCIQS1LNgwPQigzX5XTMheR928ApUqsXO+rxGw5IM1YGQrHOhtq1F GmHeMIvSscfbf6ZEU2i01ngfwK6f6WPVtWvq0iL25Xgx+s8sOW3xxiKsP2yaQ1aoZ3KG ysIA4ss2VpLq4T7L6cJmxA5OwcutJjLbydNFjq7Eg6tcWFdnXFXPfjN40yHapB912RSc Brhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IcuoVy93; 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 oz31-20020a1709077d9f00b0072b3caae89asi8475608ejc.341.2022.08.15.13.23.18; Mon, 15 Aug 2022 13:23:47 -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=IcuoVy93; 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 S1346211AbiHOUPk (ORCPT + 99 others); Mon, 15 Aug 2022 16:15:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346562AbiHOULn (ORCPT ); Mon, 15 Aug 2022 16:11:43 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9086C491C8; Mon, 15 Aug 2022 11:57:56 -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 sin.source.kernel.org (Postfix) with ESMTPS id A7E2CCE129D; Mon, 15 Aug 2022 18:57:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62D8DC433C1; Mon, 15 Aug 2022 18:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589872; bh=Qk6A5z5Pblx3Ub+fE3xuwH7Ai2Bhm0bhJE/MIKtqHqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IcuoVy93Fsj2RmE9W9/mt/+Mh6pK0FW6AwJNUOgoGvm6q/aTkKFQrp+Dl8Kqu641S LPe/wsWsdkXVC0aLC3YH2l99TQVTLQklWUUCDsuZNHgAqh+RwYOW8Ep97vU+3xiBOS 7N/FCVm+qF9BX8Lag8pFBzUgbIZqYE1LQEB8x34U= 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.18 0076/1095] drm/shmem-helper: Add missing vunmap on error Date: Mon, 15 Aug 2022 19:51:15 +0200 Message-Id: <20220815180432.679327225@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 @@ -302,6 +302,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; }