Thread (4 messages) 4 messages, 3 authors, 29d ago

Re: [PATCH] vduse: return compat ioctl results directly

flat view

From: "Arnd Bergmann" <arnd@arndb.de>
Date: 2026-09-08 08:09:10
Also in: lkml

On Tue, Sep 8, 2026, at 09:57, Michael S. Tsirkin wrote:
On Tue, Sep 08, 2026 at 03:31:51PM +0800, Linfeng Sun wrote:
quoted
The compat handler handles VDUSE_IOTLB_GET_FD and VDUSE_VQ_GET_INFO, but
then calls the native handler. Their different command sizes make native
dispatch return -ENOIOCTLCMD.

For GET_FD, this overwrites receive_fd()'s return value after the
descriptor is installed, leaking one fd per call. Return handled compat
results directly and use native dispatch only for other commands.

Fixes: 455a2a1af926 ("vduse: fix compat handling for VDUSE_IOTLB_GET_FD/VDUSE_VQ_GET_INFO")
Signed-off-by: Linfeng Sun <redacted>
indeed, I will apply.
The fix looks correct to me, thanks!
But ... how was the original patch working then? Arnd, what gives?
It looks I either broke it during refactoring from two functions
into one, or I just didn't do it right in the first place.

I did write in the extra patch text

| The code is directly copied from the native ioctl handler, but I
| did not test this with actual x86-32 userspace, so please review
| carefully.

but obviously should have caught this one myself since it is a much
less subtle bug than the one I was trying to fix in the first place.

      Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help