Subject: Re: [PATCH net v4] bonding: Fix out-of-bounds read in bond_option_arp_ip_targets_set()

From: Simon Horman <[email-masked]>
Date: Fri, 19 Apr 2024 14:48:11 +0100

On Fri, Apr 19, 2024 at 08:54:21PM +0800, Hangbin Liu wrote:
> On Fri, Apr 19, 2024 at 12:08:25PM +0100, 'Simon Horman' wrote:

...

> > diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
> > index 0cacd7027e35..64a06e3399ee 100644
> > --- a/drivers/net/bonding/bond_options.c
> > +++ b/drivers/net/bonding/bond_options.c
> > @@ -1214,9 +1214,9 @@ static int bond_option_arp_ip_targets_set(struct bonding *bond,
> >  	__be32 target;
> >  
> >  	if (newval->string) {
> > -		if (!in4_pton(newval->string+1, -1, (u8 *)&target, -1, NULL)) {
> > -			netdev_err(bond->dev, "invalid ARP target %pI4 specified\n",
> > -				   &target);
> > +		if (!(strlen(newval->string)) ||
> > +		    !in4_pton(newval->string + 1, -1, (u8 *)&target, -1, NULL)) {
> > +			netdev_err(bond->dev, "invalid ARP target I4 specified\n");
> 
> Hi Simon, the error message should be "invalid ARP target specified\n"

Thanks,

I'll send an update after waiting a suitable time for review.

--- 
pw-bot: changes-requested