linux/include/rdma
Roland Dreier 1bc392383d RDMA/ucma: Introduce safer rdma_addr_size() variants
commit 84652aefb3 upstream.

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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-10-21 08:45:39 +01:00
..
ib.h IB/security: Restrict use of the write() interface 2016-06-15 21:29:28 +01:00
ib_addr.h RDMA/ucma: Introduce safer rdma_addr_size() variants 2018-10-21 08:45:39 +01:00
ib_cache.h IB/core: Add ib_find_exact_cached_pkey() 2012-09-30 20:33:30 -07:00
ib_cm.h IB/core: Don't resolve passive side RoCE L2 address in CMA REQ handler 2014-04-01 14:05:26 -07:00
ib_fmr_pool.h RDMA: Improve include file coding style 2008-07-14 23:48:44 -07:00
ib_mad.h IB/core: Fix IB_SA_COMP_MASK macro 2012-05-18 17:16:11 -07:00
ib_marshall.h RDMA/cma: Export rdma cm interface to userspace 2006-12-12 11:50:22 -08:00
ib_pack.h IB/core: Ethernet L2 attributes in verbs/cm structures 2014-01-14 14:20:54 -08:00
ib_pma.h IB/pma: Add include file for IBA performance counters definitions 2011-07-18 21:04:35 -07:00
ib_sa.h RDMA/core: Fix incorrect structure packing for booleans 2017-06-05 21:16:50 +01:00
ib_smi.h IB: Remove __constant_{endian} uses 2009-01-17 17:11:57 -08:00
ib_umem.h IB: Refactor umem to use linear SG table 2014-03-04 10:34:28 -08:00
ib_verbs.h IB/core: Add inline function to validate port 2017-10-12 15:28:00 +01:00
iw_cm.h RDMA/cma: Add IPv6 support for iWARP 2013-08-12 12:32:31 -07:00
iw_portmap.h RDMA/core: Add support for iWARP Port Mapper user space service 2014-06-10 10:11:45 -07:00
rdma_cm.h RDMA/cma: Export cma_get_service_id() 2013-06-20 23:35:41 -07:00
rdma_cm_ib.h RDMA: Fix license text 2008-07-14 23:48:43 -07:00
rdma_netlink.h RDMA/core: Add support for iWARP Port Mapper user space service 2014-06-10 10:11:45 -07:00