md-cluster: Fix potential error pointer dereference in resize_bitmaps()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 4 Aug 2020 10:16:45 +0000 (13:16 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 11:07:39 +0000 (13:07 +0200)
commit2f3292325816d0cba5988916357751d91a194660
tree775da87235af87e37a963f0c2ddb08e260306cef
parentb1e0ac52fd4fdc8b16928a564cc8a73be85b5adc
md-cluster: Fix potential error pointer dereference in resize_bitmaps()

[ Upstream commit e8abe1de43dac658dacbd04a4543e0c988a8d386 ]

The error handling calls md_bitmap_free(bitmap) which checks for NULL
but will Oops if we pass an error pointer.  Let's set "bitmap" to NULL
on this error path.

Fixes: afd756286083 ("md-cluster/raid10: resize all the bitmaps before start reshape")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/md-cluster.c