From patchwork Wed Oct 19 08:28:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5553 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349458wrs; Wed, 19 Oct 2022 07:11:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6BAK6wX7h/QgGZL19wcel4kAFLwCwbENsgkRF/WMS6Ni07qN5dWNLaQS/ga0LQcDjYt5bF X-Received: by 2002:aa7:9212:0:b0:562:b5f6:f7d7 with SMTP id 18-20020aa79212000000b00562b5f6f7d7mr9044361pfo.70.1666188718843; Wed, 19 Oct 2022 07:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188718; cv=none; d=google.com; s=arc-20160816; b=zFvu/TzK5qa93Et2rt2zubdes4vfnsIxocUzW8bfjOG6+65x6LnxXeYtmQrN0fFK7h 0DcGNJJ6Sr44KuirsdLQGtxocOUOpNhcVebFT2YwllNzlMN0apeWqqWuISaOnORxroEj DU78tFpVZ1n8idij4Qw9DL9w9H1RhCw8VotmO7PmBHdidGLSDfaSPc5fdVcnSJfl98qs dICJCC+MD5MYwmSxHl/sh30B8WLqKUDJ2yOFR3WmjA3bKc+QFFSXHcCg8xl5aNgU5XMY /zPYUNrBUCd/CS6t5dYEQ5XyK0aSMfs4UXNNM+F80eFFBaWnwVbsJLIJfJoKC2DJWnp6 ZXCg== 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=xCOtRhyrOaRz3C/U/b9UnrjEOo9egQgdvr8EqqEf16LO1YaDpnvYBKzKyKjkVRAIey IGCgtYVXa1/BDK8cD5N7ZRz0kW1TDZQ3YdNdTkUnSGviUrFhtC52r78GMemi8uMcyNXu 3xHkGkeveU6lfrrdeXE4E8FqZLMmenRmrAix+hcRlj/e+fUuSKJTjJ4/d8NOtslv6ye6 NCzIy2c6QW02Jsb7PE8+7UhtXlw7VTCNo7rra3AkgpdhwfCNIjMMIUyBMC48JcamyjAg NRHFIrq9HWAbsjZMq+uvc0OsnCkvbtV1QBWqD3T2T9qblJx3YOkVQKzoqmFwfH5CF0vV 9y9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sShcR+JJ; 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 h191-20020a6383c8000000b0046ade103856si17674337pge.308.2022.10.19.07.11.36; Wed, 19 Oct 2022 07:11:58 -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=sShcR+JJ; 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 S233787AbiJSN5K (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233846AbiJSNyK (ORCPT ); Wed, 19 Oct 2022 09:54:10 -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 C6C531BBECA; Wed, 19 Oct 2022 06:36:49 -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 07F01B823EC; Wed, 19 Oct 2022 08:56:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74014C433D6; Wed, 19 Oct 2022 08:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169763; bh=xvO8OBdejBy1K8qqYfbWb8o0/2MXHQoNgGR1UEb5JqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sShcR+JJdMI3GxmYK8scbbpnx8ukmbZXXfXPZn7DEKBFxtc10r+MzwhUNVfn5TDcU FY1VPthc9dwX4y1qDV9cgHC0uTrEtj6RrmZKsmrUQH8ULpk7s8wbTWcbXwh/seqGi4 Hacw84s10Yrz9M/dNaxCTyEliI5L9GQZkNgloAPg= 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 6.0 399/862] drm/vmwgfx: Fix memory leak in vmw_mksstat_add_ioctl() Date: Wed, 19 Oct 2022 10:28:06 +0200 Message-Id: <20221019083307.564646588@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747125502077101005?= X-GMAIL-MSGID: =?utf-8?q?1747125502077101005?= 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; }