linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: Reiner Herrmann <r_herrma@informatik.uni-kl.de>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"kernelnewbies@nl.linux.org" <kernelnewbies@nl.linux.org>,
	"m_wilhel@informatik.uni-kl.de" <m_wilhel@informatik.uni-kl.de>
Subject: Re: Sending netlink messages in mac80211 tx handler
Date: Wed, 10 Jun 2009 09:13:52 +0800	[thread overview]
Message-ID: <1244596432.5034.27.camel@debian> (raw)
In-Reply-To: <4A2EEA07.1050306@informatik.uni-kl.de>

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


  reply	other threads:[~2009-06-10  1:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 23:02 Sending netlink messages in mac80211 tx handler Reiner Herrmann
2009-06-10  1:13 ` Zhu Yi [this message]
2009-06-10 22:49   ` Reiner Herrmann
2009-06-11 10:30     ` Johannes Berg
2009-06-11 10:55       ` Reiner Herrmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244596432.5034.27.camel@debian \
    --to=yi.zhu@intel.com \
    --cc=kernelnewbies@nl.linux.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=m_wilhel@informatik.uni-kl.de \
    --cc=r_herrma@informatik.uni-kl.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).