Re: [PATCH 6/6] backports: genetlink: update completely

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

 



On Tue, 2018-10-02 at 19:51 +0200, Johannes Berg wrote:
> 
> +static int backport_pre_doit(__genl_const struct genl_ops *ops,
> +			     struct sk_buff *skb,
> +			     struct genl_info *info)
> +{
> +	const struct genl_family *family = find_family_real_ops(&ops);
> +	int err;
> +#if LINUX_VERSION_IS_LESS(4,12,0)
> +	struct netlink_ext_ack *extack = kzalloc(sizeof(*extack), GFP_KERNEL);
> +
> +	__bp_genl_info_userhdr_set(info, extack);
> +
> +	if (!extack) {
> +		__bp_genl_info_userhdr_set(info, ERR_PTR(-ENOMEM));
> +		return -ENOMEM;
> +	}
> +
> +	extack->__bp_doit = ops->doit;
> +#else
> +	struct netlink_ext_ack *extack = info->extack;
> +#endif
> +
> +	err = nlmsg_validate(info->nlhdr, GENL_HDRLEN + family->hdrsize,
> +			     family->maxattr, ops->policy, extack);
> +	if (err)
> +		return err;
> +
> +	err = family->pre_doit(ops, skb, info);
> +
> +#if LINUX_VERSION_IS_LESS(4,12,0)
> +	if (err) {
> +		__bp_genl_info_userhdr_set(info, ERR_PTR(err));
> +		kfree(extack);
> +	}
> +#endif

This is wrong, it doesn't free the extack on errors.

We could also immediately send the ACK out, I think, and include the
error there.

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux