xfs: fortify xfs_alloc_buftarg error handling
authorMichal Hocko <mhocko@suse.com>
Thu, 23 Nov 2017 16:13:40 +0000 (17:13 +0100)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 28 Nov 2017 16:57:11 +0000 (08:57 -0800)
commitd210a9874b8f6166579408131cb74495caff1958
tree98f69c1ca0e3428c3f203eef300b9da08c6375e7
parent509955823cc9cc225c05673b1b83d70ca70c5c60
xfs: fortify xfs_alloc_buftarg error handling

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>
fs/xfs/xfs_buf.c