From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 95385A055A for ; Thu, 27 Feb 2020 10:35:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 84ACA1BFF3; Thu, 27 Feb 2020 10:35:15 +0100 (CET) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id 62C9C1C01 for ; Thu, 27 Feb 2020 10:35:14 +0100 (CET) Received: by mail-wr1-f66.google.com with SMTP id j16so870497wrt.3 for ; Thu, 27 Feb 2020 01:35:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pEKWMZIt47afpDvZ1a/846wRHcBU16/HNLenZxK1lRg=; b=c5PLve2zZWc/3Xe+cy4sVa3gnJQ6RNGcLxoaNvAdzl2K0wQAX/9r3TfCoGBBiaisLC VvrQYP6dYsgaEYwW7sSfl82kVwSAU3pY0luLjkvvEbSDMYloq/0ZnNnNKbZ3OhyjGspJ nMUjJUkwaNtPHsAiq2JFIjYtza1/+ZIVcFKao3HBlx2HSNG6ir2tAPlkQQvOkMhuW+a2 hV43NvY1epoGzJu0VF4Lp+poZrV2yme5MilM9cU0L9RExqGJdpbcGrr5YFsw3ZCu/uFg gnQ4IafFyZmTuMjxFdZBV2gszzLCr9IKWvOmS4QU9Qlzqk42Cqa2g0KmWF4dt+ol7JPG THdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pEKWMZIt47afpDvZ1a/846wRHcBU16/HNLenZxK1lRg=; b=gCziSLlFMqdkU6QW0imoNHtT5tRu4fMrhIrHykpmnEFWcAZva/hai1UnJVutGILq26 9JhZUR2D37U3YO88mBDzby08MxUZmLDDkciJOeypAnwFUL53Xy7hJ013SM1zcy9GetPp +N27mTJWlruLjJMlB9VQA+ZJN+de0GfmKwlYRK0e+UOHP2Ac4Ju0rAdQnCdYsWRGY4SW tJCaUlzdxN+xOcAtjkDMeRb9wJxrUUYakSIN5N/gEdu2P0evMJSwOPdtB7UhwQpUuFHb pVMazQ1Go45fwFwYVNBVgTMLv2iU0mLGXDFmb+NgO6GYPVqPQSQcDqJBiFrdwSVXYlCi 1Ivw== X-Gm-Message-State: APjAAAUqiZQ1Zvguv06LX+oRR1SfhKVCEO2RWvpzQ8gBNR2HeA05s1W4 oro80/Hp+6SExmG1cV8mCTJTgSmuFIQ= X-Google-Smtp-Source: APXvYqykpqoWUr6GrI+JtbEbOcDpQroSLDaR/NFwd4rg0FKhlBoGnsH6gMmeRLBepQ+ffmavJ4B3AQ== X-Received: by 2002:adf:fd41:: with SMTP id h1mr3782658wrs.258.1582796114132; Thu, 27 Feb 2020 01:35:14 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id m3sm7167637wrs.53.2020.02.27.01.35.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 01:35:13 -0800 (PST) From: luca.boccassi@gmail.com To: Kalesh AP Cc: Ajit Khaparde , dpdk stable Date: Thu, 27 Feb 2020 09:33:45 +0000 Message-Id: <20200227093402.17690-25-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227093402.17690-1-luca.boccassi@gmail.com> References: <20200217174546.25334-54-luca.boccassi@gmail.com> <20200227093402.17690-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/bnxt: fix crash in port stop while handling events' has been queued to stable release 19.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/29/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 4af75ac529860ef485fe3fb04f3b789eb7d017ec Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Thu, 20 Feb 2020 09:42:13 +0530 Subject: [PATCH] net/bnxt: fix crash in port stop while handling events [ upstream commit 0732bcb40f2f54397b70b6c63e0b1c7bdc03b8db ] Check for bp->hwrm_cmd_resp_addr before using it in HWRM_PREP to avoid segmentation fault when stop port and meanwhile receive events from FW. Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW") Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_hwrm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index ad9ca7c6f1..7408412c9b 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -184,6 +184,10 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, */ #define HWRM_PREP(req, type, kong) do { \ rte_spinlock_lock(&bp->hwrm_lock); \ + if (bp->hwrm_cmd_resp_addr == NULL) { \ + rte_spinlock_unlock(&bp->hwrm_lock); \ + return -EACCES; \ + } \ memset(bp->hwrm_cmd_resp_addr, 0, bp->max_resp_len); \ req.req_type = rte_cpu_to_le_16(HWRM_##type); \ req.cmpl_ring = rte_cpu_to_le_16(-1); \ @@ -3087,9 +3091,9 @@ static void add_random_mac_if_needed(struct bnxt *bp, } } -static void reserve_resources_from_vf(struct bnxt *bp, - struct hwrm_func_cfg_input *cfg_req, - int vf) +static int reserve_resources_from_vf(struct bnxt *bp, + struct hwrm_func_cfg_input *cfg_req, + int vf) { struct hwrm_func_qcaps_input req = {0}; struct hwrm_func_qcaps_output *resp = bp->hwrm_cmd_resp_addr; @@ -3123,6 +3127,8 @@ static void reserve_resources_from_vf(struct bnxt *bp, bp->max_ring_grps -= rte_le_to_cpu_16(resp->max_hw_ring_grps); HWRM_UNLOCK(); + + return 0; } int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf) -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-27 09:31:56.627338123 +0000 +++ 0025-net-bnxt-fix-crash-in-port-stop-while-handling-event.patch 2020-02-27 09:31:55.751945990 +0000 @@ -1,13 +1,14 @@ -From 0732bcb40f2f54397b70b6c63e0b1c7bdc03b8db Mon Sep 17 00:00:00 2001 +From 4af75ac529860ef485fe3fb04f3b789eb7d017ec Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Thu, 20 Feb 2020 09:42:13 +0530 Subject: [PATCH] net/bnxt: fix crash in port stop while handling events +[ upstream commit 0732bcb40f2f54397b70b6c63e0b1c7bdc03b8db ] + Check for bp->hwrm_cmd_resp_addr before using it in HWRM_PREP to avoid segmentation fault when stop port and meanwhile receive events from FW. Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW") -Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde @@ -16,7 +17,7 @@ 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c -index acecf27848..a9c9c7297c 100644 +index ad9ca7c6f1..7408412c9b 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -184,6 +184,10 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, @@ -30,7 +31,7 @@ memset(bp->hwrm_cmd_resp_addr, 0, bp->max_resp_len); \ req.req_type = rte_cpu_to_le_16(HWRM_##type); \ req.cmpl_ring = rte_cpu_to_le_16(-1); \ -@@ -3096,9 +3100,9 @@ static void add_random_mac_if_needed(struct bnxt *bp, +@@ -3087,9 +3091,9 @@ static void add_random_mac_if_needed(struct bnxt *bp, } } @@ -43,7 +44,7 @@ { struct hwrm_func_qcaps_input req = {0}; struct hwrm_func_qcaps_output *resp = bp->hwrm_cmd_resp_addr; -@@ -3132,6 +3136,8 @@ static void reserve_resources_from_vf(struct bnxt *bp, +@@ -3123,6 +3127,8 @@ static void reserve_resources_from_vf(struct bnxt *bp, bp->max_ring_grps -= rte_le_to_cpu_16(resp->max_hw_ring_grps); HWRM_UNLOCK();