]> git.baikalelectronics.ru Git - kernel.git/commit
md/raid1: r1buf_pool_alloc: free allocate pages when subsequent allocation fails.
authorNeilBrown <neilb@suse.de>
Wed, 9 Apr 2014 02:25:43 +0000 (12:25 +1000)
committerNeilBrown <neilb@suse.de>
Wed, 9 Apr 2014 04:42:23 +0000 (14:42 +1000)
commitab04a8e5d0a872dcdc1e98a9bd8c922bfade6e85
tree435a7a9ea35a3a68b6943e4bbf24b6c9b09281e3
parentd64fa7889d74217b401b8441e8ad4828d9483ba4
md/raid1: r1buf_pool_alloc: free allocate pages when subsequent allocation fails.

When performing a user-request check/repair (MD_RECOVERY_REQUEST is set)
on a raid1, we allocate multiple bios each with their own set of pages.

If the page allocations for one bio fails, we currently do *not* free
the pages allocated for the previous bios, nor do we free the bio itself.

This patch frees all the already-allocate pages, and makes sure that
all the bios are freed as well.

This bug can cause a memory leak which can ultimately OOM a machine.
It was introduced in 3.10-rc1.

Fixes: 9aca4628580390f3252a500582d8bb003cd4ac63
Cc: Kent Overstreet <koverstreet@google.com>
Cc: stable@vger.kernel.org (3.10+)
Reported-by: Russell King - ARM Linux <linux@arm.linux.org.uk>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/raid1.c