Make role sysctl handling from r284727 less strict.

This commit is contained in:
Alexander Motin 2015-07-13 15:51:28 +00:00
parent ead3ab7aa4
commit 391f03dafb

View File

@ -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);