From patchwork Mon Oct 24 11:29:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10261 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp643946wru; Mon, 24 Oct 2022 13:43:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CuclH7sBteOQQVAiuRYwti+nf4md3JP5FHHlb0QM+HxEpbPpI+rCu2fMTEYXytLSr2bMK X-Received: by 2002:a17:902:8205:b0:185:33e:2a0e with SMTP id x5-20020a170902820500b00185033e2a0emr34527516pln.92.1666644205273; Mon, 24 Oct 2022 13:43:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666644205; cv=none; d=google.com; s=arc-20160816; b=fxAHDRr4PiO3lYlVMEUosxwL4AOTjJal6sKWIZw3PKXHJumd0+0ELdu7WOJwxuUJ5w t6vzpxh02vzQ3yhGqqO/N2hW+DWOHTFoWzbyTubADaOx4D/AzHSng96u5nw5LVCvtnrR b3gvTGOL7etN4O0EHG6hMg9o0MVXcbH+ffQdBbHr+7S6GgAeUtrH+wEfJu6M8hJo1YeD XCI8Djd4jNES3Z9X066Ckp7Zeh2J1bFkMZ7uH7Ru9Ge1xBpbVrCmcsCHaJ7iQwwQCnuI HmguOGG59/HKBSNFSElxdc//ieFML7yn3AkE7xoxsYMJw4mHYqCp9p00Wdlt4pMkvHWm 7f9A== 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=mFRyUnPfjw6lqe54+KrSI+vX1uQ4QWy2FCsLkcAO48o=; b=hXp/lHI7lI1MK4mEPrzcXRicng+SgclVgbHnqWeyM+IvPXqgK41fyV8BPfdpgJaGEM NXaYH3ivw2ZUPaitl7Gw6o8GvsbkvLouN+hqt+9drtBZgeLS92TbHxxLhTCMHIPnhf1a Y53sW2BaNXIvSRSIDd9mj79fQ2TzISzklhVjDoIkepDUUMxn977mOTQI7twNCuNYPQMO Ep5R18lstjyTlPF6g8gjNp7ALDrJMx3jV3TfQuUgDuANvFTFGdJ6TtUoXtDltjBLUn6a f7kTgsBKR41O0/JEYanjsSyFeVNpoT1epeoaWWTOtP4yMOFi2KkMKThKhNKHQ1FflRYX qPMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EP5/7Wnd"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o33-20020a635a21000000b0042b5035d717si657916pgb.44.2022.10.24.13.43.12; Mon, 24 Oct 2022 13:43:25 -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="EP5/7Wnd"; 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 S235021AbiJXUmq (ORCPT + 99 others); Mon, 24 Oct 2022 16:42:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234923AbiJXUlv (ORCPT ); Mon, 24 Oct 2022 16:41:51 -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 F3E281BF217; Mon, 24 Oct 2022 11:50:47 -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 2F1AAB819BB; Mon, 24 Oct 2022 12:44:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88429C433D6; Mon, 24 Oct 2022 12:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615475; bh=OMz25ULwzNaH4rvgRpjfgdUmZmET04pu8lXGyabomr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EP5/7Wndlqaf8VCdt3oXNqJus3ZUqlxsYqH5//why6//WFRoUKhxV3Bwn0vP55rQ+ m0spFLrMNITkSEpYtf8oQ8iFORZD9/ZkWw6c96VkVESeE0Mowb+rEvolHvV/XxkwIv k08SorGPK4qhXgi7MVNKt1lFYmDzkRiWGte17lCk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Martin Krastev , Zack Rusin , Sasha Levin Subject: [PATCH 5.15 236/530] drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl() Date: Mon, 24 Oct 2022 13:29:40 +0200 Message-Id: <20221024113055.779283653@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747603114479101093?= X-GMAIL-MSGID: =?utf-8?q?1747603114479101093?= From: Rafael Mendonca [ Upstream commit a40c7f61d12fbd1e785e59140b9efd57127c0c33 ] If the copy of the description string from userspace fails, then the page for the instance descriptor doesn't get freed before returning -EFAULT, which leads to a memleak. Fixes: 7a7a933edd6c ("drm/vmwgfx: Introduce VMware mks-guest-stats") Signed-off-by: Rafael Mendonca Reviewed-by: Martin Krastev Signed-off-by: Zack Rusin Link: https://patchwork.freedesktop.org/patch/msgid/20220916204751.720716-1-rafaelmendsr@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c index e50fb82a3030..47eb3a50dd08 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c @@ -1076,6 +1076,7 @@ int vmw_mksstat_add_ioctl(struct drm_device *dev, void *data, if (desc_len < 0) { atomic_set(&dev_priv->mksstat_user_pids[slot], 0); + __free_page(page); return -EFAULT; }