From patchwork Wed Dec 10 13:15:28 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 13163 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.176.167]) by ozlabs.org (Postfix) with ESMTP id 64CF9474C4 for ; Thu, 11 Dec 2008 00:16:26 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755344AbYLJNPu (ORCPT ); Wed, 10 Dec 2008 08:15:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752914AbYLJNPt (ORCPT ); Wed, 10 Dec 2008 08:15:49 -0500 Received: from smtp.nokia.com ([192.100.122.233]:23834 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755302AbYLJNPs (ORCPT ); Wed, 10 Dec 2008 08:15:48 -0500 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx06.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id mBADFXMI014020 for ; Wed, 10 Dec 2008 15:15:45 +0200 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 10 Dec 2008 15:15:31 +0200 Received: from mgw-int01.ntc.nokia.com ([172.21.143.96]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 10 Dec 2008 15:15:30 +0200 Received: from localhost.localdomain (esdhcp041160.research.nokia.com [172.21.41.160]) by mgw-int01.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id mBADFTX9010974 for ; Wed, 10 Dec 2008 15:15:29 +0200 From: =?utf-8?q?R=C3=A9mi=20Denis-Courmont?= To: netdev@vger.kernel.org Subject: [PATCH net] Phonet: ensure GPRS device does not go away during TX work Date: Wed, 10 Dec 2008 15:15:28 +0200 Message-Id: <1228914929-26337-1-git-send-email-remi.denis-courmont@nokia.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <200812101514.56827.remi.denis-courmont@nokia.com> References: <200812101514.56827.remi.denis-courmont@nokia.com> MIME-Version: 1.0 X-OriginalArrivalTime: 10 Dec 2008 13:15:30.0927 (UTC) FILETIME=[606A37F0:01C95AC9] X-Nokia-AV: Clean Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We need to hold the device while TX work is pending, as work is flushed only after the network device is unregistered. Signed-off-by: RĂ©mi Denis-Courmont --- net/phonet/pep-gprs.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c index e6e8e44..5985bc5 100644 --- a/net/phonet/pep-gprs.c +++ b/net/phonet/pep-gprs.c @@ -184,6 +184,7 @@ static int gprs_xmit(struct sk_buff *skb, struct net_device *net) spin_lock(&dev->tx_lock); if (likely(skb_queue_len(&dev->tx_queue) < dev->tx_max)) { skb_queue_tail(&dev->tx_queue, skb); + dev_hold(net); skb = NULL; } if (skb_queue_len(&dev->tx_queue) >= dev->tx_max) @@ -221,6 +222,7 @@ static void gprs_tx(struct work_struct *work) net->stats.tx_errors++; } release_sock(sk); + dev_put(net); } lock_sock(sk);