netdev
[Top] [All Lists]

Patch: linux-2.5.45/net/core/dev.c netdev_finish_unregister could read f

To: davem@xxxxxxxxxx, netdev@xxxxxxxxxxx, linux-net@xxxxxxxxxxxxxxx
Subject: Patch: linux-2.5.45/net/core/dev.c netdev_finish_unregister could read freed memory
From: "Adam J. Richter" <adam@xxxxxxxxxxxxx>
Date: Sun, 3 Nov 2002 00:24:10 -0800
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.2i
        I just changed a network driver to use net_device.destructor
because it now embeds a struct net_device in a larger private data
structure (to reduce rarely tested memory allocation error branches).
Looking at netdev_finish_unregister, I see that after dev->destructor()
has been called, netdev_finish_unregister still atttempts to read
dev->features to check for NETIF_F_DYNALLOC.

        The following patch causes the NETIF_F_DYNALLOC test not to
be done if dev->destructor is provided.

        Alternatively, I'd be willing to make a patch to eliminate
NETIF_F_DYNALLOC (replacing it with "dev->destructor = (cast...) kfree;"),
as I think reference counting is done regardless of the value of
that flag.  I don't know why it is checked in net/core/dst.c though.

        Also, please do not eliminate netdev.destructor.  I have a
legitimate use for it that I can explain more if necessary.  Thanks.

-- 
Adam J. Richter     __     ______________   575 Oroville Road
adam@xxxxxxxxxxxxx     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America
                         "Free Software For The Rest Of Us."

Attachment: dynalloc.diff
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>
  • Patch: linux-2.5.45/net/core/dev.c netdev_finish_unregister could read freed memory, Adam J. Richter <=