OSDN Git Service

xfs: fortify xfs_alloc_buftarg error handling
authorMichal Hocko <mhocko@suse.com>
Thu, 23 Nov 2017 16:13:40 +0000 (17:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Feb 2018 16:05:39 +0000 (17:05 +0100)
commit54a1fdff1b09465d4f5f06bff53fe2b1e0434673
treec1383edfd8cb88a2578dac52cecb9ed45f179840
parent98ae1ca7534e47508719ee54657f01df55437f62
xfs: fortify xfs_alloc_buftarg error handling

[ Upstream commit d210a9874b8f6166579408131cb74495caff1958 ]

percpu_counter_init failure path doesn't clean up &btp->bt_lru list.
Call list_lru_destroy in that error path. Similarly register_shrinker
error path is not handled.

While it is unlikely to trigger these error path, it is not impossible
especially the later might fail with large NUMAs.  Let's handle the
failure to make the code more robust.

Noticed-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_buf.c