Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA: Check for NULL mode in .devnode methods

Commits 71c29bd5c235 ("IB/uverbs: Add devnode method to set path/mode")
and c3af0980ce01 ("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>

authored by

Goldwyn Rodrigues and committed by
Linus Torvalds
b2bc4782 ba466c74

+4 -2
+2 -1
drivers/infiniband/core/cm.c
··· 3641 3641 3642 3642 static char *cm_devnode(struct device *dev, mode_t *mode) 3643 3643 { 3644 - *mode = 0666; 3644 + if (mode) 3645 + *mode = 0666; 3645 3646 return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev)); 3646 3647 } 3647 3648
+2 -1
drivers/infiniband/core/uverbs_main.c
··· 826 826 827 827 static char *uverbs_devnode(struct device *dev, mode_t *mode) 828 828 { 829 - *mode = 0666; 829 + if (mode) 830 + *mode = 0666; 830 831 return kasprintf(GFP_KERNEL, "infiniband/%s", dev_name(dev)); 831 832 } 832 833