misc: mic: use after free printing error message
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 12 Feb 2016 06:40:26 +0000 (09:40 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Feb 2016 01:42:37 +0000 (17:42 -0800)
Swap the printk and kfree() to avoid a use after free bug.

Fixes: 61e9c905df78 ('misc: mic: Enable VOP host side functionality')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mic/vop/vop_vringh.c

index c1dd000f042be729100f44892af67ad67f6f1b69..c3613f39eb352b16539154a9f711fd90725c415a 100644 (file)
@@ -290,9 +290,9 @@ static int vop_virtio_add_device(struct vop_vdev *vdev,
 
        ret = vop_copy_dp_entry(vdev, argp, &type, &dd);
        if (ret) {
-               kfree(vdev);
                dev_err(vop_dev(vdev), "%s %d err %d\n",
                        __func__, __LINE__, ret);
+               kfree(vdev);
                return ret;
        }