Re: [PATCH v1 net-next] ila: avoid genlmsg_reply when not ila_map found

From: Lin Ma
Date: Wed May 22 2024 - 21:47:06 EST


Hi Simon.

>
> Hi Lin Ma,
>
> The lines immediately above those covered by this patch are as follows:
>
> ret = -ESRCH;
> ila = ila_lookup_by_params(&xp, ilan);
> if (ila) {
> ret = ila_dump_info(ila,
>
> > @@ -483,6 +483,8 @@ int ila_xlat_nl_cmd_get_mapping(struct sk_buff *skb, struct genl_info *info)
> > info->snd_portid,
> > info->snd_seq, 0, msg,
> > info->genlhdr->cmd);
> > + } else {
> > + ret = -EINVAL;
> > }
> >
> > rcu_read_unlock();
>
> And the lines following, up to the end of the function, are:
>
> if (ret < 0)
> goto out_free;
>
> return genlmsg_reply(msg, info);
>
> out_free:
> nlmsg_free(msg);
> return ret;
>
> By my reading, without your patch, if ila is not found (NULL)
> then ret will be -ESRCH, and genlmsg_reply will not be called.
>
> I feel that I am missing something here.

Oh my bad, it seems this bug was already fixed by the
commit 693aa2c0d9b6 ("ila: do not generate empty messages
in ila_xlat_nl_cmd_get_mapping()") last year.
And my dated kernel does not apply that one.

Thanks for reminding me of this false alarm.

Regards
Lin