1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285481

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