On Wed, Nov 16, 2022 at 12:43 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote: > > On Mon, 14 Nov 2022 19:02:02 -0800 Stanislav Fomichev wrote: > > diff --git a/net/core/dev.c b/net/core/dev.c > > index 117e830cabb0..a2227f4f4a0b 100644 > > --- a/net/core/dev.c > > +++ b/net/core/dev.c > > @@ -9258,6 +9258,13 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack > > return -EOPNOTSUPP; > > } > > > > + if (new_prog && > > + new_prog->aux->xdp_kfunc_ndo && > > + new_prog->aux->xdp_kfunc_ndo != dev->netdev_ops) { > > + NL_SET_ERR_MSG(extack, "Cannot attach to a different target device"); > > + return -EINVAL; > > + } > > This chunk can go up into the large > > if (new_prog) { > ... > > list of checks? Agreed, will move! > nit: aux->xdp_kfunc_ndo sounds like you're storing the kfunc NDO, > not all ndos. Throw in an 's' at the end, or some such? SG. But I'll most likely replace this xdp_kfunc_ndo with something like xdp_netdev and to add proper refcounting.