> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c
> @@ -1156,6 +1156,18 @@
>               skb->ip_summed = CHECKSUM_COMPLETE;
>       }
>
> +     if (prog->type == BPF_PROG_TYPE_LWT_XMIT && !skb_dst(skb)) {
> +             if (!ipv6_bpf_stub) {
> +                     pr_warn_once("Please test this program with the IPv6 
> module enabled\n");
> +                     goto out;

Should this set ret to an error code before goto out?  At this point
ret is 0 from the earlier convert___skb_to_skb() success path, so the
function returns 0 to the bpf() syscall without ever running the BPF
program.

Every other early exit in bpf_prog_test_run_skb() assigns a negative
errno before goto out, for example:

    ret = -EINVAL;
    goto out;

    ret = -ENOMEM;
    goto out;

    ret = -ENODEV;
    goto out;

Returning 0 here means userspace sees a successful test run that never
actually executed.  Something like ret = -EOPNOTSUPP would let the
caller know the test could not proceed.

> +             }

> [ ... ]


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/22437468613

AI-authorship-score: low
AI-authorship-explanation: Patch iterated through 7 versions over 3 weeks with 
detailed maintainer interaction, consistent with human development.
issues-found: 1
issue-severity-score: low
issue-severity-explanation: Missing error return code on early exit path causes 
bpf() syscall to return success without executing the BPF program when IPv6 is 
unavailable.

Reply via email to