Crash at boot on 2.6.29-rc5

Kiran Divekar dkiran at marvell.com
Wed Feb 18 08:13:08 EST 2009


> Oh neat; so alloc_netdev() just allocates a block of sizeof(netdev) +
> sizeof(priv) and so of course you're subject to alignment issues on the
> structure side, and netdev_priv() returns a pointer just past the end of
> the netdev struct.  Whee!  That sounds robust on all architectures...
>
> In any case, the mesh device is "special" in that it still uses the
> original netdev's private structure.  Thus, netdev_priv(), which points
> past the end of the mesh's 'struct netdev' will just return junk; I
> think we used to simply replace dev->priv with the non-mesh device's
> priv and thus that used to work.
>
> So I think we now need an "lbs_priv()" function to use everywhere we use
> netdev_priv() or dev->ml_priv.  Given that the main netdev doesn't use
> dev->ml_priv, we can use that as a check and do something like:
>
> static inline struct lbs_private *lbs_priv(struct net_device *dev)
> {
>         return dev->ml_priv ? dev->ml_priv : netdev_priv(dev);
> }
>
> and thus get the right private structure every time no matter what the
> device.  Seem sane?
>

Sounds fine. Will post a patch soon.

> Dan
>
> > >



More information about the libertas-dev mailing list