[patch 1/2] misc: mic: use after free printing error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

diff --git a/drivers/misc/mic/vop/vop_vringh.c b/drivers/misc/mic/vop/vop_vringh.c
index c1dd000..c3613f3 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;
 	}
 
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux