Received: by 10.192.165.148 with SMTP id m20csp901727imm; Fri, 27 Apr 2018 09:17:16 -0700 (PDT) X-Google-Smtp-Source: AB8JxZohBJ49X3/sobtaAAMlslB9bqEdcn0PPxCcEfWhXwkbCebZ15ctfdjCJfbkFKqWPxfqdIPm X-Received: by 2002:a63:5f0d:: with SMTP id t13-v6mr2670669pgb.145.1524845836100; Fri, 27 Apr 2018 09:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524845836; cv=none; d=google.com; s=arc-20160816; b=aKZ9fJZZFzn5sftgKGOeTdRsr2b+RkCWY6eAdG1nRJZehnlu1SaoN9WY42lT1hJf0x Y9TEwtJQouGFzoR6NXepdnXtG7W1fOUapI3QJcUxMglGUtFEwucs0SZAxALzZtIxwE6+ jWfLha1Sh5ZUAOaggeQixZJSZ+1Da98YzSxRphBHl4ERDAI18UI+Dequ8LTHGgyQAlkl vKBJWeJO4zCSqK2xLQDWeISJ5X7+SHXp/0PdYXWqY3r/V2jexFPdW84IAuwbqwbgkm5V 7wstAvE9uERU0b59XuPYfc3T7kHkmn1zhZE7win+XfHMvX+mZ+w+eQBRIuwTQeUnaEVy SbSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Gwmh3AWXyQyDeI30jyPWQFnGhPFqqKOubwLebXpcg5A=; b=tkgpPNH7ffYj6AVh0xxzaXYI7DoAZz5/jO0RELLEjuFuS+XK7tfBvZhJYnagMPYwAh ZkAoWVfWuI8z/FPJDU5sVM6nZ2DOomVkzkp0vIj2d/dM091KQGlANs3JfYRscQQflN2T vieQf/coeqZqh17R5scTMJpbuYUbY/OXMC+YBVSXlNYhkuYcR1b9Dn3rarmG3oN7/SvA jMqNc3vQytuLv3Fo6Wgb1d4hYGHTY9yPrZXP6itRKrKzitnfgvBh4OQ/+0I3ErWlbcQU THQgTwliGK+TQPmOlEazjDuGC6ANO6In8Z5yqR9+o0CXRXrh5XijvOnRYLLOrNz2zdrS RCjA== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d65si1598709pfd.182.2018.04.27.09.17.01; Fri, 27 Apr 2018 09:17:16 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932738AbeD0QPc (ORCPT + 99 others); Fri, 27 Apr 2018 12:15:32 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36562 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758645AbeD0QPb (ORCPT ); Fri, 27 Apr 2018 12:15:31 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 78C1D40252F5; Fri, 27 Apr 2018 16:15:30 +0000 (UTC) Received: from redhat.com (ovpn-123-34.rdu2.redhat.com [10.10.123.34]) by smtp.corp.redhat.com (Postfix) with SMTP id 2CDB310B2B41; Fri, 27 Apr 2018 16:15:30 +0000 (UTC) Date: Fri, 27 Apr 2018 19:15:30 +0300 From: "Michael S. Tsirkin" To: Dmitry Vyukov Cc: Kevin Easton , Jason Wang , KVM list , virtualization@lists.linux-foundation.org, netdev , LKML , syzkaller-bugs Subject: Re: [PATCH net] vhost: Use kzalloc() to allocate vhost_msg_node Message-ID: <20180427191430-mutt-send-email-mst@kernel.org> References: <000000000000a5b2b1056a86e98c@google.com> <20180427154502.GA22544@la.guarana.org> <20180427185501-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 27 Apr 2018 16:15:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 27 Apr 2018 16:15:30 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 27, 2018 at 06:11:31PM +0200, Dmitry Vyukov wrote: > On Fri, Apr 27, 2018 at 6:05 PM, Michael S. Tsirkin wrote: > > On Fri, Apr 27, 2018 at 11:45:02AM -0400, Kevin Easton wrote: > >> The struct vhost_msg within struct vhost_msg_node is copied to userspace, > >> so it should be allocated with kzalloc() to ensure all structure padding > >> is zeroed. > >> > >> Signed-off-by: Kevin Easton > >> Reported-by: syzbot+87cfa083e727a224754b@syzkaller.appspotmail.com > > > > Does it help if a patch naming the padding is applied, > > and then we init just the relevant field? > > Just curious. > > Yes, it would help. I think it's slightly better that way then. node has a lot of internal stuff we don't care to init. Would you mind taking my patch and building on top of that then? > >> --- > >> drivers/vhost/vhost.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c > >> index f3bd8e9..1b84dcff 100644 > >> --- a/drivers/vhost/vhost.c > >> +++ b/drivers/vhost/vhost.c > >> @@ -2339,7 +2339,7 @@ EXPORT_SYMBOL_GPL(vhost_disable_notify); > >> /* Create a new message. */ > >> struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type) > >> { > >> - struct vhost_msg_node *node = kmalloc(sizeof *node, GFP_KERNEL); > >> + struct vhost_msg_node *node = kzalloc(sizeof *node, GFP_KERNEL); > >> if (!node) > >> return NULL; > >> node->vq = vq; > >> -- > >> 2.8.1 > > > > -- > > You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group. > > To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com. > > To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/20180427185501-mutt-send-email-mst%40kernel.org. > > For more options, visit https://groups.google.com/d/optout.