On the one hand this is correct patch and fixes the problem. OTOH I
would like to
restrain from monitor devices (and later Freescale SMAC) providing full MLME
access (it's not logical for monitor devices and completely bogus and strange
for SMAC). So for now I'd like to NAK this patch. I'll think about this for some
days. If I can't come with better solution, I'll apply this patch temporary.

My current ideas are:

1) to select some kind of 'common MLME routines', make ml_priv point
    to that struct and make ieee802154_mlme_ops extend that common_mlme

2) Make PHY argument of DEL_IFACE required (maybe for non-wpan devices).

3) As in wifi stack, pass some more info about netdev to core layers (e.g.
   wifi core layers bear info about netdev -> phy relationship).

What do you think?

On Wed, Jul 28, 2010 at 10:25 PM, Jon Smirl <[email protected]> wrote:
> Fix a segfault when deleting the monitor interface
>
> Signed-off-by: Jon Smirl <[email protected]>
> ---
>  net/mac802154/main.c    |    2 +-
>  net/mac802154/mib.c     |    2 +-
>  net/mac802154/monitor.c |    1 +
>  3 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/mac802154/main.c b/net/mac802154/main.c
> index 7d97756..f5b3cb3 100644
> --- a/net/mac802154/main.c
> +++ b/net/mac802154/main.c
> @@ -99,7 +99,7 @@ static void ieee802154_del_iface(struct wpan_phy *phy,
>        struct ieee802154_sub_if_data *sdata;
>        ASSERT_RTNL();
>
> -       BUG_ON(dev->type != ARPHRD_IEEE802154);
> +       BUG_ON((dev->type != ARPHRD_IEEE802154) && (dev->type != 
> ARPHRD_IEEE802154_MONITOR));
>
>        sdata = netdev_priv(dev);
>
> diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
> index 73bf62f..6fd17fd 100644
> --- a/net/mac802154/mib.c
> +++ b/net/mac802154/mib.c
> @@ -250,7 +250,7 @@ struct ieee802154_priv *ieee802154_slave_get_priv(struct 
> net_device *dev)
>  struct wpan_phy *ieee802154_get_phy(const struct net_device *dev)
>  {
>        struct ieee802154_sub_if_data *priv = netdev_priv(dev);
> -       BUG_ON(dev->type != ARPHRD_IEEE802154);
> +       BUG_ON((dev->type != ARPHRD_IEEE802154) && (dev->type != 
> ARPHRD_IEEE802154_MONITOR));
>
>        return to_phy(get_device(&priv->hw->phy->dev));
>  }
> diff --git a/net/mac802154/monitor.c b/net/mac802154/monitor.c
> index 68101d2..98710da 100644
> --- a/net/mac802154/monitor.c
> +++ b/net/mac802154/monitor.c
> @@ -99,6 +99,7 @@ void ieee802154_monitor_setup(struct net_device *dev)
>
>        dev->destructor         = free_netdev;
>        dev->netdev_ops         = &ieee802154_monitor_ops;
> +       dev->ml_priv            = &mac802154_mlme;
>
>        priv = netdev_priv(dev);
>        priv->type = IEEE802154_DEV_MONITOR;
>
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> Linux-zigbee-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel
>



-- 
With best wishes
Dmitry

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Linux-zigbee-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to