Project

General

Profile

Bug #9675

memory leak from cpupart_create

Added by Brad Lewis over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
2018-07-25
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

In usr/src/uts/common/disp/cpupart.c, cpupart_create() allocates a buffer and assigns it to the cp_lgrploads member of a cpupart_t struct:

pp->cp_nlgrploads = lgrp_plat_max_lgrps();
pp->cp_lgrploads = kmem_zalloc(sizeof (lpl_t) * pp->cp_nlgrploads,
KM_SLEEP);
The function then goes on to call cpupart_lpl_initialize(), which allocates an identical buffer and assigns it to the same field, leaking the original buffer:
sz = cp->cp_nlgrploads = lgrp_plat_max_lgrps();
cp->cp_lgrploads = kmem_zalloc(sizeof (lpl_t) * sz, KM_SLEEP);
We should be able to just remove the initial allocation.

History

#1

Updated by Electric Monk over 1 year ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

git commit 2ee857385108d299b716b075df1220fdc893b20b

commit  2ee857385108d299b716b075df1220fdc893b20b
Author: John Gallagher <john.gallagher@delphix.com>
Date:   2018-09-17T21:29:14.000Z

    9675 memory leak from cpupart_create
    Reviewed by: George Wilson <george.wilson@delphix.com>
    Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Igor Kozhukhov <igor@dilos.org>
    Approved by: Garrett D'Amore <garrett@damore.org>

Also available in: Atom PDF