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

rds: prevent dereference of a NULL device in rds_iw_laddr_check

Binding might result in a NULL device which is later dereferenced
without checking.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Sasha Levin and committed by
David S. Miller
bf39b424 2d3b479d

+2 -1
+2 -1
net/rds/iw.c
··· 239 239 ret = rdma_bind_addr(cm_id, (struct sockaddr *)&sin); 240 240 /* due to this, we will claim to support IB devices unless we 241 241 check node_type. */ 242 - if (ret || cm_id->device->node_type != RDMA_NODE_RNIC) 242 + if (ret || !cm_id->device || 243 + cm_id->device->node_type != RDMA_NODE_RNIC) 243 244 ret = -EADDRNOTAVAIL; 244 245 245 246 rdsdebug("addr %pI4 ret %d node type %d\n",