Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jan 2015 13:21:31 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r277749 - stable/10/usr.sbin/ctld
Message-ID:  <201501261321.t0QDLVLb047330@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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++;
+				 */
+			}
+		}
 	}
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501261321.t0QDLVLb047330>