From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x225tkNGup1ry3JdQjfylLhJgLA/YKGPFaLhdyQD6JkTMCnqU7nkGkFQfWZBIFCku49dETmvO ARC-Seal: i=1; a=rsa-sha256; t=1517256490; cv=none; d=google.com; s=arc-20160816; b=vSc75yK8fkfhnSotOAsOt2G1Xjc3XS+B7Mf6RP8p1JsMwD7r54vzc0COJgAQ5ircka 0mAtbU2JKLeTkwt17JY0aW5EE8qBmqIsobjbo831yo++fDHtPq2nTBU9T1D2yGXIMFrh OaWATMm0r8KroaeQ/yQDdrGyiyCht1uKHbOoyxlWeDNQNl166qS9O4ZOUXIRGC1J1M1I jtMIsubJNORrsTdjDbzcT0nBTQvezwfPBIiDBOzR0T7+swC2jHJg5woITsuCySrkIOtT 9fLEnxMq91DqwL2Ik1DzI+rU/+JhIcwpsUeFL+3Ayz2JM3N5nDMuPPCxqWVLqVhl2RRu 4j8g== 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=ahGzKcAhJL9giABNduV/QnjV53yBJVmq/ofBtn7qut0=; b=g4vZnFtKSeSHpDVYCc8Y4yJ7nptslfOuBtQjHrPzgEOqD2qrHx5dlWtQCLBw7A1xET aU7tbFFpHD8VBTh9u3z+3N/c2mU6hF+yP0STQrjFwpZTXNM0DasKTI5ZJ0TgiPKijPcK NTL8dTlEOv75+MhOzl2BcnzhLmC1+YGFlTgxmkpQp8dBE3Je+ipl1F7KakNpAjqwauRT KuLxiNuqD26pLUIhosZ6C+LNVYQ4/Y2NYBd95bY4wJewwXHasKgzkIWGjwcnRhiTAfGd IbRSLkmXQaQ0ZCRRw/z40Tle+VZNnRODzLbPRdR/Z+kui8gXbVFEPOvwurVtaLZdQlvn 9FVw== 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 4.14 59/71] vmxnet3: repair memory leak Date: Mon, 29 Jan 2018 13:57:27 +0100 Message-Id: <20180129123831.556452969@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123827.271171825@linuxfoundation.org> References: <20180129123827.271171825@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?1590958742016560003?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-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 @@ -1616,7 +1616,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->data_ring.base) { @@ -1638,6 +1637,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; } }