Re: [PATCH 2/4] vdpa/mlx5: Fix is_index_valid() to refer to features

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

 



On Tue, Jan 11, 2022 at 06:03:57PM +0200, Eli Cohen wrote:
> On Tue, Jan 11, 2022 at 10:57:57AM -0500, Michael S. Tsirkin wrote:
> > On Tue, Jan 11, 2022 at 09:22:53AM +0200, Eli Cohen wrote:
> > > Make sure the decision whether an index received trough a callback is
> > 
> > through
> 
> Wil fix.
> 
> > 
> > > valid or not consults the negotiated features.
> > > 
> > > Signed-off-by: Eli Cohen <elic@xxxxxxxxxx>
> > 
> > Which commit does this fix?
> 
> No specific commit. It's just that I get called for VQ rellated
> callbacks (e.g. get_vq_state), after the device has been reset. So this
> patch provides protection against such cases. I hit this issue while
> testing locally.

To include in the commit log then.
The point of providing the fixes tag with the commit is that it's
then easier to figure out how do changes interact with each other.

> > 
> > > ---
> > >  drivers/vdpa/mlx5/net/mlx5_vnet.c | 10 +++++++---
> > >  1 file changed, 7 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > > index d1ff65065fb1..9eacfdb48434 100644
> > > --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > > +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> > > @@ -133,10 +133,14 @@ struct mlx5_vdpa_virtqueue {
> > >  
> > >  static bool is_index_valid(struct mlx5_vdpa_dev *mvdev, u16 idx)
> > >  {
> > > -	if (unlikely(idx > mvdev->max_idx))
> > > -		return false;
> > > +	if (!(mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_MQ))) {
> > > +		if (!(mvdev->actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)))
> > > +			return idx < 2;
> > > +		else
> > > +			return idx < 3;
> > > +	}
> > >  
> > > -	return true;
> > > +	return idx <= mvdev->max_idx;
> > >  }
> > >  
> > >  struct mlx5_vdpa_net {
> > > -- 
> > > 2.34.1
> > 

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization



[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux