On 13.01.21 11:39, Peng Fan (OSS) wrote:
> From: Peng Fan <peng....@nxp.com>
> 
> We enable the virtio_ivshmem driver and add
> shared memory region including pci devices in cell file. But we not
> start backend.
> 
> There might be garbage data in "vi_dev->virtio_header", so we need to
> check peer_state to abort the probe earlier.
> 
> Signed-off-by: Peng Fan <peng....@nxp.com>
> ---
>  drivers/virtio/virtio_ivshmem.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_ivshmem.c b/drivers/virtio/virtio_ivshmem.c
> index bf62377790b1..7132cf0e25fe 100644
> --- a/drivers/virtio/virtio_ivshmem.c
> +++ b/drivers/virtio/virtio_ivshmem.c
> @@ -846,6 +846,10 @@ static int virtio_ivshmem_probe(struct pci_dev *pci_dev,
>               return -ENOMEM;
>  
>       vi_dev->peer_state = &state_table[vi_dev->peer_id];
> +     if (*vi_dev->peer_state != VIRTIO_STATE_READY) {
> +             dev_err(&pci_dev->dev, "backend not ready\n");
> +             return -ENODEV;
> +     }
>  
>       section_addr += section_sz;
>  
> @@ -898,11 +902,6 @@ static int virtio_ivshmem_probe(struct pci_dev *pci_dev,
>  
>       set_dma_ops(&pci_dev->dev, &virtio_ivshmem_dma_ops);
>  
> -     if (*vi_dev->peer_state != VIRTIO_STATE_READY) {
> -             dev_err(&pci_dev->dev, "backend not ready\n");
> -             return -ENODEV;
> -     }
> -
>       pci_set_master(pci_dev);
>       pci_write_config_byte(pci_dev, vendor_cap + IVSHM_CFG_PRIV_CNTL, 0);
>  
> 

Thanks, picked up for queues/jailhouse.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/1b188b78-f0bd-5b63-84e4-e1439bc2c6da%40siemens.com.

Reply via email to