From: Johannes Berg <johannes@sipsolutions.net>
To: backports@vger.kernel.org
Subject: Re: [PATCH 6/6] backports: genetlink: update completely
Date: Tue, 02 Oct 2018 20:38:50 +0200 [thread overview]
Message-ID: <1538505530.3126.49.camel@sipsolutions.net> (raw)
In-Reply-To: <20181002175107.16336-6-johannes@sipsolutions.net> (sfid-20181002_195130_622184_25ABC8B0)
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
prev parent reply other threads:[~2018-10-02 18:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-02 17:51 [PATCH 1/6] backports: rename magic functions for netlink parsing Johannes Berg
2018-10-02 17:51 ` [PATCH 2/6] backports: fix genlmsg_nlhdr() backport Johannes Berg
2018-10-02 17:51 ` [PATCH 3/6] backports: add copy-list.hwsim Johannes Berg
2018-10-02 17:51 ` [PATCH 4/6] backports: backport most of improved netlink policy validation Johannes Berg
2018-10-02 17:51 ` [PATCH 5/6] backports: add __skb_peek() Johannes Berg
2018-10-02 17:51 ` [PATCH 6/6] backports: genetlink: update completely Johannes Berg
2018-10-02 18:38 ` Johannes Berg [this message]
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=1538505530.3126.49.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=backports@vger.kernel.org \
/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).