Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3024087rwb; Mon, 15 Aug 2022 16:21:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR6CCuFTmsRbbcOs/oG/Fl37eP+7JJiyBdoo42JbUd+gszqsQFNuI56MA0ujrF1/h9aKHxg2 X-Received: by 2002:a17:90b:4d91:b0:1f5:24a:ff7e with SMTP id oj17-20020a17090b4d9100b001f5024aff7emr20530541pjb.194.1660605581070; Mon, 15 Aug 2022 16:19:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605581; cv=none; d=google.com; s=arc-20160816; b=wqdZ0cAe372QP8aOANLpz1eLk7O4oem80gRBSqW2EvoOAJzQv9XWh2KcCPkPrerUJb VZRWBd2ONkEnX/vkii32tVynnIdIvS0atlPBc4Xb5mJbXff7rLISAQ8Af5TtXNFzZZ8B Zk3bima5HdqwYM9A/o9ozCbk+Xy42rUMDPv8ybREjPIUSZ/C8ZSVZ8JKybkcHqZIUYEc CKs4B3dyD/nqbrKaQEyD/vovSJxwKUcyUy6aLgWlHAS0irYZs7ua0vmHzh4Lauf5RHYm XSDzna2XP14i9qcnzMi3xdRvr5YO7ITBBKdvmHtXwkfFLIDpGyRey/AHoqTD3o7ptQCP q5ig== 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=UTk8/r4q5e18vP0eyZiMAO5ckwONc3zwcucGD3/UzHOX6Sm0QUt5zQwnDMr9bL6B8P pTHK+hZRRjkylnewgwoF+D0/+LTM4RLiyKb6jLf4dX/Xwhx4Wd43D7Vur9zTNUTbvam3 QtfRTmY7cDP04c06EwGAFXGk3xXdqhgFds3FlR8FYWqrLf/aYJ+gO+UkiW9LCoY8v+M+ a1vcS7f+ytDgLTmIckrsjwB6GIUgBy22J1Ld/sclvvJ5Wx2rjqJAPflO70mgT1e771Wk Lckt3HSz1Gh7yCeq5Og60jUbL2Kw5B2YfSPVuWu1ZDWCoqmI4GWcX+IN5djdQ8PQ5UUa 8g7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1Q5g36dI; 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 m11-20020a170902db0b00b0016f975be301si13407896plx.334.2022.08.15.16.19.30; Mon, 15 Aug 2022 16:19:41 -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=1Q5g36dI; 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 S244658AbiHOWJ1 (ORCPT + 99 others); Mon, 15 Aug 2022 18:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349667AbiHOWGW (ORCPT ); Mon, 15 Aug 2022 18:06:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BA68117778; Mon, 15 Aug 2022 12:37:51 -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 ams.source.kernel.org (Postfix) with ESMTPS id ABCE9B80EA8; Mon, 15 Aug 2022 19:37:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 073C2C43470; Mon, 15 Aug 2022 19:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592268; bh=Qk6A5z5Pblx3Ub+fE3xuwH7Ai2Bhm0bhJE/MIKtqHqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Q5g36dIl0FNdXUCgPuA2kIi0Dp2b2vepvzyuAD/q4jOsinfKJtw8bW9UQrYfjh2o ONHtx9KZXc+kR7ynabhxDLtpZ9H8lu5kuV/sRiomvyd28jHyq35TAYcHObifPMvJ3t 5KSpAzZAG+FTP1+smayMABHgiUTS6fHb49qTcZuA= 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.19 0083/1157] drm/shmem-helper: Add missing vunmap on error Date: Mon, 15 Aug 2022 19:50:39 +0200 Message-Id: <20220815180442.858553113@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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; }