device-dax: fix cdev leak
If device_add() fails, cleanup the cdev. Otherwise, we leak a kobj_map() with a stale device number. As Jason points out, there is a small possibility that userspace has opened and mapped the device in the time between cdev_add() and the device_add() failure. We need a new kill_dax_dev() helper to invalidate any established mappings. Fixes: ba09c01d ("dax: convert to the cdev api") Cc: <stable@vger.kernel.org> Reported-by: NJason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: NDan Williams <dan.j.williams@intel.com> Signed-off-by: NLogan Gunthorpe <logang@deltatee.com> Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de> Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing
想要评论请 注册 或 登录