diff options
author | Steve Wise <swise@opengridcomputing.com> | 2007-03-02 17:06:36 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-03-06 14:48:17 -0500 |
commit | aeb100e2466b11e6087ee6f467b712e119213158 (patch) | |
tree | 60ff485dde252387cd9da9e53f7a91e3c7305592 /drivers | |
parent | 7d526e6b2c5d6bba70fdc1fc2943bdaf9cc6147d (diff) |
RDMA/cxgb3: Don't use mm after it's freed in iwch_mmap()
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/cxgb3/iwch_provider.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index 9947a144a929..b357c11d148f 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -331,6 +331,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
331 | int ret = 0; | 331 | int ret = 0; |
332 | struct iwch_mm_entry *mm; | 332 | struct iwch_mm_entry *mm; |
333 | struct iwch_ucontext *ucontext; | 333 | struct iwch_ucontext *ucontext; |
334 | u64 addr; | ||
334 | 335 | ||
335 | PDBG("%s pgoff 0x%lx key 0x%x len %d\n", __FUNCTION__, vma->vm_pgoff, | 336 | PDBG("%s pgoff 0x%lx key 0x%x len %d\n", __FUNCTION__, vma->vm_pgoff, |
336 | key, len); | 337 | key, len); |
@@ -345,10 +346,11 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
345 | mm = remove_mmap(ucontext, key, len); | 346 | mm = remove_mmap(ucontext, key, len); |
346 | if (!mm) | 347 | if (!mm) |
347 | return -EINVAL; | 348 | return -EINVAL; |
349 | addr = mm->addr; | ||
348 | kfree(mm); | 350 | kfree(mm); |
349 | 351 | ||
350 | if ((mm->addr >= rdev_p->rnic_info.udbell_physbase) && | 352 | if ((addr >= rdev_p->rnic_info.udbell_physbase) && |
351 | (mm->addr < (rdev_p->rnic_info.udbell_physbase + | 353 | (addr < (rdev_p->rnic_info.udbell_physbase + |
352 | rdev_p->rnic_info.udbell_len))) { | 354 | rdev_p->rnic_info.udbell_len))) { |
353 | 355 | ||
354 | /* | 356 | /* |
@@ -362,7 +364,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
362 | vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; | 364 | vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; |
363 | vma->vm_flags &= ~VM_MAYREAD; | 365 | vma->vm_flags &= ~VM_MAYREAD; |
364 | ret = io_remap_pfn_range(vma, vma->vm_start, | 366 | ret = io_remap_pfn_range(vma, vma->vm_start, |
365 | mm->addr >> PAGE_SHIFT, | 367 | addr >> PAGE_SHIFT, |
366 | len, vma->vm_page_prot); | 368 | len, vma->vm_page_prot); |
367 | } else { | 369 | } else { |
368 | 370 | ||
@@ -370,7 +372,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) | |||
370 | * Map WQ or CQ contig dma memory... | 372 | * Map WQ or CQ contig dma memory... |
371 | */ | 373 | */ |
372 | ret = remap_pfn_range(vma, vma->vm_start, | 374 | ret = remap_pfn_range(vma, vma->vm_start, |
373 | mm->addr >> PAGE_SHIFT, | 375 | addr >> PAGE_SHIFT, |
374 | len, vma->vm_page_prot); | 376 | len, vma->vm_page_prot); |
375 | } | 377 | } |
376 | 378 | ||