svn commit: r288715 - stable/10/sys/dev/isp

Alexander Motin mav at FreeBSD.org
Mon Oct 5 08:32:36 UTC 2015


Author: mav
Date: Mon Oct  5 08:32:34 2015
New Revision: 288715
URL: https://svnweb.freebsd.org/changeset/base/288715

Log:
  MFC r285481: Make role sysctl handling from r284727 less strict.

Modified:
  stable/10/sys/dev/isp/isp_freebsd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/isp/isp_freebsd.c
==============================================================================
--- stable/10/sys/dev/isp/isp_freebsd.c	Mon Oct  5 08:31:48 2015	(r288714)
+++ stable/10/sys/dev/isp/isp_freebsd.c	Mon Oct  5 08:32:34 2015	(r288715)
@@ -101,18 +101,15 @@ isp_role_sysctl(SYSCTL_HANDLER_ARGS)
 	ISP_LOCK(isp);
 	old = FCPARAM(isp, chan)->role;
 
+	/* We don't allow target mode switch from here. */
+	value = (old & ISP_ROLE_TARGET) | (value & ISP_ROLE_INITIATOR);
+
 	/* If nothing has changed -- we are done. */
 	if (value == old) {
 		ISP_UNLOCK(isp);
 		return (0);
 	}
 
-	/* We don't allow target mode switch from here. */
-	if ((value ^ old) & ISP_ROLE_TARGET) {
-		ISP_UNLOCK(isp);
-		return (EPERM);
-	}
-
 	/* Actually change the role. */
 	error = isp_control(isp, ISPCTL_CHANGE_ROLE, chan, value);
 	ISP_UNLOCK(isp);


More information about the svn-src-all mailing list