]> git.baikalelectronics.ru Git - kernel.git/commit
sctp: fix incorrect overflow check on autoclose
authorXi Wang <xi.wang@gmail.com>
Fri, 16 Dec 2011 12:44:15 +0000 (12:44 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 19 Dec 2011 21:25:46 +0000 (16:25 -0500)
commit7530a6af69964f00da5583bb6d20448aceff9eb3
treee39f21131faf42ada263c1969cfa200af2f4b0f9
parent90b6901e21be9e572964ad35eab3668dd83049bd
sctp: fix incorrect overflow check on autoclose

Commit 08a53783 voids the previous patches f99c092b and 6b74e398 for
limiting the autoclose value.  If userspace passes in -1 on 32-bit
platform, the overflow check didn't work and autoclose would be set
to 0xffffffff.

This patch defines a max_autoclose (in seconds) for limiting the value
and exposes it through sysctl, with the following intentions.

1) Avoid overflowing autoclose * HZ.

2) Keep the default autoclose bound consistent across 32- and 64-bit
   platforms (INT_MAX / HZ in this patch).

3) Keep the autoclose value consistent between setsockopt() and
   getsockopt() calls.

Suggested-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sctp/structs.h
net/sctp/associola.c
net/sctp/protocol.c
net/sctp/socket.c
net/sctp/sysctl.c