mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 08:08:54 +00:00
strparser: Fix sign of err codes
[ Upstream commitcd00edc179
] 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:43a0c6751a
("strparser: Stream parser for messages") Signed-off-by: Dave Watson <davejwatson@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1c71bfe84d
commit
477c73abf2
1 changed files with 2 additions and 2 deletions
|
@ -60,7 +60,7 @@ static void strp_abort_strp(struct strparser *strp, int err)
|
||||||
struct sock *sk = strp->sk;
|
struct sock *sk = strp->sk;
|
||||||
|
|
||||||
/* Report an error on the lower socket */
|
/* Report an error on the lower socket */
|
||||||
sk->sk_err = err;
|
sk->sk_err = -err;
|
||||||
sk->sk_error_report(sk);
|
sk->sk_error_report(sk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -458,7 +458,7 @@ static void strp_msg_timeout(struct work_struct *w)
|
||||||
/* Message assembly timed out */
|
/* Message assembly timed out */
|
||||||
STRP_STATS_INCR(strp->stats.msg_timeouts);
|
STRP_STATS_INCR(strp->stats.msg_timeouts);
|
||||||
strp->cb.lock(strp);
|
strp->cb.lock(strp);
|
||||||
strp->cb.abort_parser(strp, ETIMEDOUT);
|
strp->cb.abort_parser(strp, -ETIMEDOUT);
|
||||||
strp->cb.unlock(strp);
|
strp->cb.unlock(strp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue