From: Roland Kammerer Date: Tue, 29 Aug 2017 08:20:47 +0000 (+0200) Subject: drbd: abort drbd_start_resync if there is no connection X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d3d2948f4353300e483e03be3f400dc07cf504ce;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drbd: abort drbd_start_resync if there is no connection This was found by a static analysis tool. While highly unlikely, be sure to return without dereferencing the NULL pointer. Reported-by: Shaobo Signed-off-by: Philipp Reisner Signed-off-by: Lars Ellenberg Signed-off-by: Jens Axboe --- diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index f0717a97a42a..03471b3fce86 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c @@ -1756,6 +1756,11 @@ void drbd_start_resync(struct drbd_device *device, enum drbd_conns side) return; } + if (!connection) { + drbd_err(device, "No connection to peer, aborting!\n"); + return; + } + if (!test_bit(B_RS_H_DONE, &device->flags)) { if (side == C_SYNC_TARGET) { /* Since application IO was locked out during C_WF_BITMAP_T and