On 2/15/23 12:30, Martin KaFai Lau wrote:
On 2/15/23 10:04 AM, Kui-Feng Lee wrote:
+ int err;
+
+ map = bpf_map_get(attr->link_create.prog_fd);
bpf_map_get can fail here?
We have already verified the `attach_type` of the link before calling
this function, so an error should not occur. If it does happen,
however, something truly unusual must be happening. To ensure maximum
protection and avoid this issue in the future, I will add a check
here as well.
bpf_map_get() could fail. A valid attach_type does not mean prog_fd
(actually map_fd here) is also valid.
You are right! I must mess up with the update one.
I will add a check.