Search Linux Wireless

Re: Sending netlink messages in mac80211 tx handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2009-06-10 at 07:02 +0800, Reiner Herrmann wrote:
> Hi,
> 
> I want to register a TX handler for mac80211 and send a (generic)
> netlink message in it. But everytime the handler gets invoked and
> the message sent, the kernel crashes.
> 
> 
> A minimal version of the TX handler looks like that:
> 
> 
> static ieee80211_tx_result debug_noinline
> ieee80211_tx_h_test(struct ieee80211_tx_data *tx)
> {
>         struct sk_buff* skb = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);

I think you need GFP_ATOMIC here.

>         void* hdr;
> 
>         if(!skb)
>                 goto out;
> 
>         hdr = genlmsg_put(skb, 0, 0, &nl80211_fam, 0, NL80211_CMD_DISCOSEC);
>         if(IS_ERR(hdr))
>                 goto free_skb;
> 
>         nla_put_u32(skb, NL80211_ATTR_DISCOSEC_HELO, 42);
>         genlmsg_end(skb, hdr);
>         genlmsg_unicast(skb, get_daemon_pid());
> 
> free_skb:
>         nlmsg_free(skb);

No need to free on the correct path. The skb is added to the
receive_queue directly for Rx.

Thanks,
-yi

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux