Patch "net/mlx5: Fix command bad flow on command entry allocation failure" has been added to the 4.12-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
net/mlx5: Fix command bad flow on command entry allocation failure
to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
net-mlx5-fix-command-bad-flow-on-command-entry-allocation-failure.patch
and it can be found in the queue-4.12 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Tue Aug 8 16:27:29 PDT 2017
From: Moshe Shemesh <[email protected]>
Date: Sun, 25 Jun 2017 18:45:32 +0300
Subject: net/mlx5: Fix command bad flow on command entry allocation failure
From: Moshe Shemesh <[email protected]>
[ Upstream commit 219c81f7d1d5a89656cb3b53d3b4e11e93608d80 ]
When driver fail to allocate an entry to send command to FW, it must notify the calling function and release the memory allocated for this command.
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +17 -2
@@ -777,6 +777,10 @@ static void cb_timeout_handler(struct womlx5_cmd_comp_handler (dev,1UL << ent->idx, true); } +static void free_msg (struct mlx5_core_dev *dev,struct mlx5_cmd_msg *msg); +static void mlx5_free_cmd_msg (struct mlx5_core_dev *dev, +struct mlx5_cmd_msg *msg); +static void cmd_work_handler (struct work_struct *work) { struct mlx5_cmd_work_ent *ent = container_of(work, struct mlx5_cmd_work_ent, work);
@@ -786,16 +790,27 @@ static void cmd_work_handler(struct workstruct mlx5_cmd_layout *lay;struct semaphore *sem;unsigned long flags; +int alloc_ret; sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;down (sem);if (!ent->page_queue) { - ent->idx =alloc_ent (cmd); -if (ent->idx <0 ) { + alloc_ret =alloc_ent (cmd); +if (alloc_ret <0 ) {mlx5_core_err (dev,"failed to allocate command entry\n" ); +if (ent->callback) { + ent->callback (-EAGAIN , ent->context); +mlx5_free_cmd_msg (dev, ent->out); +free_msg (dev, ent->in); +free_cmd (ent); + }else { + ent->ret = -EAGAIN ; +complete (&ent->done); + }up (sem);return ; } + ent->idx = alloc_ret; }else { ent->idx = cmd->max_reg_cmds;spin_lock_irqsave (&cmd->alloc_lock, flags);
Patches currently in stable-queue which might be from [email protected] are
queue-4.12/net-mlx5-fix-command-bad-flow-on-command-entry-allocation-failure.patch queue-4.12/net-mlx5-fix-command-completion-after-timeout-access-invalid-structure.patch