Page MenuHomeFreeBSD

nfs_clrpcops.c: Fix two possible large NFSM_DISSECT()s
ClosedPublic

Authored by rmacklem on Sun, Oct 26, 8:48 PM.
Tags
None
Referenced Files
F133887174: D53367.diff
Wed, Oct 29, 4:54 AM
F133766672: D53367.id165144.diff
Tue, Oct 28, 6:11 AM
Unknown Object (File)
Mon, Oct 27, 8:56 PM
Unknown Object (File)
Mon, Oct 27, 7:38 PM
Unknown Object (File)
Mon, Oct 27, 8:54 AM
Unknown Object (File)
Mon, Oct 27, 6:42 AM
Unknown Object (File)
Mon, Oct 27, 12:34 AM
Subscribers

Details

Summary

There are two cases in nfs_clrpcops.c where it was possible
for the code to attempt to NFSM_DISSECT() a large size,
which is not allowed by nfsm_dissct().

This patch fixes them.

Reducing the maximum stripecnt should be no problem,
since there in no extant NFSv4.n server that does striped
File Layout pNFS and current development is centered
around the Flex File layout.

Test Plan

Not really tested, since that would require a broken
pNFS server.

Diff Detail

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

Event Timeline

markj added inline comments.
sys/fs/nfsclient/nfs_clrpcops.c.shit3
5810 ↗(On Diff #165085)

I'd write something like MHLEN /* ncl_mbuf_mhlen */ since otherwise the use of MHLEN here looks rather odd to me.

5817 ↗(On Diff #165085)

I wonder why nfsm_dissct() panics instead of just returning NULL if the caller asks for too many bytes?

This revision is now accepted and ready to land.Mon, Oct 27, 1:50 PM
sys/fs/nfsclient/nfs_clrpcops.c.shit3
5810 ↗(On Diff #165085)

I was planning on getting rid of ncl_mbuf_mlen,
since it is just set to MHLEN anyhow.
(That's why I used MHLEN instead of making
ncl_mbuf_mlen global.)

5817 ↗(On Diff #165085)

So users could find the bugs for me.
(Since the panic is the result of too large
an argument and is easily fixed once found.)

Returning NULL and causing a NFSERR_BADXDR
failure would make it appear that the other end
was broken and there was no bug in the code.