summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorRoland Dreier2005-08-27 03:34:14 +0200
committerLinus Torvalds2005-08-27 04:37:12 +0200
commite1bcfcaa0b3bec2a67b22c565a0bf508ea90db1d (patch)
tree01c6de89a3d60c35d2133c0b6b1903509a8f1df8 /drivers/infiniband
parent[PATCH] arm: fix IXP4xx flash resource range (diff)
downloadkernel-qcow2-linux-e1bcfcaa0b3bec2a67b22c565a0bf508ea90db1d.tar.gz
kernel-qcow2-linux-e1bcfcaa0b3bec2a67b22c565a0bf508ea90db1d.tar.xz
kernel-qcow2-linux-e1bcfcaa0b3bec2a67b22c565a0bf508ea90db1d.zip
[PATCH] IB: fix use-after-free in user verbs cleanup
Fix a use-after-free bug in userspace verbs cleanup: we can't touch mr->device after we free mr by calling ib_dereg_mr(). Signed-off-by: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/uverbs_main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index eb99e693dec2..5f6e9ea29cd7 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -130,13 +130,14 @@ static int ib_dealloc_ucontext(struct ib_ucontext *context)
list_for_each_entry_safe(uobj, tmp, &context->mr_list, list) {
struct ib_mr *mr = idr_find(&ib_uverbs_mr_idr, uobj->id);
+ struct ib_device *mrdev = mr->device;
struct ib_umem_object *memobj;
idr_remove(&ib_uverbs_mr_idr, uobj->id);
ib_dereg_mr(mr);
memobj = container_of(uobj, struct ib_umem_object, uobject);
- ib_umem_release_on_close(mr->device, &memobj->umem);
+ ib_umem_release_on_close(mrdev, &memobj->umem);
list_del(&uobj->list);
kfree(memobj);