Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5213778ybl; Tue, 27 Aug 2019 00:54:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyV9nLU4cd7Wsxz6eCyE8KWiYStyhCOMxAVguVOrEpFsZ8SpNOy9FqUdwlj20xKGd6CwI+X X-Received: by 2002:a65:4507:: with SMTP id n7mr19293953pgq.86.1566892467187; Tue, 27 Aug 2019 00:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566892467; cv=none; d=google.com; s=arc-20160816; b=tlif0HlOK8Hv8KzPNoVK0GKvSb/NPd/vigOEslf6kBbk33POUZiY3d3WEPs6xDU2Y4 dbPunChtR81szeY+x0Bipotorexsr/DMqn+eapXK1TXRPyibwnhSMmjnX+MUSqpX7Xke nTDJ35fr3nahNijuztZYqISRNL6oSbW/FwegcseWrjlrbaBChwB2pfywG1pXqZPyThml CC2gIKRB5w+30La/TCnK/7Q+hj6cb5TGPjCBXlamZf4vewi9099gx4VYA1OWRVO0Hgr0 4omtcByy9LpiNM58ZkVPKKipJHV7T8mDBRKiuY/CpGF/4B5j5l9e8mMWXwu1AIN26XdZ lFig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=usLorbAN5W/cR+nfdURgKQ34HEa0xfSxtOqUOtFB2og=; b=A8evtAJWhaWHr7D1q76Ci7j6oYk8/JmtgFDwFWdwLt8QaDAx1hFNv6QFi3tM7JQva4 VpRjT26Rgpexz0GRIPgCnR15g14YEPeDL5QdpEOiK29Bwu14xM060KYd82WZ9tbY18mR xYEeirGW83YjgWmuq51QT7E3BaGiY/N84JB3VgI0XN22WCTjpxTTGxY5g3h/Ym9ZQK0G gr00E6Kh0hvDaDvc8Z8OV3cNTlJKevo5/X9uJuILXM6yJ++wloFnhXWQHSJsX/d0esqC FSR5Ayr3yoQLrTtIojrjmEc1PmcCsvk2JsvIzTb82VSjX1/jYWUc3dYcOtY6Vn5WduQR oDwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=av7tgDEO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9si1911772pjv.72.2019.08.27.00.54.12; Tue, 27 Aug 2019 00:54:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=av7tgDEO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729610AbfH0Hww (ORCPT + 99 others); Tue, 27 Aug 2019 03:52:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:44274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729596AbfH0Hwt (ORCPT ); Tue, 27 Aug 2019 03:52:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3161223406; Tue, 27 Aug 2019 07:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892368; bh=HKWTmzBr6QwxBD6e2SZEEs4GDcyNy+TTL8HR53n/OQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=av7tgDEO/GqWpYQrI9UGrHrB2I1TitCM/xZOwkfmDXNBQZI6/iNrYxkLz6OEiMwcK 3Uf+v4i0GRHMmwsuTVz3XUI3EfiGz3/vA+/CRAfmaKHljcjpJHpUY/tM0RvRenKqqT YDwT+8fxwik2lQX8mCel5ymg7aNl67tathhOPIhM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Deepak Rawat , Thomas Hellstrom , Sasha Levin Subject: [PATCH 4.14 31/62] drm/vmwgfx: fix memory leak when too many retries have occurred Date: Tue, 27 Aug 2019 09:50:36 +0200 Message-Id: <20190827072702.539257121@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 6b7c3b86f0b63134b2ab56508921a0853ffa687a ] Currently when too many retries have occurred there is a memory leak on the allocation for reply on the error return path. Fix this by kfree'ing reply before returning. Addresses-Coverity: ("Resource leak") Fixes: a9cd9c044aa9 ("drm/vmwgfx: Add a check to handle host message failure") Signed-off-by: Colin Ian King Reviewed-by: Deepak Rawat Signed-off-by: Deepak Rawat Signed-off-by: Thomas Hellstrom Signed-off-by: Sasha Levin --- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c index 97000996b8dc5..50cc060cc552a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c @@ -300,8 +300,10 @@ static int vmw_recv_msg(struct rpc_channel *channel, void **msg, break; } - if (retries == RETRIES) + if (retries == RETRIES) { + kfree(reply); return -EINVAL; + } *msg_len = reply_len; *msg = reply; -- 2.20.1