From patchwork Tue Dec 22 19:02:28 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wright X-Patchwork-Id: 69315 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBMJ30WH018184 for ; Tue, 22 Dec 2009 19:03:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754645AbZLVTC6 (ORCPT ); Tue, 22 Dec 2009 14:02:58 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754642AbZLVTC6 (ORCPT ); Tue, 22 Dec 2009 14:02:58 -0500 Received: from sous-sol.org ([216.99.217.87]:41695 "EHLO sequoia.sous-sol.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754580AbZLVTC5 (ORCPT ); Tue, 22 Dec 2009 14:02:57 -0500 Received: from sequoia.sous-sol.org (sequoia.sous-sol.org [127.0.0.1]) by sequoia.sous-sol.org (8.14.3/8.14.3) with ESMTP id nBMJ2SaZ005058; Tue, 22 Dec 2009 11:02:28 -0800 Received: (from chrisw@localhost) by sequoia.sous-sol.org (8.14.3/8.14.3/Submit) id nBMJ2SYT005057; Tue, 22 Dec 2009 11:02:28 -0800 Date: Tue, 22 Dec 2009 11:02:28 -0800 From: Chris Wright To: "Michael S. Tsirkin" Cc: rusty@rustcorp.com.au, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH] vhost-net: defer f->private_data until setup succeeds Message-ID: <20091222190228.GB2095@sequoia.sous-sol.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: clamav-milter 0.95.2 at sequoia.sous-sol.org X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on sequoia.sous-sol.org Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 22d5fef..0697ab2 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -326,7 +326,6 @@ static int vhost_net_open(struct inode *inode, struct file *f) int r; if (!n) return -ENOMEM; - f->private_data = n; n->vqs[VHOST_NET_VQ_TX].handle_kick = handle_tx_kick; n->vqs[VHOST_NET_VQ_RX].handle_kick = handle_rx_kick; r = vhost_dev_init(&n->dev, n->vqs, VHOST_NET_VQ_MAX); @@ -338,6 +337,9 @@ static int vhost_net_open(struct inode *inode, struct file *f) vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT); vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN); n->tx_poll_state = VHOST_NET_POLL_DISABLED; + + f->private_data = n; + return 0; }