diff options
author | Ka-Cheong Poon <ka-cheong.poon@oracle.com> | 2020-06-15 00:40:25 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-06-15 12:58:59 -0700 |
commit | 33cf601da7a42b1a78d04746aea47b85ccb5c49b (patch) | |
tree | 79d9aecaa8670ac58a653964bf8caa04cd4c1e31 /net/rds | |
parent | b3a9e3b9622ae10064826dccb4f7a52bd88c7407 (diff) | |
download | linux-stable-33cf601da7a42b1a78d04746aea47b85ccb5c49b.tar.gz linux-stable-33cf601da7a42b1a78d04746aea47b85ccb5c49b.tar.bz2 linux-stable-33cf601da7a42b1a78d04746aea47b85ccb5c49b.zip |
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>
Diffstat (limited to 'net/rds')
-rw-r--r-- | net/rds/ib.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/rds/ib.h b/net/rds/ib.h index 5ae069d39eab..8dfff43cf07f 100644 --- a/net/rds/ib.h +++ b/net/rds/ib.h @@ -264,7 +264,13 @@ struct rds_ib_device { int *vector_load; }; -#define ibdev_to_node(ibdev) dev_to_node((ibdev)->dev.parent) +static inline int ibdev_to_node(struct ib_device *ibdev) +{ + struct device *parent; + + parent = ibdev->dev.parent; + return parent ? dev_to_node(parent) : NUMA_NO_NODE; +} #define rdsibdev_to_node(rdsibdev) ibdev_to_node(rdsibdev->dev) /* bits for i_ack_flags */ |