[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160121123547.GC2510@codeblueprint.co.uk>
Date: Thu, 21 Jan 2016 12:35:47 +0000
From: Matt Fleming <matt@...sole-pimps.org>
To: Bryan O'Donoghue <pure.logic@...us-software.ie>
Cc: "Kweh, Hock Leong" <hock.leong.kweh@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ong Boon Leong <boon.leong.ong@...el.com>,
LKML <linux-kernel@...r.kernel.org>, linux-efi@...r.kernel.org,
Sam Protsenko <semen.protsenko@...aro.org>,
Peter Jones <pjones@...hat.com>,
Andy Lutomirski <luto@...capital.net>,
Roy Franz <roy.franz@...aro.org>,
Borislav Petkov <bp@...en8.de>,
James Bottomley <James.Bottomley@...senpartnership.com>,
Linux FS Devel <linux-fsdevel@...r.kernel.org>,
Anvin H Peter <h.peter.anvin@...el.com>
Subject: Re: [PATCH v10 1/1] efi: a misc char interface for user to update
efi firmware
On Mon, 21 Dec, at 05:04:11PM, Bryan O'Donoghue wrote:
> > +static int efi_capsule_open(struct inode *inode, struct file *file)
> > +{
> > + struct capsule_info *cap_info;
> > +
> > + cap_info = kzalloc(sizeof(*cap_info), GFP_KERNEL);
> > + if (!cap_info)
> > + return -ENOMEM;
> > +
> > + file->private_data = cap_info;
> > +
> > + return 0;
> > +}
>
> You have a memory leak here don't you ?
>
> if I do
> for (i = 0; i < N; i++) {
> fd = open(/dev/your_node);
> close(fd);
> }
>
> You'll leak that kzalloc...
Nope, it gets freed in efi_capsule_release(). Though the code does
leak cap_info->pages if a capsule is successfully submitted to the
firmware.
Powered by blists - more mailing lists