Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jul 2015 15:51:29 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285481 - head/sys/dev/isp
Message-ID:  <201507131551.t6DFpTmG096971@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Jul 13 15:51:28 2015
New Revision: 285481
URL: https://svnweb.freebsd.org/changeset/base/285481

Log:
  Make role sysctl handling from r284727 less strict.

Modified:
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp_freebsd.c
==============================================================================
--- head/sys/dev/isp/isp_freebsd.c	Mon Jul 13 15:46:01 2015	(r285480)
+++ head/sys/dev/isp/isp_freebsd.c	Mon Jul 13 15:51:28 2015	(r285481)
@@ -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);



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