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
Unknown Object (File)
Tue, Jul 21, 5:25 AM
Unknown Object (File)
Tue, Jul 21, 5:20 AM
Unknown Object (File)
Tue, Jul 21, 5:20 AM
Unknown Object (File)
Mon, Jul 20, 1:28 AM
Unknown Object (File)
Sun, Jul 19, 2:46 PM
Unknown Object (File)
Sat, Jul 18, 11:08 PM
Unknown Object (File)
Sat, Jul 18, 11:02 PM
Unknown Object (File)
Sat, Jul 18, 10:26 PM
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.