From: Mike Christie <michael.christie@oracle.com>
To: Haoran Zhang <wh1sper@zju.edu.cn>, mst@redhat.com
Cc: jasowang@redhat.com, pbonzini@redhat.com, stefanha@redhat.com,
eperezma@redhat.com, virtualization@lists.linux.dev,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vhost/scsi: Fix improper cleanup in vhost_scsi_set_endpoint()
Date: Sun, 12 Jan 2025 15:19:44 -0600 [thread overview]
Message-ID: <481cd60a-d633-4251-bb53-d3026e005930@oracle.com> (raw)
In-Reply-To: <bae5ca72-c6ff-4412-a317-4649f2d09cdf@oracle.com>
On 1/12/25 11:35 AM, michael.christie@oracle.com wrote:
> So I think to fix the issue, we would want to:
>
> 1. move the
>
> memcpy(vs_tpg, vs->vs_tpg, len);
>
> to the end of the function after we do the vhost_scsi_flush. This will
> be more complicated than the current memcpy though. We will want to
> merge the local vs_tpg and the vs->vs_tpg like:
>
> for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) {
> if (vs_tpg[i])
> vs->vs_tpg[i] = vs_tpg[i])
> }
I think I wrote that in reverse. We would want:
vhost_scsi_flush(vs);
if (vs->vs_tpg) {
for (i = 0; i < VHOST_SCSI_MAX_TARGET; i++) {
if (vs->vs_tpg[i])
vs_tpg[i] = vs->vs_tpg[i])
}
}
kfree(vs->vs_tpg);
vs->vs_tpg = vs_tpg;
or we could just allocate the vs_tpg with the vhost_scsi like:
struct vhost_scsi {
....
struct vhost_scsi_tpg *vs_tpg[VHOST_SCSI_MAX_TARGET];
then when we loop in vhost_scsi_set/clear_endpoint set/clear the
every vs_tpg entry.
next prev parent reply other threads:[~2025-01-12 21:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-11 3:34 [PATCH] vhost/scsi: Fix improper cleanup in vhost_scsi_set_endpoint() Haoran Zhang
2025-01-11 5:45 ` Kuan-Wei Chiu
2025-01-11 8:14 ` 张浩然
2025-01-12 17:35 ` michael.christie
2025-01-12 21:19 ` Mike Christie [this message]
2025-01-14 2:17 ` Lei Yang
2025-01-14 8:41 ` 张浩然
2025-01-14 11:26 ` Michael S. Tsirkin
2025-01-14 17:13 ` Mike Christie
2025-01-14 7:40 ` 张浩然
2025-01-14 17:44 ` Mike Christie
2025-01-17 11:42 ` Haoran Zhang
2025-01-17 16:50 ` Mike Christie
2025-01-17 17:11 ` Mike Christie
2025-01-19 10:54 ` 张浩然
2025-01-19 6:50 ` 张浩然
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=481cd60a-d633-4251-bb53-d3026e005930@oracle.com \
--to=michael.christie@oracle.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=wh1sper@zju.edu.cn \
/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