OSDN Git Service

RDMA/umem: Fix potential addition overflow
authorDoug Ledford <dledford@redhat.com>
Fri, 21 Sep 2018 15:30:13 +0000 (11:30 -0400)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 25 Sep 2018 21:19:06 +0000 (15:19 -0600)
commitc6ce580716372d71cd119bacf73f14a62e9af2ea
treecfec93bc6ebd1580a7498589c05db2d516078b19
parent3312d1c6bdee6aa912c099c0ac0662d197c52842
RDMA/umem: Fix potential addition overflow

Given a large enough memory allocation, it is possible to wrap the
pinned_vm counter.  Check for addition overflow to prevent such
eventualities.

Fixes: 40ddacf2dda9 ("RDMA/umem: Don't hold mmap_sem for too long")
Reported-by: Jason Gunthorpe <jgg@ziepe.ca>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/umem.c