Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1194320rwi; Wed, 19 Oct 2022 07:45:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ueE/0KxAM+LpofS8sWFW1bccA5Lk9Zim5cVIg17v2tGo+q59oQWp1U81gEAeGYrGK1cDm X-Received: by 2002:a05:6402:176e:b0:45c:9e48:27a5 with SMTP id da14-20020a056402176e00b0045c9e4827a5mr7837554edb.53.1666190740062; Wed, 19 Oct 2022 07:45:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666190740; cv=none; d=google.com; s=arc-20160816; b=CBPuww9Zl6GsKbY8bz6VHlkumfFzq7qx1bBZRhxd59lmEXpvhHxHA4x2ZsPkPi6sug IgzmVmjjKZaz7uKMNhuLDcOW5QiQ8I35Ba0NndpzU9IVVLfPV9ixSZIP6Hr2RdzuaROf HUUer87+2sWXglzr4/Hj4KimHTu8gc/5hMxlr3ulYBp53bqoMR2LKXz1NhdSZkk9CBKX ToeyuyHRKClR3Fk8t1TS0RnSkOmdY6gf1in35z3S/GQrCtO4ubcNTgqwB0tbjjMOyX1u z2LB8n0/5Xjos2bo2DbGBvhyF6IZcMJd+F+sEdFrFfjy4nAnq8KAkXV3OJiAf0LLzuuJ /+Ww== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ae8-20020a17090725c800b0078db794016csi13230671ejc.907.2022.10.19.07.45.12; Wed, 19 Oct 2022 07:45:40 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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; } -- 2.35.1