On 09/29/2008 01:55 PM, Johannes Berg wrote: > On Mon, 2008-09-29 at 13:52 +0200, Jiri Slaby wrote: > >> --- a/net/wireless/nl80211.c >> +++ b/net/wireless/nl80211.c >> @@ -246,16 +246,26 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct >> genl_info *info) >> { >> struct sk_buff *msg; >> struct cfg80211_registered_device *dev; >> + size_t bufsize = NLMSG_GOODSIZE; >> + unsigned int tries = 0; >> + int ret; >> >> dev = cfg80211_get_dev_from_info(info); >> if (IS_ERR(dev)) >> return PTR_ERR(dev); >> >> - msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); >> +retry: >> + msg = nlmsg_new(bufsize, GFP_KERNEL); >> if (!msg) >> goto out_err; >> >> - if (nl80211_send_wiphy(msg, info->snd_pid, info->snd_seq, 0, dev) < 0) >> + ret = nl80211_send_wiphy(msg, info->snd_pid, info->snd_seq, 0, dev); >> + if (ret == -EMSGSIZE && ++tries < 2) { >> + bufsize *= 2; >> + nlmsg_free(msg); >> + goto retry; >> + } >> + if (ret < 0) >> goto out_free; >> >> cfg80211_put_dev(dev); >> > > Works for me. Not the greatest way to do this I guess, but hey, it > works. Anyway it is wrong. NLMSG_GOODSIZE * x for x > 1 doesn't give skb aligned to a page boundary. bufsize should start with PAGE_SIZE or 8192 and be multiplied then and the parameter used for nlmsg_new SKB_WITH_OVERHEAD(bufsize). But it's ugly as hell, I agree -- and quite a temporary solution until somebody decides to add channels, another channel info or whatever. -- 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