summaryrefslogtreecommitdiffstats
path: root/drivers/soc
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-02-19 15:05:17 +0100
committerLi Yang <leoyang.li@nxp.com>2019-02-19 21:59:39 +0100
commitbd3bd3b36df725645036748e58a8c35c8d2cbf91 (patch)
tree749eebc1a9bfff6bf26d04a311157cdae139bd98 /drivers/soc
parentsoc: fsl: dpio: Use after free in dpaa2_dpio_remove() (diff)
downloadlinux-bd3bd3b36df725645036748e58a8c35c8d2cbf91.tar.xz
linux-bd3bd3b36df725645036748e58a8c35c8d2cbf91.zip
soc: fsl: dpio: fix memory leak of a struct qbman on error exit path
Currently the error check for a null reg leaks a struct qbman that was allocated earlier. Fix this by kfree'ing p on the error exit path. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Li Yang <leoyang.li@nxp.com>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/fsl/dpio/qbman-portal.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/soc/fsl/dpio/qbman-portal.c b/drivers/soc/fsl/dpio/qbman-portal.c
index 0bddb85c0ae5..5a73397ae79e 100644
--- a/drivers/soc/fsl/dpio/qbman-portal.c
+++ b/drivers/soc/fsl/dpio/qbman-portal.c
@@ -180,6 +180,7 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d)
reg = qbman_read_register(p, QBMAN_CINH_SWP_CFG);
if (!reg) {
pr_err("qbman: the portal is not enabled!\n");
+ kfree(p);
return NULL;
}