Commit ddb8c45ba15149ebd41d7586261c05f7ca37f9a1

Authored by Sasha Levin
Committed by Benjamin LaHaise
1 parent d558023207

aio: nullify aio->ring_pages after freeing it

After freeing ring_pages we leave it as is causing a dangling pointer. This
has already caused an issue so to help catching any issues in the future
NULL it out.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>

Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff

... ... @@ -196,8 +196,10 @@
196 196  
197 197 put_aio_ring_file(ctx);
198 198  
199   - if (ctx->ring_pages && ctx->ring_pages != ctx->internal_pages)
  199 + if (ctx->ring_pages && ctx->ring_pages != ctx->internal_pages) {
200 200 kfree(ctx->ring_pages);
  201 + ctx->ring_pages = NULL;
  202 + }
201 203 }
202 204  
203 205 static int aio_ring_mmap(struct file *file, struct vm_area_struct *vma)