On 1/4/23 1:59 PM, Stanislav Fomichev wrote:
+void *bpf_dev_bound_resolve_kfunc(struct bpf_prog *prog, u32 func_id) +{ + const struct xdp_metadata_ops *ops; + void *p = NULL; + + /* We don't hold bpf_devs_lock while resolving several + * kfuncs and can race with the unregister_netdevice(). + * We rely on bpf_dev_bound_match() check at attach + * to render this program unusable. + */ + down_read(&bpf_devs_lock); + if (!prog->aux->offload || !prog->aux->offload->netdev)
nit. !prog->aux->offload->netdev check is not needed. Testing !prog->aux->offload should be as good.