On Thu, Jan 5, 2023 at 4:48 PM Martin KaFai Lau <martin.lau@xxxxxxxxx> wrote: > > 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. Yeah, true, will remove, thanks!