lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 14 Oct 2011 23:57:50 +0200
From:	Philipp Reisner <philipp.reisner@...bit.com>
To:	linux-kernel@...r.kernel.org, Jens Axboe <axboe@...nel.dk>
Cc:	drbd-dev@...ts.linbit.com
Subject: [PATCH 09/11] drbd: receive_protocol(): Make the program flow less confusing

From: Andreas Gruenbacher <agruen@...bit.com>

Signed-off-by: Philipp Reisner <philipp.reisner@...bit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@...bit.com>
---
 drivers/block/drbd/drbd_receiver.c |   73 +++++++++++++++++------------------
 1 files changed, 35 insertions(+), 38 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 11f2e72..06bbf0f 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -3083,55 +3083,52 @@ static int receive_protocol(struct drbd_tconn *tconn, struct packet_info *pi)
 
 		synchronize_rcu();
 		kfree(old_net_conf);
+	} else {
+		clear_bit(CONN_DRY_RUN, &tconn->flags);
 
-		return 0;
-	}
-
-	clear_bit(CONN_DRY_RUN, &tconn->flags);
+		if (cf & CF_DRY_RUN)
+			set_bit(CONN_DRY_RUN, &tconn->flags);
 
-	if (cf & CF_DRY_RUN)
-		set_bit(CONN_DRY_RUN, &tconn->flags);
+		rcu_read_lock();
+		nc = rcu_dereference(tconn->net_conf);
 
-	rcu_read_lock();
-	nc = rcu_dereference(tconn->net_conf);
+		if (p_proto != nc->wire_protocol) {
+			conn_err(tconn, "incompatible communication protocols\n");
+			goto disconnect_rcu_unlock;
+		}
 
-	if (p_proto != nc->wire_protocol) {
-		conn_err(tconn, "incompatible communication protocols\n");
-		goto disconnect_rcu_unlock;
-	}
+		if (convert_after_sb(p_after_sb_0p) != nc->after_sb_0p) {
+			conn_err(tconn, "incompatible after-sb-0pri settings\n");
+			goto disconnect_rcu_unlock;
+		}
 
-	if (convert_after_sb(p_after_sb_0p) != nc->after_sb_0p) {
-		conn_err(tconn, "incompatible after-sb-0pri settings\n");
-		goto disconnect_rcu_unlock;
-	}
+		if (convert_after_sb(p_after_sb_1p) != nc->after_sb_1p) {
+			conn_err(tconn, "incompatible after-sb-1pri settings\n");
+			goto disconnect_rcu_unlock;
+		}
 
-	if (convert_after_sb(p_after_sb_1p) != nc->after_sb_1p) {
-		conn_err(tconn, "incompatible after-sb-1pri settings\n");
-		goto disconnect_rcu_unlock;
-	}
+		if (convert_after_sb(p_after_sb_2p) != nc->after_sb_2p) {
+			conn_err(tconn, "incompatible after-sb-2pri settings\n");
+			goto disconnect_rcu_unlock;
+		}
 
-	if (convert_after_sb(p_after_sb_2p) != nc->after_sb_2p) {
-		conn_err(tconn, "incompatible after-sb-2pri settings\n");
-		goto disconnect_rcu_unlock;
-	}
+		if (p_discard_my_data && nc->discard_my_data) {
+			conn_err(tconn, "both sides have the 'discard_my_data' flag set\n");
+			goto disconnect_rcu_unlock;
+		}
 
-	if (p_discard_my_data && nc->discard_my_data) {
-		conn_err(tconn, "both sides have the 'discard_my_data' flag set\n");
-		goto disconnect_rcu_unlock;
-	}
+		if (p_two_primaries != nc->two_primaries) {
+			conn_err(tconn, "incompatible setting of the two-primaries options\n");
+			goto disconnect_rcu_unlock;
+		}
 
-	if (p_two_primaries != nc->two_primaries) {
-		conn_err(tconn, "incompatible setting of the two-primaries options\n");
-		goto disconnect_rcu_unlock;
-	}
+		if (strcmp(integrity_alg, nc->integrity_alg)) {
+			conn_err(tconn, "incompatible setting of the data-integrity-alg\n");
+			goto disconnect_rcu_unlock;
+		}
 
-	if (strcmp(integrity_alg, nc->integrity_alg)) {
-		conn_err(tconn, "incompatible setting of the data-integrity-alg\n");
-		goto disconnect_rcu_unlock;
+		rcu_read_unlock();
 	}
-
-	rcu_read_unlock();
-
 	return 0;
 
 disconnect_rcu_unlock:
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ