Commit b34e0e1319b31202eb142dcd9688cf7145a30bf6
Committed by
Greg Kroah-Hartman
1 parent
a23f966716
aio: fix aio request leak when events are reaped by userspace
commit f8567a3845ac05bb28f3c1b478ef752762bd39ef upstream. The aio cleanups and optimizations by kmo that were merged into the 3.10 tree added a regression for userspace event reaping. Specifically, the reference counts are not decremented if the event is reaped in userspace, leading to the application being unable to submit further aio requests. This patch applies to 3.12+. A separate backport is required for 3.10/3.11. This issue was uncovered as part of CVE-2014-0206. Signed-off-by: Benjamin LaHaise <bcrl@kvack.org> Cc: Kent Overstreet <kmo@daterainc.com> Cc: Mateusz Guzik <mguzik@redhat.com> Cc: Petr Matousek <pmatouse@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 1 additions and 2 deletions Side-by-side Diff
fs/aio.c
... | ... | @@ -1021,6 +1021,7 @@ |
1021 | 1021 | |
1022 | 1022 | /* everything turned out well, dispose of the aiocb. */ |
1023 | 1023 | kiocb_free(iocb); |
1024 | + put_reqs_available(ctx, 1); | |
1024 | 1025 | |
1025 | 1026 | /* |
1026 | 1027 | * We have to order our ring_info tail store above and test |
... | ... | @@ -1100,8 +1101,6 @@ |
1100 | 1101 | flush_dcache_page(ctx->ring_pages[0]); |
1101 | 1102 | |
1102 | 1103 | pr_debug("%li h%u t%u\n", ret, head, tail); |
1103 | - | |
1104 | - put_reqs_available(ctx, ret); | |
1105 | 1104 | out: |
1106 | 1105 | mutex_unlock(&ctx->ring_lock); |
1107 | 1106 |