From: piaojun <piaojun@huawei.com>
To: <stefanha@linux.vnet.ibm.com>, <pbonzini@redhat.com>
Cc: <linux-kernel@vger.kernel.org>, <rusty@rustcorp.com.au>,
<kvm@vger.kernel.org>, <penberg@kernel.org>, <mst@redhat.com>,
<stefanha@linux.vnet.ibm.com>, <michaelc@cs.wisc.edu>
Subject: [PATCH] scsi/virio_scsi.c: do not call virtscsi_remove_vqs() in virtscsi_init() to avoid crash bug
Date: Thu, 23 Aug 2018 10:24:58 +0800 [thread overview]
Message-ID: <5B7E1AFA.8030506@huawei.com> (raw)
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@huawei.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);
return err;
}
--
next reply other threads:[~2018-08-23 2:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-23 2:24 piaojun [this message]
2018-10-12 14:55 ` [PATCH] scsi/virio_scsi.c: do not call virtscsi_remove_vqs() in virtscsi_init() to avoid crash bug Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5B7E1AFA.8030506@huawei.com \
--to=piaojun@huawei.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=penberg@kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=stefanha@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox