Commit Message

From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
The use after free is not triggerable here because the cdev holds
the module lock and the only device_unregister is only triggered by
module unload, however make the change for consistency.
To make this work the cdev_del needs to move out of the struct device
release function.
This cleans up the error path significantly and thus also fixes a minor
bug where the devnum would not be released if cdev_add failed.
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>Signed-off-by: Logan Gunthorpe <logang@deltatee.com>Reviewed-by: Logan Gunthorpe <logang@deltatee.com>Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/core/ucm.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)