From: Roland Kammerer <[email protected]>

This was found by a static analysis tool. While highly unlikely, be sure
to return without dereferencing the NULL pointer.

Reported-by: Shaobo <[email protected]>
Signed-off-by: Philipp Reisner <[email protected]>
Signed-off-by: Lars Ellenberg <[email protected]>

diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index f0717a9..03471b3 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
-- 
2.7.4

Reply via email to