RDMA: Check for NULL mode in .devnode methods
Commits71c29bd5c2
("IB/uverbs: Add devnode method to set path/mode") andc3af0980ce
("IB: Add devnode methods to cm_class and umad_class") added devnode methods that set the mode. However, these methods don't check for a NULL mode, and so we get a crash when unloading modules because devtmpfs_delete_node() calls device_get_devnode() with mode == NULL. Add the missing checks. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.de> [ Also fix cm.c. - Roland ] Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
ba466c74d9
commit
b2bc478219
|
@ -3641,7 +3641,8 @@ static struct kobj_type cm_port_obj_type = {
|
|||
|
||||
static char *cm_devnode(struct device *dev, mode_t *mode)
|
||||
{
|
||||
*mode = 0666;
|
||||
if (mode)
|
||||
*mode = 0666;
|
||||
return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
|
|
|
@ -826,7 +826,8 @@ static void ib_uverbs_remove_one(struct ib_device *device)
|
|||
|
||||
static char *uverbs_devnode(struct device *dev, mode_t *mode)
|
||||
{
|
||||
*mode = 0666;
|
||||
if (mode)
|
||||
*mode = 0666;
|
||||
return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue