OSDN Git Service

RDMA/uverbs: Prohibit write() calls with too small buffers
authorJason Gunthorpe <jgg@mellanox.com>
Sun, 25 Nov 2018 18:51:17 +0000 (20:51 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 26 Nov 2018 23:48:07 +0000 (16:48 -0700)
commitda0f60df7bd5a045aa423ec64fe5d7e29ba803ff
tree08a0c90e7d48bc5ba6b442b544c9527f2682cbc7
parent669dac1e00c50a65cb8ecf08862c3c9dd7a29a98
RDMA/uverbs: Prohibit write() calls with too small buffers

The size meta-data in the prior patch describes the smallest acceptable
buffer for the write() interface. Globally check this in the core code.

This is necessary in the case of write() methods that have a driver udata
to prevent computing a negative udata buffer length.

The return code of -ENOSPC is chosen here as some of the handlers already
use this code, however many other handler use EINVAL.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/infiniband/core/uverbs_main.c