Search Linux Wireless

Re: NL80211_CMD_GET_WIPHY reply doesn't fit into nl message buffer

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

 



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.

johannes

Attachment: signature.asc
Description: This is a digitally signed message part


[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