Subject: Re: [PATCHv2 net 1/4] bonding: fix send_peer_notif overflow

From: Hangbin Liu <[email-masked]>
Date: Tue, 2 May 2023 20:45:02 +0800

On Fri, Apr 28, 2023 at 10:04:22PM +0200, Simon Horman wrote:
> On Thu, Apr 27, 2023 at 11:39:06AM +0800, Hangbin Liu wrote:
> 
> ...
> 
> > diff --git a/drivers/net/bonding/bond_netlink.c b/drivers/net/bonding/bond_netlink.c
> > index c2d080fc4fc4..09a501cdea0c 100644
> > --- a/drivers/net/bonding/bond_netlink.c
> > +++ b/drivers/net/bonding/bond_netlink.c
> > @@ -244,6 +244,12 @@ static int bond_changelink(struct net_device *bond_dev, struct nlattr *tb[],
> >  	if (data[IFLA_BOND_PEER_NOTIF_DELAY]) {
> >  		int delay = nla_get_u32(data[IFLA_BOND_PEER_NOTIF_DELAY]);
> >  
> > +		if (delay > 300000) {
> > +			NL_SET_ERR_MSG_ATTR(extack, data[IFLA_BOND_PEER_NOTIF_DELAY],
> > +					    "peer_notif_delay should be less than 300s");
> > +			return -EINVAL;
> > +		}
> 
> Hi Hangbin,
> 
> can this limit be implemented using NLA_POLICY_MAX() in bond_policy ?

Thanks for the comment, I will update the patch after backing from holiday
next week.

Hangbin