]> git.baikalelectronics.ru Git - kernel.git/commit
net: sctp: propagate sysctl errors from proc_do* properly
authorDaniel Borkmann <dborkman@redhat.com>
Wed, 18 Jun 2014 23:31:30 +0000 (01:31 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 19 Jun 2014 00:03:07 +0000 (17:03 -0700)
commit9390be1a308ae4be9b0c20e38bc02c2a1e579620
tree3e4c1685968ba9ea18fd763ea04bc0b3f3c87cef
parent39b60ce4143e805c0d76ebee6e8b4fe0d3279e8c
net: sctp: propagate sysctl errors from proc_do* properly

sysctl handler proc_sctp_do_hmac_alg(), proc_sctp_do_rto_min() and
proc_sctp_do_rto_max() do not properly reflect some error cases
when writing values via sysctl from internal proc functions such
as proc_dointvec() and proc_dostring().

In all these cases we pass the test for write != 0 and partially
do additional work just to notice that additional sanity checks
fail and we return with hard-coded -EINVAL while proc_do*
functions might also return different errors. So fix this up by
simply testing a successful return of proc_do* right after
calling it.

This also allows to propagate its return value onwards to the user.
While touching this, also fix up some minor style issues.

Fixes: d4b545c600c5 ("sctp: add check rto_min and rto_max in sysctl")
Fixes: b30d9f5c4869 ("sctp: Make hmac algorithm selection for cookie generation dynamic")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/sysctl.c