Skip to content

Commit 1414a1e

Browse files
nhormangregkh
authored andcommitted
vmxnet3: repair memory leak
[ Upstream commit 848b159835ddef99cc4193083f7e786c3992f580 ] with the introduction of commit b0eb57c, 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 <nhorman@tuxdriver.com> Reported-By: boyang@redhat.com CC: boyang@redhat.com CC: Shrikrishna Khare <skhare@vmware.com> CC: "VMware, Inc." <pv-drivers@vmware.com> CC: David S. Miller <davem@davemloft.net> Acked-by: Shrikrishna Khare <skhare@vmware.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e34d42c commit 1414a1e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/vmxnet3/vmxnet3_drv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,6 @@ static void vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq,
14201420
rq->rx_ring[i].basePA);
14211421
rq->rx_ring[i].base = NULL;
14221422
}
1423-
rq->buf_info[i] = NULL;
14241423
}
14251424

14261425
if (rq->comp_ring.base) {
@@ -1435,6 +1434,7 @@ static void vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq,
14351434
(rq->rx_ring[0].size + rq->rx_ring[1].size);
14361435
dma_free_coherent(&adapter->pdev->dev, sz, rq->buf_info[0],
14371436
rq->buf_info_pa);
1437+
rq->buf_info[0] = rq->buf_info[1] = NULL;
14381438
}
14391439
}
14401440

0 commit comments

Comments
 (0)