From: Andrew Morton <akpm@linux-foundation.org>
To: Chengguang Xu <cgxu519@mykernel.net>
Cc: hughd@google.com, linux-mm@kvack.org
Subject: Re: [PATCH] mm/shmem: fix freeing new_attr in shmem_initxattrs()
Date: Fri, 3 Jul 2020 12:20:43 -0700 [thread overview]
Message-ID: <20200703122043.c931cf9e0c85878ccc4e53f1@linux-foundation.org> (raw)
In-Reply-To: <20200703065636.20897-1-cgxu519@mykernel.net>
On Fri, 3 Jul 2020 14:56:36 +0800 Chengguang Xu <cgxu519@mykernel.net> wrote:
> new_attr is allocated with kvmalloc() so should be freed
> with kvfree().
>
> ...
>
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -3178,7 +3178,7 @@ static int shmem_initxattrs(struct inode *inode,
> new_xattr->name = kmalloc(XATTR_SECURITY_PREFIX_LEN + len,
> GFP_KERNEL);
> if (!new_xattr->name) {
> - kfree(new_xattr);
> + kvfree(new_xattr);
> return -ENOMEM;
> }
Indeed. Maybe simple_xattr_alloc() should have been called
simple_xattr_kvmalloc().
next prev parent reply other threads:[~2020-07-03 19:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-03 6:56 Chengguang Xu
2020-07-03 19:20 ` Andrew Morton [this message]
2020-07-03 20:15 ` Hugh Dickins
2020-07-04 1:59 ` cgxu
2020-07-04 2:20 ` Hugh Dickins
2020-07-04 2:44 ` cgxu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200703122043.c931cf9e0c85878ccc4e53f1@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=cgxu519@mykernel.net \
--cc=hughd@google.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox