Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167990704
D17202.id48119.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D17202.id48119.diff
View Options
Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
@@ -415,9 +415,10 @@
* least one valid label was found.
*/
static int
-vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config)
+vdev_geom_read_config(struct g_consumer *cp, nvlist_t **configp)
{
struct g_provider *pp;
+ nvlist_t *config;
vdev_phys_t *vdev_lists[VDEV_LABELS];
char *buf;
size_t buflen;
@@ -442,7 +443,6 @@
buflen = sizeof(vdev_lists[0]->vp_nvlist);
- *config = NULL;
/* Create all of the IO requests */
for (l = 0; l < VDEV_LABELS; l++) {
cmds[l] = BIO_READ;
@@ -458,6 +458,7 @@
VDEV_LABELS);
/* Parse the labels */
+ config = *configp = NULL;
nlabels = 0;
for (l = 0; l < VDEV_LABELS; l++) {
if (errors[l] != 0)
@@ -465,25 +466,27 @@
buf = vdev_lists[l]->vp_nvlist;
- if (nvlist_unpack(buf, buflen, config, 0) != 0)
+ if (nvlist_unpack(buf, buflen, &config, 0) != 0)
continue;
- if (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_STATE,
+ if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE,
&state) != 0 || state > POOL_STATE_L2CACHE) {
- nvlist_free(*config);
- *config = NULL;
+ nvlist_free(config);
continue;
}
if (state != POOL_STATE_SPARE &&
state != POOL_STATE_L2CACHE &&
- (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_TXG,
+ (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG,
&txg) != 0 || txg == 0)) {
- nvlist_free(*config);
- *config = NULL;
+ nvlist_free(config);
continue;
}
+ if (*configp != NULL)
+ nvlist_free(*configp);
+ *configp = config;
+
nlabels++;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 26, 7:20 PM (11 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37322094
Default Alt Text
D17202.id48119.diff (1 KB)
Attached To
Mode
D17202: Fix the nvpair leak in vdev_geom_read_config().
Attached
Detach File
Event Timeline
Log In to Comment