i40e: allocate memory safer
authorJesse Brandeburg <jesse.brandeburg@intel.com>
Mon, 4 Jan 2016 18:33:05 +0000 (10:33 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Wed, 17 Feb 2016 16:27:21 +0000 (08:27 -0800)
The sync_vsi_filter function was allocating memory in such
a way that it could sleep (GFP_KERNEL) which was causing a problem
when called by the team driver under rcu_read_lock(), which cannot
be held while sleeping.  Found with lockdep.

Change-ID: I4e59053cb5eedcf3d0ca151715be3dc42a94bdd5
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_main.c

index c4ad0f159537c5d4bea6425afd37c5013c8ff26c..fe67b9097f35795e4e8254abdaade735704ea3e5 100644 (file)
@@ -1937,7 +1937,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
                            sizeof(struct i40e_aqc_remove_macvlan_element_data);
                del_list_size = filter_list_len *
                            sizeof(struct i40e_aqc_remove_macvlan_element_data);
-               del_list = kzalloc(del_list_size, GFP_KERNEL);
+               del_list = kzalloc(del_list_size, GFP_ATOMIC);
                if (!del_list) {
                        i40e_cleanup_add_list(&tmp_add_list);
 
@@ -2015,7 +2015,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
                               sizeof(struct i40e_aqc_add_macvlan_element_data),
                add_list_size = filter_list_len *
                               sizeof(struct i40e_aqc_add_macvlan_element_data);
-               add_list = kzalloc(add_list_size, GFP_KERNEL);
+               add_list = kzalloc(add_list_size, GFP_ATOMIC);
                if (!add_list) {
                        /* Purge element from temporary lists */
                        i40e_cleanup_add_list(&tmp_add_list);