Search Linux Wireless

Re: [PATCH 1/2] mac80211-hwsim: Factor out netlink attribute appending

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

 



On Fri, 2014-11-07 at 10:21 +0200, Patrik Flykt wrote:

> -error:
> -	nlmsg_free(skb);
> -	return NULL;
> +	return 0;
>  }
>  
> -static void hswim_mcast_new_radio(int id, struct genl_info *info,
> +static void hwsim_mcast_new_radio(int id, struct genl_info *info,
>  				  struct hwsim_new_radio_params *param)
>  {
>  	struct sk_buff *mcast_skb;
> +	void *data;
>  
> -	mcast_skb = build_radio_msg(HWSIM_CMD_NEW_RADIO, id, param);
> +	mcast_skb = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL);
>  	if (!mcast_skb)
>  		return;
>  
> +	data = genlmsg_put(mcast_skb, 0, 0, &hwsim_genl_family, 0,
> +			   HWSIM_CMD_NEW_RADIO);
> +	if (!data)
> +		goto out_err;
> +
> +	if (append_radio_msg(mcast_skb, id, param) < 0)
> +		goto out_err;
> +
> +	if (genlmsg_end(mcast_skb, data))
> +		goto out_err;
> +
>  	hwsim_mcast_config_msg(mcast_skb, info);
> +	return;
> +
> +out_err:
> +	genlmsg_cancel(mcast_skb, data);
>  }

You seem to have lost the nlmsg_free() in error cases.

johannes

--
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 Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux