netdev
[Top] [All Lists]

[PATCH] ax25 use dev_hold/dev_put as required for net_devices.

To: Jeroen Vreeken <pe1rxq@xxxxxxxxx>
Subject: [PATCH] ax25 use dev_hold/dev_put as required for net_devices.
From: Stephen Hemminger <shemminger@xxxxxxxx>
Date: Tue, 12 Aug 2003 16:49:40 -0700
Cc: linux-hams@xxxxxxxxxxxxxxx, ralf@xxxxxxxxxxxxxx, davem@xxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20030813010301.K28977@xxxxxxxxxxxxxxxxxxxxxx>
Organization: Open Source Development Lab
References: <20030812194653.A28977@xxxxxxxxxxxxxxxxxxxxxx> <20030812135655.7334887b.shemminger@xxxxxxxx> <20030812230951.E28977@xxxxxxxxxxxxxxxxxxxxxx> <20030812153901.6e700dcb.shemminger@xxxxxxxx> <20030813010301.K28977@xxxxxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
Ax25 holds a reference to the net device below, in the ax25_dev structure;
therefore it needs to use dev_hold/dev_put.

This is against 2.6.0-test3 with your earlier patch

diff -Nru a/net/ax25/ax25_dev.c b/net/ax25/ax25_dev.c
--- a/net/ax25/ax25_dev.c       Tue Aug 12 16:45:51 2003
+++ b/net/ax25/ax25_dev.c       Tue Aug 12 16:45:51 2003
@@ -67,6 +67,7 @@
 
        dev->ax25_ptr     = ax25_dev;
        ax25_dev->dev     = dev;
+       dev_hold(dev);
        ax25_dev->forward = NULL;
 
        ax25_dev->values[AX25_VALUES_IPDEFMODE] = AX25_DEF_IPDEFMODE;
@@ -121,6 +122,7 @@
        if ((s = ax25_dev_list) == ax25_dev) {
                ax25_dev_list = s->next;
                spin_unlock_bh(&ax25_dev_lock);
+               dev_put(dev);
                kfree(ax25_dev);
                ax25_register_sysctl();
                return;
@@ -131,6 +133,7 @@
                        s->next = ax25_dev->next;
                        spin_unlock_bh(&ax25_dev_lock);
                        kfree(ax25_dev);
+                       dev_put(dev);
                        ax25_register_sysctl();
                        return;
                }


<Prev in Thread] Current Thread [Next in Thread>