Use a regular sbuf + SYSCTL_OUT() rather than sbuf_new_for_sysctl() with

auto-draining, to avoid a potential copyout fault while holding a lock.

Pointed out by:	  jhb
Pointy hat to:	  ian
This commit is contained in:
ian 2015-03-16 19:18:45 +00:00
parent ff87dec3ce
commit 6158729687

View File

@ -394,10 +394,12 @@ fail_point_sysctl(SYSCTL_HANDLER_ARGS)
int error;
/* Retrieving */
sbuf_new_for_sysctl(&sb, NULL, 128, req);
sbuf_new(&sb, NULL, 128, SBUF_AUTOEXTEND | SBUF_INCLUDENUL);
fail_point_get(fp, &sb);
sbuf_trim(&sb);
error = sbuf_finish(&sb);
if (error == 0)
error = SYSCTL_OUT(req, sbuf_data(&sb), sbuf_len(&sb));
sbuf_delete(&sb);
/* Setting */