Project

General

Profile

Actions

Bug #6120

closed

libzfs leaks a config nvlist for spares and l2arc

Added by Josef Sipek almost 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
2015-08-12
Due date:
% Done:

80%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

The add_config function in libzfs fails to free the passed in config nvlist in a couple of cases. If the following condition is true, the config will be leaked:

        if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE,
            &state) == 0 &&
            (state == POOL_STATE_SPARE || state == POOL_STATE_L2CACHE) &&
            nvlist_lookup_uint64(config, ZPOOL_CONFIG_GUID, &vdev_guid) == 0) {

All other paths though this function free the config - regardless of whether the function succeeded. Since the caller and the rest of this function assumes that add_config frees the passed in config, it makes sense to fix the 3 cases places in this if statement that leak it.


Related issues

Is duplicate of illumos gate - Bug #7730: libzfs`add_config() leaks config nvl when reading spare/l2cache devicesClosedYuri Pankov2017-01-05

Actions
Actions

Also available in: Atom PDF