Commit 9712c473 authored by Miaoqian Lin's avatar Miaoqian Lin Committed by Liu Jian
Browse files

net: marvell: prestera: Add missing of_node_put() in prestera_switch_set_base_mac_addr

mainline inclusion
from mainline-v5.17-rc8
commit c9ffa3e2
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IADGT8
CVE: CVE-2022-48859

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c9ffa3e2bc451816ce0295e40063514fabf2bd36



---------------------------

This node pointer is returned by of_find_compatible_node() with
refcount incremented. Calling of_node_put() to aovid the refcount leak.

Fixes: 501ef306 ("net: marvell: prestera: Add driver for Prestera family ASIC devices")
Signed-off-by: default avatarMiaoqian Lin <linmq006@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>

Conflicts:
	drivers/net/ethernet/marvell/prestera/prestera_main.c
[Did not backport 83216e39.]
Signed-off-by: default avatarLiu Jian <liujian56@huawei.com>
parent b4a81101
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -480,6 +480,7 @@ static int prestera_switch_set_base_mac_addr(struct prestera_switch *sw)
		eth_random_addr(sw->base_mac);
		dev_info(prestera_dev(sw), "using random base mac address\n");
	}
	of_node_put(np);

	return prestera_hw_switch_mac_set(sw, sw->base_mac);
}