Commit a7f933a5 authored by Peter Seiderer's avatar Peter Seiderer Committed by Mauro Carvalho Chehab

[media] coda: check kasprintf return value in coda_open

kasprintf might fail if free memory is low.
Signed-off-by: default avatarPeter Seiderer <ps.report@gmx.net>
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 92b042ec
...@@ -1628,6 +1628,11 @@ static int coda_open(struct file *file) ...@@ -1628,6 +1628,11 @@ static int coda_open(struct file *file)
set_bit(idx, &dev->instance_mask); set_bit(idx, &dev->instance_mask);
name = kasprintf(GFP_KERNEL, "context%d", idx); name = kasprintf(GFP_KERNEL, "context%d", idx);
if (!name) {
ret = -ENOMEM;
goto err_coda_name_init;
}
ctx->debugfs_entry = debugfs_create_dir(name, dev->debugfs_root); ctx->debugfs_entry = debugfs_create_dir(name, dev->debugfs_root);
kfree(name); kfree(name);
...@@ -1742,6 +1747,7 @@ static int coda_open(struct file *file) ...@@ -1742,6 +1747,7 @@ static int coda_open(struct file *file)
v4l2_fh_del(&ctx->fh); v4l2_fh_del(&ctx->fh);
v4l2_fh_exit(&ctx->fh); v4l2_fh_exit(&ctx->fh);
clear_bit(ctx->idx, &dev->instance_mask); clear_bit(ctx->idx, &dev->instance_mask);
err_coda_name_init:
err_coda_max: err_coda_max:
kfree(ctx); kfree(ctx);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment