lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181012145550.GK24267@stefanha-x1.localdomain>
Date:   Fri, 12 Oct 2018 15:55:50 +0100
From:   Stefan Hajnoczi <stefanha@...il.com>
To:     piaojun <piaojun@...wei.com>
Cc:     pbonzini@...hat.com, linux-kernel@...r.kernel.org,
        rusty@...tcorp.com.au, kvm@...r.kernel.org, penberg@...nel.org,
        mst@...hat.com, michaelc@...wisc.edu
Subject: Re: [PATCH] scsi/virio_scsi.c: do not call virtscsi_remove_vqs() in
 virtscsi_init() to avoid crash bug

On Thu, Aug 23, 2018 at 10:24:58AM +0800, piaojun wrote:
> If some error happened before find_vqs, error branch will goto
> virtscsi_remove_vqs to free vqs. Actually the vqs have not been allocated
> successfully, so this will cause wild-pointer-free problem. So
> virtscsi_remove_vqs could be deleted as no error will happen after
> find_vqs.
> 
> Signed-off-by: Jun Piao <piaojun@...wei.com>
> ---
>  drivers/scsi/virtio_scsi.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
> index 1c72db9..da0fd74 100644
> --- a/drivers/scsi/virtio_scsi.c
> +++ b/drivers/scsi/virtio_scsi.c
> @@ -833,8 +833,6 @@ static int virtscsi_init(struct virtio_device *vdev,
>  	kfree(names);
>  	kfree(callbacks);
>  	kfree(vqs);
> -	if (err)
> -		virtscsi_remove_vqs(vdev);

Can you provide more details about the problem?

drivers/virtio/virtio_pci_common.c:vp_del_vqs() looks fine to me, it
iterates over vdev->vqs.  The vdev->vqs list has been initialized in
drivers/virtio/virtio.c:register_virtio_device() and it's empty.

Stefan

Download attachment "signature.asc" of type "application/pgp-signature" (456 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ