android_kernel_xiaomi_sm8350/drivers/infiniband/core
Dan Carpenter 7182afea8d IB/uverbs: Handle large number of entries in poll CQ
In ib_uverbs_poll_cq() code there is a potential integer overflow if
userspace passes in a large cmd.ne.  The calls to kmalloc() would
allocate smaller buffers than intended, leading to memory corruption.
There iss also an information leak if resp wasn't all used.
Unprivileged userspace may call this function, although only if an
RDMA device that uses this function is present.

Fix this by copying CQ entries one at a time, which avoids the
allocation entirely, and also by moving this copying into a function
that makes sure to initialize all memory copied to userspace.

Special thanks to Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
for his help and advice.

Cc: <stable@kernel.org>
Signed-off-by: Dan Carpenter <error27@gmail.com>

[ Monkey around with things a bit to avoid bad code generation by gcc
  when designated initializers are used.  - Roland ]

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2010-12-08 15:23:49 -08:00
..
addr.c
agent.c IB/mad: IBoE supports only QP1 (no QP0) 2010-10-13 09:38:11 -07:00
agent.h
cache.c
cm_msgs.h
cm.c
cma.c IB/core: Add VLAN support for IBoE 2010-10-25 10:20:39 -07:00
core_priv.h
device.c
fmr_pool.c
iwcm.c RDMA/iwcm: Fix hang in uninterruptible wait on cm_id destroy 2010-10-11 20:24:04 -07:00
iwcm.h
mad_priv.h
mad_rmpp.c
mad_rmpp.h
mad.c IB/mad: IBoE supports only QP1 (no QP0) 2010-10-13 09:38:11 -07:00
Makefile
multicast.c IB/mad: IBoE supports only QP1 (no QP0) 2010-10-13 09:38:11 -07:00
packer.c
sa_query.c RDMA/cm: Add RDMA CM support for IBoE devices 2010-10-13 15:46:43 -07:00
sa.h
smi.c
smi.h
sysfs.c IB/core: Add link layer type information to sysfs 2010-10-25 10:20:39 -07:00
ucm.c
ucma.c Merge branches 'amso1100', 'cma', 'cxgb3', 'cxgb4', 'ehca', 'iboe', 'ipoib', 'misc', 'mlx4', 'nes', 'qib' and 'srp' into for-next 2010-10-26 16:09:11 -07:00
ud_header.c IB/pack: Remove some unused code added by the IBoE patches 2010-12-01 16:30:18 -08:00
umem.c
user_mad.c IB/umad: Make user_mad semaphore a real one 2010-09-28 20:52:21 -07:00
uverbs_cmd.c IB/uverbs: Handle large number of entries in poll CQ 2010-12-08 15:23:49 -08:00
uverbs_main.c
uverbs_marshall.c IB: Fix information leak in marshalling code 2010-12-01 16:33:18 -08:00
uverbs.h
verbs.c IB/core: Add link layer property to ports 2010-09-27 17:51:10 -07:00