git: tcp: Fix upper half (socket code) and so_port switching race.

Sepherosa Ziehau sephe at
Sun Aug 10 05:36:55 PDT 2014

commit cfc92b211902c0623f72da35d19127eb281f9ffe
Author: Sepherosa Ziehau <sephe at>
Date:   Sun Aug 10 20:22:12 2014 +0800

    tcp: Fix upper half (socket code) and so_port switching race.
    Use message put done receipt to change this socket's so_port, i.e. _after_
    this message was put onto the target netisr's msgport but _before_ the
    message could be pulled from the target netisr's msgport, so that:
    - The upper half (socket code) will not see the new msgport before this
      message reaches the new msgport and messages for this socket will be
    - This message will see the new msgport, when its handler is called in the
      target netisr.
    Add comment about it and explain why the so_port switching should be done
    in this commit's fashion.
    Reported-by: dillon@

Summary of changes:
 sys/netinet/tcp_usrreq.c | 62 +++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 56 insertions(+), 6 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list