Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5093179img; Wed, 27 Mar 2019 01:49:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYkzuNoUvy7G9GJs9xbAApF797ypyam6XLYM6jvpuc4tQzefyqPQMIsP7fxsTxY3oy+7oB X-Received: by 2002:a17:902:a512:: with SMTP id s18mr27298465plq.185.1553676549947; Wed, 27 Mar 2019 01:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553676549; cv=none; d=google.com; s=arc-20160816; b=eshwWuSdvaoyiJCG+3ESTiCDiuafsE5+fCnUuBsefzLCPsU9T5z6OH/ePCsbPslkoy borBiw4VNmJMtPZ6uUDeJWDUChG2Ks+9kS703mZeEdOXPdAe4Svsayek0U3qXbZrCI3w YFrfigGuialu4xfPiGFaHFMyP4VdyACzJ1yysoX9DV06QhTpvxBy8JjsIVUKb2zoYEGn wNsfBVfFaq5Kr/DAaI3Cf40LdTSj5xJWZVIr6tO4RAEIWtphWTobNz6eBIesKj6QZuZU y2WGqaPOfyI7kkBaH6RS7gi6LsPqzrbasviX/FmAc+y7axMbyE9Clq6EVZEWEa1dWsfY mduw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=WT+2UYjHZg2dLj1B+tq6bfsf0qYYZr7TO1M+GctFXxw=; b=RZZJ2vMuylYPGscfNvX4JYSM9cclbhw417bCkaKfkBH7eo8rrxxAluGi4BMdRfwvo7 bO+QJxVHtPGspwhvbzIwkLNN4zTjeuKoQuxFoPfp3Bweod7PhFS1EIqzFUAKFctXBUTT 10JkjI+k6p6hu3vDgeDTx3ibpCaJRoNI4jeKm6UqT30/7NMsQvV7adn7dMPAvKo1uRjD 10xbE1eHqjLS2faE/BQJmWHHQNyg21aMilyE43NT44sfPuptLxu4CuiNgTNFVzFz/v38 mB/ZJT1TaG30RHGqAdtLOj6K7C6ABuWBmZ2WPZZ0zsyNA+l5oL6S91jb+3BrSakCDMZ0 LdLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 23si16219582pfi.106.2019.03.27.01.48.54; Wed, 27 Mar 2019 01:49:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732108AbfC0Irx (ORCPT + 99 others); Wed, 27 Mar 2019 04:47:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:47160 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726248AbfC0Irx (ORCPT ); Wed, 27 Mar 2019 04:47:53 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5EA3AAC6B; Wed, 27 Mar 2019 08:47:52 +0000 (UTC) Date: Wed, 27 Mar 2019 09:47:51 +0100 From: Michal Hocko To: Vitaly Mayatskikh Cc: Stefan Hajnoczi , linux-kernel@vger.kernel.org Subject: Re: [PATCH] vhost: zero vhost_vsock memory on allocation Message-ID: <20190327084751.GB11927@dhcp22.suse.cz> References: <1553648174-24913-1-git-send-email-v.mayatskih@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1553648174-24913-1-git-send-email-v.mayatskih@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Michal Hocko 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