summaryrefslogtreecommitdiff
path: root/drivers/block/drbd
diff options
context:
space:
mode:
authorRoland Kammerer <roland.kammerer@linbit.com>2017-08-29 10:20:47 +0200
committerJens Axboe <axboe@kernel.dk>2017-08-29 15:34:46 -0600
commitd3d2948f4353300e483e03be3f400dc07cf504ce (patch)
treefb3af994750712c1cc04156cfeba8f3f9385f441 /drivers/block/drbd
parent183ece30053f1597120ee30174955d7a971bc146 (diff)
downloadlinux-d3d2948f4353300e483e03be3f400dc07cf504ce.tar.gz
linux-d3d2948f4353300e483e03be3f400dc07cf504ce.tar.xz
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 <shaobo@cs.utah.edu> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r--drivers/block/drbd/drbd_worker.c5
1 files changed, 5 insertions, 0 deletions
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