qlcnic: validate eswitch config values for PF
authorAmit Kumar Salecha <amit.salecha@qlogic.com>
Thu, 2 Dec 2010 20:41:43 +0000 (20:41 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Dec 2010 17:33:21 +0000 (09:33 -0800)
Currently driver set default eswitch configuration values for PF function,
instead of validating values sent by application.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/qlcnic/qlcnic_main.c

index 08d4b37f246ccd73ddb04e6e54e0c161360bf48e..4e8466b326af9ed12ab8e26c92d236a44a276725 100644 (file)
@@ -3537,9 +3537,12 @@ validate_esw_config(struct qlcnic_adapter *adapter,
                case QLCNIC_PORT_DEFAULTS:
                        if (QLC_DEV_GET_DRV(op_mode, pci_func) !=
                                                QLCNIC_NON_PRIV_FUNC) {
-                               esw_cfg[i].mac_anti_spoof = 0;
-                               esw_cfg[i].mac_override = 1;
-                               esw_cfg[i].promisc_mode = 1;
+                               if (esw_cfg[i].mac_anti_spoof != 0)
+                                       return QL_STATUS_INVALID_PARAM;
+                               if (esw_cfg[i].mac_override != 1)
+                                       return QL_STATUS_INVALID_PARAM;
+                               if (esw_cfg[i].promisc_mode != 1)
+                                       return QL_STATUS_INVALID_PARAM;
                        }
                        break;
                case QLCNIC_ADD_VLAN: