From patchwork Thu Sep 20 10:01:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10607297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEDF9913 for ; Thu, 20 Sep 2018 10:02:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC77D2CEC8 for ; Thu, 20 Sep 2018 10:02:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B078B2D065; Thu, 20 Sep 2018 10:02:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 446882CEC8 for ; Thu, 20 Sep 2018 10:02:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731595AbeITPpA (ORCPT ); Thu, 20 Sep 2018 11:45:00 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:59092 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726788AbeITPpA (ORCPT ); Thu, 20 Sep 2018 11:45:00 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w8KA1wwM116264; Thu, 20 Sep 2018 10:02:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=8cLh3T8c73Ey7D1BxGuT4I7Fr7NzBmPrpa3Xsu/kj1o=; b=fbuUtDsBM3VL3TmAAltLJ273J4QY4Cb78OTAw17hpXrrqHHiyRXjeBj5aNgJbKirPft8 FbujHu4ZPMiqtJbOzbYYd0Av9OvD7tyE+iVT540JA11cJhO9Tq+dNyT+OZ6hTjhgVGPK ONGpsfClK15LVvWvuaRcvpwMWEripmOIPk0uFiWfY6TufX8IHvj7cygEZD5g54Om4te8 36k/6gd8lYuNR8V6BiLlH1xl9SO1Z6KeDYaUc/vO0a64h9IWfXx5DKzZqhrf5nP19/QC VhVXIS0lSHJxEIb/9iWdTbY5iOrb6lGKua0S4+gYxjq4eGekMGGoMSJaNU5NkvrS4smw OQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2120.oracle.com with ESMTP id 2mgt1q1pkp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Sep 2018 10:02:14 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w8KA2DJj001481 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 20 Sep 2018 10:02:13 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w8KA2Car031875; Thu, 20 Sep 2018 10:02:12 GMT Received: from mwanda (/197.232.248.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 20 Sep 2018 03:02:11 -0700 Date: Thu, 20 Sep 2018 13:01:59 +0300 From: Dan Carpenter To: "Michael S. Tsirkin" , Jason Wang Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH net-next] vhost_net: add a missing error return Message-ID: <20180920100158.GA9551@mwanda> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9021 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809200102 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We accidentally left out this error return so it leads to some use after free bugs later on. Fixes: 0a0be13b8fe2 ("vhost_net: batch submitting XDP buffers to underlayer sockets") Signed-off-by: Dan Carpenter Acked-by: Michael S. Tsirkin Acked-by: Jason Wang diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index dd4e0a301635..1bff6bc8161a 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1244,6 +1244,7 @@ static int vhost_net_open(struct inode *inode, struct file *f) kfree(vqs); kvfree(n); kfree(queue); + return -ENOMEM; } n->vqs[VHOST_NET_VQ_TX].xdp = xdp;