diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2019-10-16 15:21:50 +0200 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2019-10-17 17:13:50 +0200 |
commit | 13bd677a472d534bf100bab2713efc3f9e3f5978 (patch) | |
tree | 21007a0c276b0c01ac45d7bda7dad7c51a19ad94 /drivers/pwm | |
parent | dm snapshot: rework COW throttling to fix deadlock (diff) | |
download | linux-13bd677a472d534bf100bab2713efc3f9e3f5978.tar.xz linux-13bd677a472d534bf100bab2713efc3f9e3f5978.zip |
dm cache: fix bugs when a GFP_NOWAIT allocation fails
GFP_NOWAIT allocation can fail anytime - it doesn't wait for memory being
available and it fails if the mempool is exhausted and there is not enough
memory.
If we go down this path:
map_bio -> mg_start -> alloc_migration -> mempool_alloc(GFP_NOWAIT)
we can see that map_bio() doesn't check the return value of mg_start(),
and the bio is leaked.
If we go down this path:
map_bio -> mg_start -> mg_lock_writes -> alloc_prison_cell ->
dm_bio_prison_alloc_cell_v2 -> mempool_alloc(GFP_NOWAIT) ->
mg_lock_writes -> mg_complete
the bio is ended with an error - it is unacceptable because it could
cause filesystem corruption if the machine ran out of memory
temporarily.
Change GFP_NOWAIT to GFP_NOIO, so that the mempool code will properly
wait until memory becomes available. mempool_alloc with GFP_NOIO can't
fail, so remove the code paths that deal with allocation failure.
Cc: stable@vger.kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/pwm')
0 files changed, 0 insertions, 0 deletions