From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark McLoughlin Subject: [PATCH 1/3] virtio_net: Fix leaked netdev->refcnt Date: Wed, 22 Oct 2008 16:20:28 +0100 Message-ID: <1224688830-26216-2-git-send-email-markmc@redhat.com> References: <> <1224688830-26216-1-git-send-email-markmc@redhat.com> Cc: kvm@vger.kernel.org, Mark McLoughlin To: Avi Kivity Return-path: Received: from mail09.svc.cra.dublin.eircom.net ([159.134.118.25]:38306 "HELO mail09.svc.cra.dublin.eircom.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751912AbYJVPWQ (ORCPT ); Wed, 22 Oct 2008 11:22:16 -0400 In-Reply-To: <1224688830-26216-1-git-send-email-markmc@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: If after receiving some packets and refilling the queue with buffers, we detect that more packets are available then we re-schedule the queue and process them. This re-scheduling - i.e. calling __netif_rx_schedule() - causes a netdev reference to be taken. Once we've finally run out of buffers to process, we return zero and net_rx_action() drops the reference taken by the original call to _netif_rx_schedule() in e.g. skb_recv_done(). The reference taken by re-scheduling is always leaked, leading to: waiting for eth0 to become free. Usage count = 132568 Fix by immediately dropping the extra reference taken. Signed-off-by: Mark McLoughlin --- hack-module.awk | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hack-module.awk b/hack-module.awk index 7cb9381..b401aae 100644 --- a/hack-module.awk +++ b/hack-module.awk @@ -63,6 +63,7 @@ print " if (!no_work && netif_rx_schedule_prep(vi->dev)) {"; print " vi->rvq->vq_ops->disable_cb(vi->rvq);"; print " __netif_rx_schedule(vi->dev);"; + print " dev_put(vi->dev);"; print " goto again;"; print " }"; print ""; -- 1.5.5.1