From 6ddf2f0cb1e1931d16e08e30130ed04e5a441f2c Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 12 Feb 2016 09:40:26 +0300 Subject: [PATCH] misc: mic: use after free printing error message 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 Signed-off-by: Greg Kroah-Hartman --- drivers/misc/mic/vop/vop_vringh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/mic/vop/vop_vringh.c b/drivers/misc/mic/vop/vop_vringh.c index c1dd000f042b..c3613f39eb35 100644 --- a/drivers/misc/mic/vop/vop_vringh.c +++ b/drivers/misc/mic/vop/vop_vringh.c @@ -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; }