From 1a5a8a8efd5abe5d66c4a338bb3ee50c916342d6 Mon Sep 17 00:00:00 2001 From: Simei Su Date: Thu, 7 Nov 2019 15:34:43 +0800 Subject: [PATCH] net/ice: add error cases for wrong packages If the switch/fdir/hash module can't resolve a correct parser, it should return error. Fixes: 47d460d63233 ("net/ice: rework switch filter") Fixes: efc16c621415 ("net/ice: support flow director GTPU tunnel") Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS") Signed-off-by: Simei Su Acked-by: Qi Zhang Acked-by: Xiaolong Ye --- drivers/net/ice/ice_fdir_filter.c | 4 +++- drivers/net/ice/ice_hash.c | 2 ++ drivers/net/ice/ice_switch_filter.c | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 6052bed516..afab5af7fe 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -863,8 +863,10 @@ ice_fdir_init(struct ice_adapter *ad) if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) parser = &ice_fdir_parser_comms; - else + else if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT) parser = &ice_fdir_parser_os; + else + return -EINVAL; return ice_register_parser(parser, ad); } diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index 3381b4584e..8dc3146a20 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -242,6 +242,8 @@ ice_hash_init(struct ice_adapter *ad) parser = &ice_hash_parser_os; else if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) parser = &ice_hash_parser_comms; + else + return -EINVAL; return ice_register_parser(parser, ad); } diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index 4be87c2b9a..2406102ce1 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -1122,8 +1122,10 @@ ice_switch_init(struct ice_adapter *ad) if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) dist_parser = &ice_switch_dist_parser_comms; - else + else if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT) dist_parser = &ice_switch_dist_parser_os; + else + return -EINVAL; if (ad->devargs.pipe_mode_support) ret = ice_register_parser(perm_parser, ad); -- 2.20.1