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

This commit is contained in:
mav 2015-10-05 08:32:34 +00:00
parent ec7deb53d1
commit f19237a8be

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