Re: [PATCH net-next v2] net: Implement fault injection forcing skb reallocation

From: Breno Leitao
Date: Fri Oct 11 2024 - 09:22:03 EST


Hello Paolo,

On Thu, Oct 10, 2024 at 11:20:05AM +0200, Paolo Abeni wrote:
> On 10/8/24 13:13, Breno Leitao wrote:
> > +void skb_might_realloc(struct sk_buff *skb)
> > +{
> > + struct net_device *net = skb->dev;
> > +
> > + if (skb_realloc.filtered &&
> > + strncmp(net->name, skb_realloc.devname, IFNAMSIZ))
> > + /* device name filter set, but names do not match */
> > + return;
> > +
> > + if (!should_fail(&skb_realloc.attr, 1))
> > + return;
>
> if you wraps the above 2 statement in an helper() taking an skb argument,
> you could wrap it with the ALLOW_ERROR_INJECTION() macro, for added
> flexibility, i.e. look at the existing should_failslab().

I've looked deeper and your proposal, and I liked it. It makes sense to
have it as a helper.

I will send a new version with it included.

Thanks
--breno