Page MenuHomeFreeBSD

nfs_nfsdserv.c: Add sanity check for layout commit cnt
ClosedPublic

Authored by rmacklem on Oct 25 2025, 8:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 27, 4:29 AM
Unknown Object (File)
Sun, Nov 23, 8:58 AM
Unknown Object (File)
Thu, Nov 20, 1:35 PM
Unknown Object (File)
Mon, Nov 17, 7:21 PM
Unknown Object (File)
Sat, Nov 8, 12:13 AM
Unknown Object (File)
Fri, Nov 7, 4:21 PM
Unknown Object (File)
Thu, Nov 6, 5:51 PM
Unknown Object (File)
Oct 30 2025, 2:25 AM
Subscribers

Details

Summary

If a client were to send a LayoutCommit (seldom
used and only for a pNFS server) with a bogus
cnt, there could be problems with a malloc() call
that uses it.

This patch adds a sanity check for the cnt. Note
that RFC8881 does not specify any upper bound
on the cnt.

Test Plan

Not tested. To do so would require a pNFS server
configuration and a broken client.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj added inline comments.
sys/fs/nfsserver/nfs_nfsdserv.c
5154

Many of these parameters are unused. Is it deliberate that you pass them all here?

This revision is now accepted and ready to land.Oct 27 2025, 1:26 PM
sys/fs/nfsserver/nfs_nfsdserv.c
5154

Yes. You could call them "someday, maybe".
How these might be used by future Layout types
is anyone's guess.

For example, the current Flex Files layout implementations
do not do striping (and as such the offsets and sizes don't
mean much of anything) but the RFC describes striping
and someone just committed patches to the Linux client
to support striping (presumably for some future server).