[Drbd-dev] [PATCH] drbdadm: Avoid null pointer dereference on wrong hostnames

Michael Bunk bunk at iat.uni-leipzig.de
Mon Sep 12 16:52:00 CEST 2011


If all hostnames in the config did not apply to the current host, a pointer was
dereferenced (resulting in a segmentation fault), before an error message
regarding the hostname could be output.
---
 user/drbdadm_main.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/user/drbdadm_main.c b/user/drbdadm_main.c
index db7c0d3..f27eaff 100644
--- a/user/drbdadm_main.c
+++ b/user/drbdadm_main.c
@@ -2556,6 +2556,10 @@ int ctx_set_implicit_volume(struct cfg_ctx *ctx)
 	if (ctx->vol || !ctx->res)
 		return 0;
 
+	if (!ctx->res->me) {
+		return 0;
+	}
+
 	for_each_volume(vol, ctx->res->me->volumes) {
 		volumes++;
 		v = vol;
-- 
1.4.4.4



More information about the drbd-dev mailing list