From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: jfs-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org, shankarapailoor@gmail.com
Subject: Re: [PATCH] jfs: Fix buffer overrun in ea_get
Date: Mon, 18 Jun 2018 08:10:23 -0500 [thread overview]
Message-ID: <245a3ccb-3390-d650-91f0-c8e6f002499f@oracle.com> (raw)
In-Reply-To: <1529311091-8307-1-git-send-email-nborisov@suse.com>
On 06/18/2018 03:38 AM, Nikolay Borisov wrote:
> Currently ea_buf->xattr buffer is allocated with min(min_size, ea_size).
> This is wrong since after the xattr buffer is allocated the ->max_size
> variable is actually rounded up to th next ->s_blocksize size. Fix this
> by using the rounded up max_size as input to the malloc.
>
> Suggested-by: Shankara Pailoor <shankarapailoor@gmail.com>
> Reported-by: Shankara Pailoor <shankarapailoor@gmail.com>
> CC: shankarapailoor@gmail.com
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
> Hello David,
>
> I'm sending you the patch for the issue which was originally reported and
> suggested by Shankar. I won't usually got and override the original
> author of a patch but given the clear lack of experience with upstream (missing
> SOB line, no changelog explaining the change etc) and the
> fact there is already a CVE for this issue (using syzkaller for quick CVE
> generation seems to be all the rage these days, go figure...) I'd rather have
> an upstream, backportable version sooner rather than later.
Thanks, but I already had Shankar's patch in the linux-next build. I was
out on vacation so I didn't get it pushed to Linus as soon as I would
have liked, but did so this morning.
I appreciate your effort.
Shaggy
>
> fs/jfs/xattr.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
> index c60f3d32ee91..96b9355ff69a 100644
> --- a/fs/jfs/xattr.c
> +++ b/fs/jfs/xattr.c
> @@ -493,14 +493,14 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)
> * To keep the rest of the code simple. Allocate a
> * contiguous buffer to work with
> */
> - ea_buf->xattr = kmalloc(size, GFP_KERNEL);
> - if (ea_buf->xattr == NULL)
> - return -ENOMEM;
> -
> ea_buf->flag = EA_MALLOC;
> ea_buf->max_size = (size + sb->s_blocksize - 1) &
> ~(sb->s_blocksize - 1);
>
> + ea_buf->xattr = kmalloc(ea_buf->max_size, GFP_KERNEL);
> + if (ea_buf->xattr == NULL)
> + return -ENOMEM;
> +
> if (ea_size == 0)
> return 0;
>
>
prev parent reply other threads:[~2018-06-18 13:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-18 8:38 Nikolay Borisov
2018-06-18 13:10 ` Dave Kleikamp [this message]
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=245a3ccb-3390-d650-91f0-c8e6f002499f@oracle.com \
--to=dave.kleikamp@oracle.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=nborisov@suse.com \
--cc=shankarapailoor@gmail.com \
/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
all inboxes | Powered by JetHome®