From: Michal Hocko <mhocko@kernel.org>
To: Vitaly Mayatskikh <v.mayatskih@gmail.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vhost: zero vhost_vsock memory on allocation
Date: Wed, 27 Mar 2019 09:47:51 +0100 [thread overview]
Message-ID: <20190327084751.GB11927@dhcp22.suse.cz> (raw)
In-Reply-To: <1553648174-24913-1-git-send-email-v.mayatskih@gmail.com>
On Tue 26-03-19 20:56:14, Vitaly Mayatskikh wrote:
> This fixes OOPS when using under-initialized vhost_vsock object.
>
> The code had a combo of kzalloc plus vmalloc as a fallback
> initially, but it has been replaced by plain kvmalloc in
> commit 6c5ab6511f71 ("mm: support __GFP_REPEAT in kvmalloc_node for >32kB")
>
> OOPS is easy to reproduce with open/ioctl after trashing the RAM.
Sorry for the screw up, that was certainly not inteded effect of the
patch.
Fixes: 6c5ab6511f71 ("mm: support __GFP_REPEAT in kvmalloc_node for >32kB")
Cc: stable # 4.12+
> Signed-off-by: Vitaly Mayatskikh <v.mayatskih@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Thanks for catching that.
> ---
> drivers/vhost/vsock.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
> index bb5fc0e..9e7cb13 100644
> --- a/drivers/vhost/vsock.c
> +++ b/drivers/vhost/vsock.c
> @@ -512,7 +512,7 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file)
> /* This struct is large and allocation could fail, fall back to vmalloc
> * if there is no other way.
> */
> - vsock = kvmalloc(sizeof(*vsock), GFP_KERNEL | __GFP_RETRY_MAYFAIL);
> + vsock = kvzalloc(sizeof(*vsock), GFP_KERNEL | __GFP_RETRY_MAYFAIL);
> if (!vsock)
> return -ENOMEM;
>
> --
> 1.8.3.1
>
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2019-03-27 8:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-27 0:56 Vitaly Mayatskikh
2019-03-27 8:47 ` Michal Hocko [this message]
2019-03-27 16:49 ` Stefan Hajnoczi
2019-03-27 17:08 ` Vitaly Mayatskih
2019-03-28 16:36 ` Stefan Hajnoczi
2019-03-28 17:08 ` Vitaly Mayatskih
2019-03-28 17:10 ` [PATCH] vhost/vsock: initialize vhost_vsock->hash Vitaly Mayatskikh
2019-04-05 10:24 ` Stefan Hajnoczi
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=20190327084751.GB11927@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stefanha@redhat.com \
--cc=v.mayatskih@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®