summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-10-13 09:13:12 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2011-01-07 14:43:06 -0800
commit4423917fd5ce23c4f78d34ea8cee3100f7361199 (patch)
tree12be9a70810baf2cb56c0c6e1bf281b214ae8b12 /kernel
parentc756b7289be03cf4d8ee03e0300b418e65e3ff0d (diff)
IB/uverbs: Handle large number of entries in poll CQ
commit 7182afea8d1afd432a17c18162cc3fd441d0da93 upstream. 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. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions