From: Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Selvin Xavier
<selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
Kalesh AP
<kalesh-anakkur.purayil-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Subject: [PATCH for-next V2 05/13] RDMA/bnxt_re: Do not free the ctx_tbl entry if delete GID fails
Date: Thu, 29 Jun 2017 12:28:11 -0700 [thread overview]
Message-ID: <1498764499-24157-6-git-send-email-selvin.xavier@broadcom.com> (raw)
In-Reply-To: <1498764499-24157-1-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
This fix is added only to avoid system crash in some a
specific scenario. When bnxt_re driver is loaded and if
user tries to change interface mac address, delete GID
fails because QP1 is still associated with existing MAC
(default GID). If the above command fails GID tables are
not modified in the h/w or driver, but the GID context memory
is freed. Now, if the user changes the mac back to the original
value, another add_gid comes to the driver where the driver
reports that the GID is already present in its table
and tries to access the context which was already freed.
So, in this case, in order to avoid NULL pointer de-reference,
this patch removes the context memory free if delete_gid fails
and the same context memory is re-used in new add_gid.
Memory cleanup will be taken care during driver unload, while
deleting the GID table.
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Signed-off-by: Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
---
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index 2fa5967..7c9685a 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -375,15 +375,17 @@ int bnxt_re_del_gid(struct ib_device *ibdev, u8 port_num,
return -EINVAL;
ctx->refcnt--;
if (!ctx->refcnt) {
- rc = bnxt_qplib_del_sgid
- (sgid_tbl,
- &sgid_tbl->tbl[ctx->idx], true);
- if (rc)
+ rc = bnxt_qplib_del_sgid(sgid_tbl,
+ &sgid_tbl->tbl[ctx->idx],
+ true);
+ if (rc) {
dev_err(rdev_to_dev(rdev),
"Failed to remove GID: %#x", rc);
- ctx_tbl = sgid_tbl->ctx;
- ctx_tbl[ctx->idx] = NULL;
- kfree(ctx);
+ } else {
+ ctx_tbl = sgid_tbl->ctx;
+ ctx_tbl[ctx->idx] = NULL;
+ kfree(ctx);
+ }
}
} else {
return -EINVAL;
--
2.5.5
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-06-29 19:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-29 19:28 [PATCH for-next V2 00/13] RDMA/bnxt_re: Misc fixes for bnxt_re Selvin Xavier
[not found] ` <1498764499-24157-1-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-06-29 19:28 ` [PATCH for-next V2 01/13] RDMA/bnxt_re: Fix race between netdev register and unregister events Selvin Xavier
2017-06-29 19:28 ` [PATCH for-next V2 02/13] RDMA/bnxt_re: Free doorbell page index (DPI) during dealloc ucontext Selvin Xavier
2017-06-29 19:28 ` [PATCH for-next V2 03/13] RDMA/bnxt_re: Fix WQE Size posted to HW to prevent it from throwing error Selvin Xavier
2017-06-29 19:28 ` [PATCH for-next V2 04/13] RDMA/bnxt_re: Add vlan tag for untagged RoCE traffic when PFC is configured Selvin Xavier
2017-06-29 19:28 ` Selvin Xavier [this message]
2017-06-29 19:28 ` [PATCH for-next V2 06/13] RDMA/bnxt_re: Report supported value to IB stack in query_device Selvin Xavier
2017-06-29 19:28 ` [PATCH for-next V2 07/13] RDMA/bnxt_re: Fixed the max_rd_atomic support for initiator and destination QP Selvin Xavier
2017-06-29 19:28 ` [PATCH for-next V2 08/13] RDMA/bnxt_re: Specify RDMA component when allocating stats context Selvin Xavier
2017-06-29 19:28 ` [PATCH for-next V2 09/13] RDMA/bnxt_re: Allow posting when QPs are in error Selvin Xavier
2017-06-29 19:28 ` [PATCH for-next V2 10/13] RDMA/bnxt_re: Enable atomics only if host bios supports Selvin Xavier
2017-06-29 19:28 ` [PATCH for-next V2 11/13] RDMA/bnxt_re: Fix return value of poll routine Selvin Xavier
2017-06-29 19:28 ` [PATCH for-next V2 12/13] RDMA/bnxt_re: Report MISSED_EVENTS in req_notify_cq Selvin Xavier
2017-06-29 19:28 ` [PATCH for-next V2 13/13] RDMA/bnxt_re: Fix the value reported for local ack delay Selvin Xavier
2017-07-22 17:41 ` [PATCH for-next V2 00/13] RDMA/bnxt_re: Misc fixes for bnxt_re Doug Ledford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1498764499-24157-6-git-send-email-selvin.xavier@broadcom.com \
--to=selvin.xavier-dy08kvg/lbpwk0htik3j/w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=kalesh-anakkur.purayil-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox