Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Commit

Permalink
8375 Kernel memory leak in nvpair code
Browse files Browse the repository at this point in the history
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prashanth Sreenivasa <pks@delphix.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>

In nvs_embedded(), when we return EINVAL due to reaching
the recursion limit, we should free the nvpriv_t that was
allocated earlier in the function.

Closes #398
  • Loading branch information
ahrens authored and Prakash Surya committed Jun 13, 2017
1 parent ec04e59 commit 31b2d89
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions usr/src/common/nvpair/nvpair.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016 by Delphix. All rights reserved.
* Copyright (c) 2015, 2017 by Delphix. All rights reserved.
*/

#include <sys/stropts.h>
Expand Down Expand Up @@ -2195,8 +2195,10 @@ nvs_embedded(nvstream_t *nvs, nvlist_t *embedded)

nvlist_init(embedded, embedded->nvl_nvflag, priv);

if (nvs->nvs_recursion >= nvpair_max_recursion)
if (nvs->nvs_recursion >= nvpair_max_recursion) {
nvlist_free(embedded);
return (EINVAL);
}
nvs->nvs_recursion++;
if ((err = nvs_operation(nvs, embedded, NULL)) != 0)
nvlist_free(embedded);
Expand Down

0 comments on commit 31b2d89

Please sign in to comment.