]> granicus.if.org Git - zfs/commitdiff
OpenZFS 8375 - Kernel memory leak in nvpair code
authorMatthew Ahrens <mahrens@delphix.com>
Mon, 3 Apr 2017 16:47:11 +0000 (09:47 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 30 Aug 2017 18:50:12 +0000 (11:50 -0700)
Authored by: Matthew Ahrens <mahrens@delphix.com>
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>
Approved by: Dan McDonald <danmcd@joyent.com>
Reviewed-by: Don Brady <dev.fs.zfs@gmail.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Ported-by: Giuseppe Di Natale <dinatale2@llnl.gov>
OpenZFS-issue: https://www.illumos.org/issues/8375
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/843c211
Closes #6578

module/nvpair/nvpair.c

index 2e3820981abb72e93ba777b0c812eef2a791068c..8e654053cba7b9a3603dbea62d354d1704b25816 100644 (file)
@@ -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>
@@ -2200,8 +2200,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);