From patchwork Mon Dec 13 14:43:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changli Gao X-Patchwork-Id: 75361 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 5F910B6F11 for ; Tue, 14 Dec 2010 01:44:33 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753969Ab0LMOo2 (ORCPT ); Mon, 13 Dec 2010 09:44:28 -0500 Received: from mail-gx0-f180.google.com ([209.85.161.180]:37550 "EHLO mail-gx0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753280Ab0LMOo1 (ORCPT ); Mon, 13 Dec 2010 09:44:27 -0500 Received: by gxk19 with SMTP id 19so3959223gxk.11 for ; Mon, 13 Dec 2010 06:44:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=+gHXZXvNRa+TxXLlrQ/3alBncCWCjSrTVNv1FdbeUTk=; b=vXfOqPqYISQFHGDtkQccbpmPjcTfyt/x5Hi7aeqK+h3y6B79fylUbFPtMhg6Z6Y5Ss /NRMs4soM9+a541JmZ/uDcaRwCGysItZo96kjJxxqGRNKgXJcZSTgvQgt2Il9tcd+qd/ sjopVhS6BVv0CchEuOjufHToCTsUcBf6jyRPM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=ivgjDBjDoiqskCN12rkEnItyeqEO8CN9y1UW7oO13v7/cmRlepD9F0Qzf6Qfvs8lF0 VpNqoELQA+DwnzoRx2WAGMCaHNzJMSMu1Cc81w6ViJanbSkUFpp+2bkjHgOiGHWPqp3q uigk6Og84li9BCkPsvvIgq4boa/bQrlvnb0eA= Received: by 10.150.185.2 with SMTP id i2mr6039226ybf.155.1292251467192; Mon, 13 Dec 2010 06:44:27 -0800 (PST) Received: from localhost.localdomain ([221.239.34.230]) by mx.google.com with ESMTPS id l4sm2520938ybj.21.2010.12.13.06.44.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 13 Dec 2010 06:44:26 -0800 (PST) From: Changli Gao To: Jamal Hadi Salim Cc: "David S. Miller" , netdev@vger.kernel.org, Changli Gao Subject: [PATCH 3/5] ifb: fix tx_queue_len overlimit Date: Mon, 13 Dec 2010 22:43:32 +0800 Message-Id: <1292251414-5154-3-git-send-email-xiaosuo@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1292251414-5154-1-git-send-email-xiaosuo@gmail.com> References: <1292251414-5154-1-git-send-email-xiaosuo@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We should check the length of rq after enqueuing, otherwise the length of rq will be over tx_queue_len. Signed-off-by: Changli Gao Signed-off-by: Jamal Hadi Salim --- drivers/net/ifb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index 1628d01..57c5cfb 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c @@ -131,15 +131,15 @@ static netdev_tx_t ifb_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } - if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) - netif_stop_queue(dev); - __skb_queue_tail(&dp->rq, skb); if (!dp->tasklet_pending) { dp->tasklet_pending = 1; tasklet_schedule(&dp->ifb_tasklet); } + if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) + netif_stop_queue(dev); + return NETDEV_TX_OK; }