Skip to content

Commit

Permalink
OS-5892 drv_ioc_prop_common could leak memory and holds
Browse files Browse the repository at this point in the history
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
  • Loading branch information
rzezeski committed Feb 16, 2017
1 parent 0a0eca7 commit 32a07cd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions usr/src/uts/common/io/dld/dld_drv.c
Expand Up @@ -708,8 +708,18 @@ drv_ioc_prop_common(dld_ioc_macprop_t *prop, intptr_t arg, boolean_t set,
else
err = drv_ioc_clrap(linkid);
} else {
if (kprop->pr_valsize == 0)
return (ENOBUFS);
/*
* You might think that the earlier call to
* mac_prop_check_size() should catch this but
* it can't. The autopush prop uses 0 as a
* sentinel value to clear the prop. This
* check ensures we don't allow a get with a
* valsize of 0.
*/
if (kprop->pr_valsize == 0) {
err = ENOBUFS;
goto done;
}

kprop->pr_perm_flags = MAC_PROP_PERM_RW;
err = drv_ioc_getap(linkid, dlap);
Expand Down

0 comments on commit 32a07cd

Please sign in to comment.