Enforce validation on the selected delete method via sysctl.

This prevents users from selecting a delete method which may cause
corruption e.g. MPS WS16 on pre P14 firmware.

Reviewed by:	pjd (mentor)
Approved by:	pjd (mentor)
MFC after:	2 days
This commit is contained in:
Steven Hartland 2013-05-24 11:27:06 +00:00
parent 537cc627d7
commit 190b967447
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=250967

View File

@ -1780,7 +1780,8 @@ dadeletemethodsysctl(SYSCTL_HANDLER_ARGS)
if (error != 0 || req->newptr == NULL)
return (error);
for (i = 0; i <= DA_DELETE_MAX; i++) {
if (strcmp(buf, da_delete_method_names[i]) != 0)
if (!(softc->delete_available & (1 << i)) ||
strcmp(buf, da_delete_method_names[i]) != 0)
continue;
dadeletemethodset(softc, i);
return (0);