Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] drbdadm segfaults with incorrect drbd.conf
@ 2007-06-20 16:34 Dave Jiang
  2007-06-20 17:32 ` Philipp Reisner
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jiang @ 2007-06-20 16:34 UTC (permalink / raw)
  To: drbd-dev

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

It seems that when the resources aren't setup exactly right in drbd.conf
drbdadm can segfault due to using a pointer that is NULL. Attached is a patch
that fixes the issue.

-- 

------------------------------------------------------
Dave Jiang
Software Engineer
MontaVista Software, Inc.
http://www.mvista.com
------------------------------------------------------


[-- Attachment #2: drbd_check_valid_ptr.patch --]
[-- Type: text/x-patch, Size: 806 bytes --]

diff -Naurp drbd-8.0.3/user/drbdadm_main.c drbd-8.0.3-mod/user/drbdadm_main.c
--- drbd-8.0.3/user/drbdadm_main.c	2007-05-02 02:13:37.000000000 -0700
+++ drbd-8.0.3-mod/user/drbdadm_main.c	2007-06-20 09:27:45.000000000 -0700
@@ -1029,6 +1029,7 @@ struct d_resource* res_by_minor(const ch
   mm = m_strtoll(id+6,1);
 
   for_each_resource(res,t,config) {
+    if( !res->me ) continue;
     if( mm == dt_minor_of_dev(res->me->device)) return res;
   }
   return NULL;
@@ -1818,7 +1819,9 @@ int main(int argc, char** argv)
 
     highest_minor=0;
     for_each_resource(res,tmp,config) {
-      int m = dt_minor_of_dev(res->me->device);
+      int m;
+      if ( !res->me ) continue;
+      m = dt_minor_of_dev(res->me->device);
       if ( m > highest_minor ) highest_minor = m;
       nr_resources++;
     }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-25 14:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-20 16:34 [Drbd-dev] drbdadm segfaults with incorrect drbd.conf Dave Jiang
2007-06-20 17:32 ` Philipp Reisner
     [not found]   ` <46796D1E.5090105@mvista.com>
2007-06-25 14:07     ` Philipp Reisner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox