[media] V4L: mt9t112: use after free in mt9t112_probe()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 7 Nov 2011 17:44:12 +0000 (14:44 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 24 Nov 2011 12:27:47 +0000 (10:27 -0200)
priv gets dereferenced in mt9t112_set_params() so we should return
before calling that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/mt9t112.c

index 32114a3c0ca78daa889853893d5fb066f8476cf9..7b34b11daf24d02b5ad0a3eba08c2e437cc60b39 100644 (file)
@@ -1083,8 +1083,10 @@ static int mt9t112_probe(struct i2c_client *client,
        v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops);
 
        ret = mt9t112_camera_probe(client);
-       if (ret)
+       if (ret) {
                kfree(priv);
+               return ret;
+       }
 
        /* Cannot fail: using the default supported pixel code */
        mt9t112_set_params(priv, &rect, V4L2_MBUS_FMT_UYVY8_2X8);