From: Harman Kalra Date: Mon, 29 Jun 2020 13:26:05 +0000 (+0530) Subject: common/octeontx2: fix crash on running procinfo X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=43330c4de3c768f6eedbc544f410ccff06b531a2;p=dpdk.git common/octeontx2: fix crash on running procinfo Segmentation fault has been observed while running procinfo with reset options i.e. --stats-reset and --xstats-reset. Reason is procinfo runs as a secondary process and tries to hold a lock which is part of struct mdev, which was not allocated as part of shared memory. Fixes: 5ca59711f771 ("common/octeontx2: add mailbox base support infra") Cc: stable@dpdk.org Signed-off-by: Harman Kalra Acked-by: Jerin Jacob --- diff --git a/drivers/common/octeontx2/otx2_mbox.c b/drivers/common/octeontx2/otx2_mbox.c index 2b7810929a..6df1e8ea63 100644 --- a/drivers/common/octeontx2/otx2_mbox.c +++ b/drivers/common/octeontx2/otx2_mbox.c @@ -9,6 +9,7 @@ #include #include +#include #include "otx2_mbox.h" #include "otx2_dev.h" @@ -36,7 +37,7 @@ otx2_mbox_fini(struct otx2_mbox *mbox) { mbox->reg_base = 0; mbox->hwbase = 0; - free(mbox->dev); + rte_free(mbox->dev); mbox->dev = NULL; } @@ -128,7 +129,9 @@ otx2_mbox_init(struct otx2_mbox *mbox, uintptr_t hwbase, uintptr_t reg_base, return -ENODEV; } - mbox->dev = malloc(ndevs * sizeof(struct otx2_mbox_dev)); + mbox->dev = rte_zmalloc("mbox dev", + ndevs * sizeof(struct otx2_mbox_dev), + OTX2_ALIGN); if (!mbox->dev) { otx2_mbox_fini(mbox); return -ENOMEM;