Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/uverbs: Don't leak ref to mm on error path

In ib_umem_release_on_close(), if the kmalloc() fails, then a
reference to current->mm will be leaked. Fix this by adding a mmput()
instead of just returning on kmalloc() failure.

Signed-off-by: Roland Dreier <rolandd@cisco.com>

+3 -1
+3 -1
drivers/infiniband/core/uverbs_mem.c
··· 211 211 */ 212 212 213 213 work = kmalloc(sizeof *work, GFP_KERNEL); 214 - if (!work) 214 + if (!work) { 215 + mmput(mm); 215 216 return; 217 + } 216 218 217 219 INIT_WORK(&work->work, ib_umem_account, work); 218 220 work->mm = mm;