Skip to contentSkip to conversation

FAILED: patch "[PATCH] net/mlx5: Fix potential sleeping in atomic context" failed to apply to 4.14-stable tree

PATCH [email protected] 1 participant 1 message Sep 20, 2021

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From ee27e330a953595903979ffdb84926843595a9fe Mon Sep 17 00:00:00 2001
From: Maor Gottlieb <[email protected]>
Date: Wed, 1 Sep 2021 11:48:13 +0300
Subject: [PATCH] net/mlx5: Fix potential sleeping in atomic context

Fixes the below flow of sleeping in atomic context by releasing the RCU lock before calling to free_match_list.

build_match_list() <- disables preempt
-> free_match_list()
-> tree_put_node()

      -> down_write_ref_node() <- take write lock
Fixes 693c6883bbc4 ("net/mlx5: Add hash table for flow groups in flow table")
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +2 -3
index 9fe8e3c204d6..fe501ba88bea 100644
@@ -1682,14 +1682,13 @@ static int build_match_list(struct match_list *match_head,
 
 		curr_match = kmalloc(sizeof(*curr_match), GFP_ATOMIC);
 		if (!curr_match) {
+			rcu_read_unlock();
 			free_match_list(match_head, ft_locked);
-			err = -ENOMEM;
-			goto out;
+			return -ENOMEM;
 		}
 		curr_match->g = g;
 		list_add_tail(&curr_match->list, &match_head->list);
 	}
-out:
 	rcu_read_unlock();
 	return err;
 }