[PATCH next] firmware: imx: fix use after free in init_device_context()

Dan Carpenter <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.ports.arm.kernel,gmane.linux.kernel.janitors
Message-ID <[email protected]>
Add a missing return statement on the error path.  Otherwise we have a
use after free when it dereferences "dev_ctx" on the next line.

Fixes: 63536a73a3bb ("firmware: drivers: imx: adds miscdev")
Signed-off-by: Dan Carpenter <[email protected]>
---
This was in the original fix but I guess there was a merge problem.
https://lore.kernel.org/all/[email protected]/

 drivers/firmware/imx/se_ctrl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/firmware/imx/se_ctrl.c b/drivers/firmware/imx/se_ctrl.c
index 9327d47e4312..010af8221dfe 100644
--- a/drivers/firmware/imx/se_ctrl.c
+++ b/drivers/firmware/imx/se_ctrl.c
@@ -486,6 +486,7 @@ static int init_device_context(struct se_if_priv *priv, int ch_id,
 		kfree(dev_ctx->devname);
 		kfree(dev_ctx);
 		*new_dev_ctx = NULL;
+		return ret;
 	}
 
 	list_add_tail(&dev_ctx->link, &priv->dev_ctx_list);
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.