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 <hkalra@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
#include <rte_atomic.h>
#include <rte_cycles.h>
+#include <rte_malloc.h>
#include "otx2_mbox.h"
#include "otx2_dev.h"
{
mbox->reg_base = 0;
mbox->hwbase = 0;
- free(mbox->dev);
+ rte_free(mbox->dev);
mbox->dev = NULL;
}
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;