• Daniel Borkmann's avatar
    net: sctp: propagate sysctl errors from proc_do* properly · ff5e92c1
    Daniel Borkmann authored
    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: 4f3fdf3b ("sctp: add check rto_min and rto_max in sysctl")
    Fixes: 3c68198e ("sctp: Make hmac algorithm selection for cookie generation dynamic")
    Signed-off-by: default avatarDaniel Borkmann <dborkman@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    ff5e92c1
sysctl.c 12.3 KB