From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x2244Bdu1F00ZwpP+ZGfhtogSFIIV7XqEjRHCoI4glrYTQ3GU3q7LBWQepMFjp7Q4j2qTcyul ARC-Seal: i=1; a=rsa-sha256; t=1517256988; cv=none; d=google.com; s=arc-20160816; b=sy6/rKrpB+tKAY5lA8B/J35E5cJpdutu6mz19+xL477E6pDzoasEgb4IBaVIghaqS4 6UYKl25fkDCxZh682Gi85yXXHribWQ0Ew3x6uBxY3f0nhaA0FeVLr0AnkEpWDMsf/ZxL 1oskGTtXnuv/HQQALfx/XsdGqF+LK00NvD/1IVuYvs2sV5SUGtbuZXHrPCirV8dCwNVK bwFAH1E3Gu1ZF8MGY3AiZG8Yrl4btNxPB2LyExJvO8h2YpZ1garsYfTYLSwUwuf19rQd IJ8VXfVCzonJNVe8KCtVop47Jv7Ra2uks8cvZbPGv+RPXHHtlmufVa+mn3G6R/2WGLVN ikzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=BzMbJ3U8uNSVYp62mdzgBOtKXf7kV/GEHS69hNx18yk=; b=Ek9bN/KBAsO73XksMZDmQLmcl6Ps1LFiYpQUgClwJoBgA8EiyyTmHQ2RlUxowbdw5g K4ytCF1IpW2qurZx2JQWL7aoutam9A9W4Z3myHXU+M/Aa5pU3pp52pGr4iJoxvay2Iq6 Jr3Mvay1cUlWuNcNJSnrzmmTVmPwYVpCChESw5lxMDu+9uQpiAvK525KmCpzH3AHzfOb vrfxWygJZBYDiCuP8XFBgEobN3VZj7GSTJGotKu7zril/eaDXoxO69yCK9fkYwso8Pqx fxop2hkOsc3qvOr10fQVyLMoIG3Gq/ycMIY8sFW8librMmEZUqEM43Tz/ymtcpv/IA0d reRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neil Horman , boyang@redhat.com, Shrikrishna Khare , "VMware, Inc." , "David S. Miller" Subject: [PATCH 3.18 49/52] vmxnet3: repair memory leak Date: Mon, 29 Jan 2018 13:57:07 +0100 Message-Id: <20180129123630.319409885@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123628.168904217@linuxfoundation.org> References: <20180129123628.168904217@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590947331498149180?= X-GMAIL-MSGID: =?utf-8?q?1590959263167132056?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Neil Horman [ Upstream commit 848b159835ddef99cc4193083f7e786c3992f580 ] with the introduction of commit b0eb57cb97e7837ebb746404c2c58c6f536f23fa, it appears that rq->buf_info is improperly handled. While it is heap allocated when an rx queue is setup, and freed when torn down, an old line of code in vmxnet3_rq_destroy was not properly removed, leading to rq->buf_info[0] being set to NULL prior to its being freed, causing a memory leak, which eventually exhausts the system on repeated create/destroy operations (for example, when the mtu of a vmxnet3 interface is changed frequently. Fix is pretty straight forward, just move the NULL set to after the free. Tested by myself with successful results Applies to net, and should likely be queued for stable, please Signed-off-by: Neil Horman Reported-By: boyang@redhat.com CC: boyang@redhat.com CC: Shrikrishna Khare CC: "VMware, Inc." CC: David S. Miller Acked-by: Shrikrishna Khare Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/vmxnet3/vmxnet3_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c @@ -1420,7 +1420,6 @@ static void vmxnet3_rq_destroy(struct vm rq->rx_ring[i].basePA); rq->rx_ring[i].base = NULL; } - rq->buf_info[i] = NULL; } if (rq->comp_ring.base) { @@ -1435,6 +1434,7 @@ static void vmxnet3_rq_destroy(struct vm (rq->rx_ring[0].size + rq->rx_ring[1].size); dma_free_coherent(&adapter->pdev->dev, sz, rq->buf_info[0], rq->buf_info_pa); + rq->buf_info[0] = rq->buf_info[1] = NULL; } }