Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Oct 2015 08:32:35 +0000 (UTC)
From:      Alexander Motin <mav@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: r288715 - stable/10/sys/dev/isp
Message-ID:  <201510050832.t958WZmm009366@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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