]> git.ipfire.org Git - people/ms/linux.git/commit
[PATCH] NET: "wrong timeout value" in sk_wait_data() v2
authorVasily Averin <vvs@sw.ru>
Thu, 7 Jun 2007 05:51:03 +0000 (22:51 -0700)
committerChris Wright <chrisw@sous-sol.org>
Mon, 11 Jun 2007 18:37:12 +0000 (11:37 -0700)
commit6905f0fcedf2a9f44d2690bf029cb1efdc7a9fdb
tree37481bb20eabf8df759f911fbd7a41f40bb2ff4a
parentc47a0639173d3c43f6ad07acdbbee955c9e2c204
[PATCH] NET: "wrong timeout value" in sk_wait_data() v2

sys_setsockopt() do not check properly timeout values for
SO_RCVTIMEO/SO_SNDTIMEO, for example it's possible to set negative timeout
values. POSIX do not defines behaviour for sys_setsockopt in case negative
timeouts, but requires that setsockopt() shall fail with -EDOM if the send and
receive timeout values are too big to fit into the timeout fields in the socket
structure.
In current implementation negative timeout can lead to error messages like
"schedule_timeout: wrong timeout value".

Proposed patch:
- checks tv_usec and returns -EDOM if it is wrong
- do not allows to set negative timeout values (sets 0 instead) and outputs
ratelimited information message about such attempts.

Signed-off-By: Vasily Averin <vvs@sw.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
net/core/sock.c