From 7a87827d3bd75c83606b3e7f1b15c7d5654c70c5 Mon Sep 17 00:00:00 2001 From: Keefe LIU Date: Wed, 20 Feb 2019 15:20:14 +0800 Subject: [PATCH] ipvlan: check the value of module parameter ipvlan_default_mode euler inclusion category: bugfix bugzilla: 9511 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 Reviewed-by: Wei Yongjun Signed-off-by: Yang Yingliang --- 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 8afae55538fb..290a6a404b1b 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -1074,6 +1074,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) -- GitLab