On Tue, Apr 19, 2022 at 04:12:31PM +0200, Maciej Szymański wrote: > Hello, > > I've found a problem in virtio-net driver. > If virtio-net backend device advertises guest offload features, there is > an unpermitted usage of control virtqueue before driver is initialized. > According to VIRTIO specification 2.1.2 : > "The device MUST NOT consume buffers or send any used buffer > notifications to the driver before DRIVER_OK." Right. > During an initialization, driver calls register_netdevice which invokes > callback function virtnet_set_features from __netdev_update_features. > If guest offload features are advertised by the device, > virtnet_set_guest_offloads is using virtnet_send_command to write and > read from VQ. > That leads to initialization stuck as device is not permitted yet to use VQ. Hmm so we have this: if ((dev->features ^ features) & NETIF_F_GRO_HW) { if (vi->xdp_enabled) return -EBUSY; if (features & NETIF_F_GRO_HW) offloads = vi->guest_offloads_capable; else offloads = vi->guest_offloads_capable & ~GUEST_OFFLOAD_GRO_HW_MASK; err = virtnet_set_guest_offloads(vi, offloads); if (err) return err; vi->guest_offloads = offloads; } which I guess should have prevented virtnet_set_guest_offloads from ever running.