From: sashiko-bot@kernel.org
To: "Qican Ma" <goonsomeway@gmail.com>
Cc: virtualization@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH v2] vfio/virtio: read migration buffers and f_pos under migf->lock
Date: Tue, 24 Nov 2026 08:03:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-230700@kernel.org> (raw)
In-Reply-To: <179550684893.38679.618538654837589800@gmail.com>
> virtiovf_resume_write() reads migf->buf and migf->buf_header and checks
> filp->f_pos against vhca_buf->start_pos before taking state_mutex and
> migf->lock. Because virtiovf_pci_resume_device_data() opens the file via
> stream_open(), FMODE_ATOMIC_POS is cleared and concurrent writes through
> duplicated file descriptors are not serialized by f_pos_lock. A racing
> writer in VIRTIOVF_LOAD_STATE_PREP_HEADER_DATA can free and reallocate
> migf->buf_header under migf->lock while another writer still holds the
> stale pointer captured before the lock.
>
> Move the buffer pointer reads and start_pos check under migf->lock after
> checking VIRTIOVF_MIGF_STATE_ERROR.
>
> Found with an LLM-assisted code review tool and verified by inspection on
> v7.4-rc4 (b6a9fa34ce4). Build-tested only due to lack of virtio VF
> live-migration hardware.
>
> Fixes: 0bbc82e4ec79 ("vfio/virtio: Add support for the basic live migration functionality")
> Cc: stable@vger.kernel.org
> Signed-off-by: Qican Ma <goonsomeway@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/179550684893.38679.618538654837589800@gmail.com?part=1
next prev parent reply other threads:[~2026-11-24 8:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 7:54 [PATCH v2] vfio/virtio: read migration buffers and f_pos under migf->lock Qican Ma
2026-11-24 8:03 ` sashiko-bot [this message]
2026-11-24 10:39 ` Yishai Hadas
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=sashiko-outbox-230700@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=eperezma@redhat.com \
--cc=goonsomeway@gmail.com \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.