]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
net: axienet: fix a potential double free in axienet_probe()
authorWen Yang <wen.yang99@zte.com.cn>
Sat, 6 Jul 2019 03:38:41 +0000 (11:38 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Jul 2019 23:28:32 +0000 (16:28 -0700)
commitef86ea982bb5a31cda1f2989b6e477bb53a1031b
treed5f7625307831f065207c8fd558fcb6bc2219418
parentd4117d63a30876a3654f587c3a419db63d8b529d
net: axienet: fix a potential double free in axienet_probe()

There is a possible use-after-free issue in the axienet_probe():

1701: np = of_parse_phandle(pdev->dev.of_node, "axistream-connected", 0);
1702:   if (np) {
...
1787: of_node_put(np); ---> released here
1788: lp->eth_irq = platform_get_irq(pdev, 0);
1789: } else {
...
1801: }
1802: if (IS_ERR(lp->dma_regs)) {
...
1805: of_node_put(np); ---> double released here
1806: goto free_netdev;
1807: }

We solve this problem by removing the unnecessary of_node_put().

Fixes: 28ef9ebdb64c ("net: axienet: make use of axistream-connected attribute optional")
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Anirudha Sarangi <anirudh@xilinx.com>
Cc: John Linn <John.Linn@xilinx.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Robert Hancock <hancock@sedsystems.ca>
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Robert Hancock <hancock@sedsystems.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/xilinx/xilinx_axienet_main.c