HomeFreeBSD

linux(4): Check the socket before any others sanity checks

Description

linux(4): Check the socket before any others sanity checks

Strictly speaking, this check is performed by the kern_recvit(), but in
the Linux emulation layer before calling the kernel we do other sanity
checks and conversions from Linux types to the native types. This changes
an order of the error returning that is critical for some buggy Linux
applications.

For recvmmsg() syscall this fixes a panic in case when the user-supplied
vlen value is 0, then error is not initialized and garbage passed to the
bsd_to_linux_errno().

MFC after: 2 weeks

Details

Provenance
dchaginAuthored on May 28 2022, 8:29 PM
Parents
rG77d678b7a407: Fix a memory leak from caf73e58579
Branches
Unknown
Tags
Unknown