Commit 83576a47 authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by Tim Gardner

i40e: allocate memory safer

BugLink: http://bugs.launchpad.net/bugs/1547674

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: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from net-next commit 38c3cec7)
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent 4e7326d1
...@@ -1937,7 +1937,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) ...@@ -1937,7 +1937,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
sizeof(struct i40e_aqc_remove_macvlan_element_data); sizeof(struct i40e_aqc_remove_macvlan_element_data);
del_list_size = filter_list_len * del_list_size = filter_list_len *
sizeof(struct i40e_aqc_remove_macvlan_element_data); 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) { if (!del_list) {
i40e_cleanup_add_list(&tmp_add_list); i40e_cleanup_add_list(&tmp_add_list);
...@@ -2015,7 +2015,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi) ...@@ -2015,7 +2015,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
sizeof(struct i40e_aqc_add_macvlan_element_data), sizeof(struct i40e_aqc_add_macvlan_element_data),
add_list_size = filter_list_len * add_list_size = filter_list_len *
sizeof(struct i40e_aqc_add_macvlan_element_data); 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) { if (!add_list) {
/* Purge element from temporary lists */ /* Purge element from temporary lists */
i40e_cleanup_add_list(&tmp_add_list); i40e_cleanup_add_list(&tmp_add_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment