Page MenuHomeFreeBSD

mbuf: make m_unshare() allow unmapped mbufs
ClosedPublic

Authored by takahiro.kurosawa_gmail.com on Sun, Jul 12, 7:29 AM.
Tags
None
Referenced Files
F165078712: D58189.id182033.diff
Wed, Aug 5, 8:26 PM
Unknown Object (File)
Tue, Aug 4, 2:43 AM
Unknown Object (File)
Sun, Aug 2, 6:10 AM
Unknown Object (File)
Sun, Aug 2, 4:44 AM
Unknown Object (File)
Sat, Aug 1, 10:06 PM
Unknown Object (File)
Sat, Aug 1, 7:07 PM
Unknown Object (File)
Sat, Aug 1, 7:41 AM
Unknown Object (File)
Sat, Aug 1, 4:34 AM
Subscribers

Details

Summary

m_unshare() had crashed if unmapped mbufs exist in the mbuf chain.
This was because memcpy() with mtod() was used without making sure that
the mbuf was mapped. Use m_copydata() that cares unmapped mbufs instead.

Diff Detail

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

Event Timeline

I'd write this as 'mcopydata(m,off, len, mtod(..));

Use m_copydata() instead of m_copyfromunmapped() as suggested by the review.

I'd write this as 'mcopydata(m,off, len, mtod(..));

I've updated the code and the summary text according to your comment.
It gets much simpler. Thanks for the review!

This revision is now accepted and ready to land.Tue, Jul 14, 5:08 PM
This revision was automatically updated to reflect the committed changes.