linux/include/rdma
Roland Dreier 84652aefb3 RDMA/ucma: Introduce safer rdma_addr_size() variants
There are several places in the ucma ABI where userspace can pass in a
sockaddr but set the address family to AF_IB.  When that happens,
rdma_addr_size() will return a size bigger than sizeof struct sockaddr_in6,
and the ucma kernel code might end up copying past the end of a buffer
not sized for a struct sockaddr_ib.

Fix this by introducing new variants

    int rdma_addr_size_in6(struct sockaddr_in6 *addr);
    int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr);

that are type-safe for the types used in the ucma ABI and return 0 if the
size computed is bigger than the size of the type passed in.  We can use
these new variants to check what size userspace has passed in before
copying any addresses.

Reported-by: <syzbot+6800425d54ed3ed8135d@syzkaller.appspotmail.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2018-03-28 16:13:36 -06:00
..
ib.h
ib_addr.h RDMA/ucma: Introduce safer rdma_addr_size() variants 2018-03-28 16:13:36 -06:00
ib_cache.h
ib_cm.h
ib_fmr_pool.h
ib_hdrs.h IB/hfi1: Remove unnecessary fecn and becn fields 2018-02-01 15:43:29 -07:00
ib_mad.h
ib_marshall.h
ib_pack.h
ib_pma.h
ib_sa.h IB/{core, cm, cma, ipoib}: Rename ib_init_ah_from_path to ib_init_ah_attr_from_path 2017-12-18 15:37:11 -07:00
ib_smi.h
ib_umem.h
ib_umem_odp.h
ib_verbs.h RDMA/verbs: Remove restrack entry from XRCD structure 2018-03-19 14:10:30 -06:00
iw_cm.h
iw_portmap.h
mr_pool.h
opa_addr.h IB/SA: Check dlid before SA agent queries for ClassPortInfo 2017-12-22 13:33:30 -07:00
opa_port_info.h
opa_smi.h
opa_vnic.h
rdma_cm.h RDMA/cma: Introduce API to read GIDs for multiple transports 2018-01-19 13:05:38 -07:00
rdma_cm_ib.h RDMA/{cma, ucma}: Simplify and rename rdma_set_ib_paths 2018-01-10 22:00:33 -07:00
rdma_netlink.h
rdma_vt.h IB/{rdmavt, hfi1, qib}: Remove get_card_name() downcall 2018-01-05 13:34:55 -05:00
rdmavt_cq.h
rdmavt_mr.h
rdmavt_qp.h
restrack.h RDMA/restrack: Remove unimplemented XRCD object 2018-02-15 14:59:44 -07:00
rw.h
uverbs_ioctl.h IB/uverbs: Use u64_to_user_ptr() not a union 2018-02-15 14:59:45 -07:00
uverbs_std_types.h
uverbs_types.h