From patchwork Mon Oct 24 17:55:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Cochran X-Patchwork-Id: 121388 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 9BF9C1007D6 for ; Tue, 25 Oct 2011 04:55:56 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755873Ab1JXRzv (ORCPT ); Mon, 24 Oct 2011 13:55:51 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:51247 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755853Ab1JXRzu (ORCPT ); Mon, 24 Oct 2011 13:55:50 -0400 Received: by mail-bw0-f46.google.com with SMTP id zt19so8488004bkb.19 for ; Mon, 24 Oct 2011 10:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :in-reply-to:references; bh=g9pSFyIJNzLO7goaHjPlfr63GR0OyVJnsOibczmwxCA=; b=mEXV1aLF1yQ38A9ElCiKNiucx3ZnD+kZrlQ1zTu48SlFkLvJnqkEvF8bqTWNipRk0y c8LQbAtYmnOb+fYT05aq3/V4znEAmh0oBM5LQ+rsF2XV2f52W1dm3GxbJ28cKj+jcWn9 ExPZDgt61tPE/4Wsnc99+3+IeUwiLUKTXDkow= Received: by 10.204.129.155 with SMTP id o27mr4842103bks.94.1319478949883; Mon, 24 Oct 2011 10:55:49 -0700 (PDT) Received: from localhost.localdomain (mk046207255176.a1.net. [46.207.255.176]) by mx.google.com with ESMTPS id e14sm24656406bka.0.2011.10.24.10.55.45 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Oct 2011 10:55:47 -0700 (PDT) From: Richard Cochran To: Cc: David Miller , Eric Dumazet , Johannes Berg , Subject: [PATCH v3 2/2] dp83640: free packet queues on remove Date: Mon, 24 Oct 2011 19:55:32 +0200 Message-Id: <702220595edddaf7f2e6f0994e762b1a5404f793.1319478544.git.richard.cochran@omicron.at> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If the PHY should disappear (for example, on an USB Ethernet MAC), then the driver would leak any undelivered time stamp packets. This commit fixes the issue by calling the appropriate functions to free any packets left in the transmit and receive queues. The driver first appeared in v3.0. Signed-off-by: Richard Cochran Acked-by: Eric Dumazet Cc: --- drivers/net/phy/dp83640.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 311f5cb..dc44b73 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c @@ -875,6 +875,7 @@ static void dp83640_remove(struct phy_device *phydev) struct dp83640_clock *clock; struct list_head *this, *next; struct dp83640_private *tmp, *dp83640 = phydev->priv; + struct sk_buff *skb; if (phydev->addr == BROADCAST_ADDR) return; @@ -882,6 +883,12 @@ static void dp83640_remove(struct phy_device *phydev) enable_status_frames(phydev, false); cancel_work_sync(&dp83640->ts_work); + while ((skb = skb_dequeue(&dp83640->rx_queue)) != NULL) + kfree_skb(skb); + + while ((skb = skb_dequeue(&dp83640->tx_queue)) != NULL) + skb_complete_tx_timestamp(skb, NULL); + clock = dp83640_clock_get(dp83640->clock); if (dp83640 == clock->chosen) {