]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Call i40e_client_get_params only after the instance is checked
authorJack Vogel <jack.vogel@oracle.com>
Fri, 13 Jan 2017 21:01:26 +0000 (13:01 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 20 Jan 2017 05:53:13 +0000 (21:53 -0800)
We can avoid the minor bit of work by calling check params after we
check for the client instance, since we're about to return early in
cases where we do not have a client. But, more importantly, this
change prevents a panic from a NULL pointer when attempting to
get the client params.

Orabug: 25159384

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
drivers/net/ethernet/intel/i40e/i40e_client.c

index 0e6ac841321c739d0a91ca2d6ea8545cb23fa288..5402961969e8c5de2ce383626bdfe21c13157963 100644 (file)
@@ -169,8 +169,6 @@ void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi)
 
        if (!vsi)
                return;
-       memset(&params, 0, sizeof(params));
-       i40e_client_get_params(vsi, &params);
        mutex_lock(&i40e_client_instance_mutex);
        list_for_each_entry(cdev, &i40e_client_instances, list) {
                if (cdev->lan_info.pf == vsi->back) {
@@ -181,6 +179,8 @@ void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi)
                                        "Cannot locate client instance l2_param_change routine\n");
                                continue;
                        }
+                       memset(&params, 0, sizeof(params));
+                       i40e_client_get_params(vsi, &params);
                        cdev->lan_info.params = params;
                        cdev->client->ops->l2_param_change(&cdev->lan_info,
                                                           cdev->client,