Re: [PATCH net] net: rtnetlink: prevent underflows in do_setvfinfo()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date: Wed, 20 Nov 2019 15:34:38 +0300

> The "ivm->vf" variable is a u32, but the problem is that a number of
> drivers cast it to an int and then forget to check for negatives.  An
> example of this is in the cxgb4 driver.
> 
> drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
>   2890  static int cxgb4_mgmt_get_vf_config(struct net_device *dev,
>   2891                                      int vf, struct ifla_vf_info *ivi)
>                                             ^^^^^^
>   2892  {
>   2893          struct port_info *pi = netdev_priv(dev);
>   2894          struct adapter *adap = pi->adapter;
>   2895          struct vf_info *vfinfo;
>   2896  
>   2897          if (vf >= adap->num_vfs)
>                     ^^^^^^^^^^^^^^^^^^^
>   2898                  return -EINVAL;
>   2899          vfinfo = &adap->vfinfo[vf];
>                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> There are 48 functions affected.
 ...
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

I'm going to apply this and queue it up for -stable.

The u32 conversion should happen in next.



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux