From: Keefe LIU liuqifa@huawei.com
hulk inclusion category: bugfix bugzilla: 9511, https://gitee.com/openeuler/kernel/issues/I4IHL1 CVE: NA
-------------------------------------------------
In commit <7a0f243de9e2> "ipvlan: Introduce l2e mode", we introduced ipvlan_default_mode as a way to enable the ipvlan's default mode. Howerver, we didn't check the value of this module parameter.
This patch first fixed out a spelling error of "mode", and then add the value check for ipvlan_default_mode.
Signed-off-by: Keefe LIU liuqifa@huawei.com Reviewed-by: Wei Yongjun weiyongjun1@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Lu Wei luwei32@huawei.com Reviewed-by: Yue Haibing yuehaibing@huawei.com Reviewed-by: Wei Yongjun weiyongjun1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/net/ipvlan/ipvlan_main.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index efd1452cd929..bf750140f45a 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -1026,6 +1026,10 @@ static int __init ipvlan_init_module(void) { int err;
+ if (ipvlan_default_mode >= IPVLAN_MODE_MAX || + ipvlan_default_mode < IPVLAN_MODE_L2) + return -EINVAL; + ipvlan_init_secret(); register_netdevice_notifier(&ipvlan_notifier_block); #if IS_ENABLED(CONFIG_IPV6)