[PATCH 4.16 155/272] cxgb4: Fix queue free path of ULD drivers

From: Greg Kroah-Hartman
Date: Mon May 28 2018 - 07:39:28 EST


4.16-stable review patch. If anyone has any objections, please let me know.

------------------

From: Arjun Vynipadath <arjun@xxxxxxxxxxx>

[ Upstream commit d7cb44496a9bb458632cb3c18acb08949c210448 ]

Setting sge_uld_rxq_info to NULL in free_queues_uld().
We are referencing sge_uld_rxq_info in cxgb_up(). This
will fix a panic when interface is brought up after a
ULDq creation failure.

Fixes: 94cdb8bb993a (cxgb4: Add support for dynamic allocation
of resources for ULD)
Signed-off-by: Arjun Vynipadath <arjun@xxxxxxxxxxx>
Signed-off-by: Casey Leedom <leedom@xxxxxxxxxxx>
Signed-off-by: Ganesh Goudhar <ganeshgr@xxxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_uld.c
@@ -342,6 +342,7 @@ static void free_queues_uld(struct adapt
{
struct sge_uld_rxq_info *rxq_info = adap->sge.uld_rxq_info[uld_type];

+ adap->sge.uld_rxq_info[uld_type] = NULL;
kfree(rxq_info->rspq_id);
kfree(rxq_info->uldrxq);
kfree(rxq_info);