diff mbox

[4.2.y-ckt,stable] Patch "net/mlx4_core: Fix potential corruption in counters database" has been added to the 4.2.y-ckt tree

Message ID 1457390195-4740-1-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa March 7, 2016, 10:36 p.m. UTC
This is a note to let you know that I have just added a patch titled

    net/mlx4_core: Fix potential corruption in counters database

to the linux-4.2.y-queue branch of the 4.2.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-4.2.y-queue

This patch is scheduled to be released in version 4.2.8-ckt5.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 4.2.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

---8<------------------------------------------------------------

From 7b03bf9e964354f08551c4bc9b7036f2cb42d7d4 Mon Sep 17 00:00:00 2001
From: Eran Ben Elisha <eranbe@mellanox.com>
Date: Wed, 17 Feb 2016 17:24:24 +0200
Subject: net/mlx4_core: Fix potential corruption in counters database

commit 6b94bab0ee8d5def6a2aac0ef6204ee6e24386b6 upstream.

The error flow in procedure handle_existing_counter() is wrong.

The procedure should exit after encountering the error, not continue
as if everything is OK.

Fixes: 68230242cdbc ('net/mlx4_core: Add port attribute when tracking counters')
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--
2.7.0
diff mbox

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 8bead97..b2614a8 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -905,11 +905,13 @@  static int handle_existing_counter(struct mlx4_dev *dev, u8 slave, int port,

 	spin_lock_irq(mlx4_tlock(dev));
 	r = find_res(dev, counter_index, RES_COUNTER);
-	if (!r || r->owner != slave)
+	if (!r || r->owner != slave) {
 		ret = -EINVAL;
-	counter = container_of(r, struct res_counter, com);
-	if (!counter->port)
-		counter->port = port;
+	} else {
+		counter = container_of(r, struct res_counter, com);
+		if (!counter->port)
+			counter->port = port;
+	}

 	spin_unlock_irq(mlx4_tlock(dev));
 	return ret;