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

net/rds: NULL pointer de-reference in rds_ib_add_one()

The parent field of a struct device may be NULL. The macro
ibdev_to_node() should check for that.

Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ka-Cheong Poon and committed by
David S. Miller
33cf601d b3a9e3b9

+7 -1
+7 -1
net/rds/ib.h
··· 264 264 int *vector_load; 265 265 }; 266 266 267 - #define ibdev_to_node(ibdev) dev_to_node((ibdev)->dev.parent) 267 + static inline int ibdev_to_node(struct ib_device *ibdev) 268 + { 269 + struct device *parent; 270 + 271 + parent = ibdev->dev.parent; 272 + return parent ? dev_to_node(parent) : NUMA_NO_NODE; 273 + } 268 274 #define rdsibdev_to_node(rdsibdev) ibdev_to_node(rdsibdev->dev) 269 275 270 276 /* bits for i_ack_flags */