]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
When a previous call to sbsndptr() leaves sb->sb_sndptroff at the start of an
authorlstewart <lstewart@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 3 Jul 2013 03:40:06 +0000 (03:40 +0000)
committerlstewart <lstewart@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 3 Jul 2013 03:40:06 +0000 (03:40 +0000)
commit8b120c7ec466a47b71df22581e1ba8991d6ebb2b
tree4b2783bae456a5c7fecb43b14ccbb313c0676819
parenta0975159c454a54668a2b74cdbd2710525a76b33
When a previous call to sbsndptr() leaves sb->sb_sndptroff at the start of an
mbuf that was fully consumed by the previous call, the mbuf ptr returned by the
current call ends up being the previous mbuf in the sb chain to the one that
contains the data we want.

This does not cause any observable issues because the mbuf copy routines happily
walk the mbuf chain to get to the data at the moff offset, which in this case
means they effectively skip over the mbuf returned by sbsndptr().

We can't adjust sb->sb_sndptr during the previous call for this case because the
next mbuf in the chain may not exist yet. We therefore need to detect the
condition and make the adjustment during the current call.

Fix by detecting the special case of moff being at the start of the next mbuf in
the chain and adjust the required accounting variables accordingly.

Reviewed by: andre

git-svn-id: svn://svn.freebsd.org/base/stable/8@252533 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/kern/uipc_sockbuf.c