• Dave Watson's avatar
    strparser: Fix sign of err codes · cd00edc1
    Dave Watson authored
    strp_parser_err is called with a negative code everywhere, which then
    calls abort_parser with a negative code.  strp_msg_timeout calls
    abort_parser directly with a positive code.  Negate ETIMEDOUT
    to match signed-ness of other calls.
    
    The default abort_parser callback, strp_abort_strp, sets
    sk->sk_err to err.  Also negate the error here so sk_err always
    holds a positive value, as the rest of the net code expects.  Currently
    a negative sk_err can result in endless loops, or user code that
    thinks it actually sent/received err bytes.
    
    Found while testing net/tls_sw recv path.
    
    Fixes: 43a0c675 ("strparser: Stream parser for messages")
    Signed-off-by: default avatarDave Watson <davejwatson@fb.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    cd00edc1
strparser.c 13.3 KB