From patchwork Sat Oct 22 07:23:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1096682wrr; Sat, 22 Oct 2022 01:05:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+LaVPSX1TF17bCAFH3SDzCohfi+6JQfXwVOZA0mEYFNFOkipyyV2mGslqHP4qRxJ+xHZD X-Received: by 2002:a65:6d1a:0:b0:3fb:2109:7b87 with SMTP id bf26-20020a656d1a000000b003fb21097b87mr19274680pgb.127.1666425941070; Sat, 22 Oct 2022 01:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425941; cv=none; d=google.com; s=arc-20160816; b=pFduAR5I2l43bhjGPvGoD6ULN5N4amvhpCXdp/j0Ue09GBxO3MQGd8+3GAHoUyTz3B TibXu8rV57VC6Avm2niN/12U58FXo4WXq1aNxQi7pSJ1JDfzFfqoJoMkC5WDRDrv6939 TNk7GN0YAfes8h/6yD9GwKVBUEmznuU5Gwdt4b42LdzmpI7Geu2PH0qKIoH084+WQ9B2 2fKLTIfJ2rkN909B8mTySuHD295Ar9RwN0KNsDIoPEb4yIg49EMqVpF54sidkQj9BIbx K2aR2bJcsdR/la9jP2GzYpBj/5AKpKIXoNe1zght9HKmrw97yLBijLmIfkq0THDj41yS 3orA== 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=DOuvRinasGs+eBIL69O1zy47APGnMPHF0l9YuIdI0kk=; b=pEKAQpOlMStlwaek45REPwdaivpkh33Mxp1kVvmTt54FKrEHoMKDejKfCbAITLWhgk lrsxpU3qBZnX4gM7KiJ+z5LD3YVaBsuNLWIa6cPanuy8lq74wB0ky2JjCAlxrSYelqsa dHB4X99EzDb6p1c8E0ZayTZNT48S5wKPLF8X5KJJpVYdRoTxFFRrogOr1yRjLFxW/Ymk dyHI2TpgzfdmLUL/QfNZrdhN9XqlCkmPgJ/QmY3qUxbxszDFw2WrWJ1HXr9ANJRhiu1H RroXQlF1nEJYUY1CzhqPw+Ru1YmKEy1UbkJSWZ/xe7/0+l+11pFizRvQuX6OXpoTIEwp ejBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EQYwhsGG; 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 o2-20020a170902d4c200b0018552c4f4c3si17823437plg.615.2022.10.22.01.05.26; Sat, 22 Oct 2022 01:05: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=EQYwhsGG; 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 S232935AbiJVIE2 (ORCPT + 99 others); Sat, 22 Oct 2022 04:04:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232439AbiJVH7A (ORCPT ); Sat, 22 Oct 2022 03:59:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CC8A173FE8; Sat, 22 Oct 2022 00:49:06 -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 314D460AC7; Sat, 22 Oct 2022 07:49:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4879BC433C1; Sat, 22 Oct 2022 07:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424941; bh=xvO8OBdejBy1K8qqYfbWb8o0/2MXHQoNgGR1UEb5JqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQYwhsGGjLj3UMBFgDAZZHSx24aCMm9iORVKTQ+RVS/6AjwhQW8Fr054abjsegjFQ a2w7Z/F8R6EV/f6gpUT4jsLr87XnCf6al/umTxty/gXreuCWAusCzkDMdbUg63s3ms TAHejG+6Juv+BaDjLQKyNezZufrQuTWWJry+7s90= 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.19 334/717] drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl() Date: Sat, 22 Oct 2022 09:23:33 +0200 Message-Id: <20221022072509.880642724@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747374247678803059?= X-GMAIL-MSGID: =?utf-8?q?1747374247678803059?= 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 2aceac7856e2..089046fa21be 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; }