[qca-nss-ecm]: multicast: fix for crash in ecm while rebooting with traffic running
Description: DUT crash when try to deref an invalid interface hierarchy while
creating destination interface heirarchies
Change-Id: I2b737be2547e18792508ca51f22749984ad0475f
Signed-off-by: Shyam Sunder <ssunde@codeaurora.org>
diff --git a/ecm_interface.c b/ecm_interface.c
index 88c7c0c..87e7450 100644
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -1878,7 +1878,7 @@
uint32_t *interface_first;
uint32_t br_if;
uint32_t valid_if;
- uint32_t if_num;
+ int32_t if_num;
int32_t dest_dev_type;
int if_index;
int ii_cnt;
@@ -1965,6 +1965,11 @@
if_num = mc_bridge_ipv6_get_if(dest_dev, &origin6, &group6, mc_max_dst, mc_dst_if_index);
}
+ if ((if_num <= 0) || (if_num > ECM_DB_MULTICAST_IF_MAX)) {
+ dev_put(dest_dev);
+ return 0;
+ }
+
for (br_if = 0; br_if < if_num; br_if++) {
mc_br_slave_dev = dev_get_by_index(&init_net, mc_dst_if_index[br_if]);
if (!mc_br_slave_dev) {