Author: trasz
Date: Mon Jan 26 13:21:30 2015
New Revision: 277749
URL: https://svnweb.freebsd.org/changeset/base/277749

Log:
  MFC r274791:
  
  Add missing error checking for kernel_port_{add,remove}().  Both can fail
  for reasons yet unknown; don't make it increment cumulated_error as a kind
  of temporary workaround.
  
  MFC r275399:
  
  Fix null pointer dereference.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/10/usr.sbin/ctld/ctld.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctld/ctld.c
==============================================================================
--- stable/10/usr.sbin/ctld/ctld.c      Mon Jan 26 13:17:20 2015        
(r277748)
+++ stable/10/usr.sbin/ctld/ctld.c      Mon Jan 26 13:21:30 2015        
(r277749)
@@ -1680,7 +1680,16 @@ conf_apply(struct conf *oldconf, struct 
                                        cumulated_error++;
                                }
                        }
-                       kernel_port_remove(oldtarg);
+                       error = kernel_port_remove(oldtarg);
+                       if (error != 0) {
+                               log_warnx("failed to remove target %s",
+                                   oldtarg->t_name);
+                               /*
+                                * XXX: Uncomment after fixing the root cause.
+                                *
+                                * cumulated_error++;
+                                */
+                       }
                        continue;
                }
 
@@ -1814,8 +1823,18 @@ conf_apply(struct conf *oldconf, struct 
                                cumulated_error++;
                        }
                }
-               if (oldtarg == NULL)
-                       kernel_port_add(newtarg);
+               if (oldtarg == NULL) {
+                       error = kernel_port_add(newtarg);
+                       if (error != 0) {
+                               log_warnx("failed to add target %s",
+                                   newtarg->t_name);
+                               /*
+                                * XXX: Uncomment after fixing the root cause.
+                                *
+                                * cumulated_error++;
+                                */
+                       }
+               }
        }
 
        /*
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to