sctp: check the rto_min and rto_max
Subsystems (3)
PATCH v4 1/1 sctp: check the rto_min and rto_max
rto_min should be smaller than rto_max while rto_max should be larger than rto_min. Add two proc_handler for the checking. Add the check in sctp_setsockopt_rtoinfo.
delete a blank line in proc_sctp_do_hmac_alg() declaration.
--- net/sctp/socket.c | 5 ++++ net/sctp/sysctl.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 5 deletions(-)
net/sctp/socket.c +5 -0
@@ -2818,6 +2818,11 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigneif (copy_from_user (&rtoinfo, optval, optlen))return -EFAULT ; +if (rtoinfo.srto_min <1 || + rtoinfo.srto_max >86400000 || + rtoinfo.srto_max < rtoinfo.srto_min) +return -EINVAL ; + asoc =sctp_id2assoc (sk, rtoinfo.srto_assoc_id);/* Set the values to the specific association */
net/sctp/sysctl.c +69 -5
100 lines not on this page · raw message
Signature · 1 line
1.7.12
Quoted 17 lines · Wang Weidong
rto_minshould be smaller thanrto_maxwhilerto_maxshould be larger thanrto_min. Add twoproc_handlerfor the checking. Add the check insctp_setsockopt_rtoinfo.
delete a blank line inproc_sctp_do_hmac_alg()declaration.Suggested-by Vlad Yasevich <[email protected]>Signed-off-by Wang Weidong <[email protected]>--- net/sctp/socket.c | 5 ++++ net/sctp/sysctl.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 5 deletions(-)net/sctp/socket.c +0
-0
net/sctp/socket.c static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigne · line 2822
Quoted 5 lines
net/sctp/socket.c +2
-0@@ -2818,6 +2818,11 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigneif (copy_from_user (&rtoinfo, optval, optlen))return -EFAULT ; + if (rtoinfo.srto_min < 1 || + rtoinfo.srto_max > 86400000 ||
These should be defiend to some descriptive value.
From: Wang Weidong <[email protected]>
Quoted 21 lines · Neil Horman
Quoted 20 lines · Wang Weidong
rto_minshould be smaller thanrto_maxwhilerto_maxshould be larger thanrto_min. Add twoproc_handlerfor the checking. Add the check insctp_setsockopt_rtoinfo.
delete a blank line inproc_sctp_do_hmac_alg()declaration.Suggested-by Vlad Yasevich <[email protected]>Signed-off-by Wang Weidong <[email protected]>--- net/sctp/socket.c | 5 ++++ net/sctp/sysctl.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 5 deletions(-)net/sctp/socket.c +0
-0@@ -2818,6 +2818,11 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigneif (copy_from_user (&rtoinfo, optval, optlen))return -EFAULT ;
Quoted 4 lines
net/sctp/socket.c static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigne · line 2822
Quoted 2 lines
net/sctp/socket.c +2
-0+ if (rtoinfo.srto_min < 1 || + rtoinfo.srto_max > 86400000 ||These should be defiend to some descriptive value.
Thanks for your suggestion. I will fix it in v5.
Regards.
Quoted 23 lines · Wang Weidong
From: Wang Weidong <[email protected]>
Quoted 21 lines · Neil Horman
Quoted 20 lines · Wang Weidong
rto_minshould be smaller thanrto_maxwhilerto_maxshould be larger thanrto_min. Add twoproc_handlerfor the checking. Add the check insctp_setsockopt_rtoinfo.
delete a blank line inproc_sctp_do_hmac_alg()declaration.Suggested-by Vlad Yasevich <[email protected]>Signed-off-by Wang Weidong <[email protected]>--- net/sctp/socket.c | 5 ++++ net/sctp/sysctl.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 5 deletions(-)net/sctp/socket.c +0
-0@@ -2818,6 +2818,11 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigneif (copy_from_user (&rtoinfo, optval, optlen))return -EFAULT ;
Quoted 5 lines
Quoted 4 lines
net/sctp/socket.c static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigne · line 2822
Quoted 2 lines
net/sctp/socket.c +2
-0+ if (rtoinfo.srto_min < 1 || + rtoinfo.srto_max > 86400000 ||These should be defiend to some descriptive value.
Thanks for your suggestion. I will fix it in v5.
While you're on v5 anyway, please also fix up spacing in your commit from ...
static int proc_sctp_do_rto_min(struct ctl_table *ctl,
int write,
void __user*buffer, size_t *lenp, loff_t *ppos)
... to something like ...
static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
Thanks !
Quoted 38 lines · Daniel Borkmann
Quoted 23 lines · Wang Weidong
From: Wang Weidong <[email protected]>
Quoted 21 lines · Neil Horman
Quoted 20 lines · Wang Weidong
rto_minshould be smaller thanrto_maxwhilerto_maxshould be larger thanrto_min. Add twoproc_handlerfor the checking. Add the check insctp_setsockopt_rtoinfo.
delete a blank line inproc_sctp_do_hmac_alg()declaration.Suggested-by Vlad Yasevich <[email protected]>Signed-off-by Wang Weidong <[email protected]>--- net/sctp/socket.c | 5 ++++ net/sctp/sysctl.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 5 deletions(-)net/sctp/socket.c +0
-0@@ -2818,6 +2818,11 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigneif (copy_from_user (&rtoinfo, optval, optlen))return -EFAULT ;Quoted 5 lines
Quoted 4 lines
net/sctp/socket.c static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigne · line 2822
Quoted 2 lines
net/sctp/socket.c +2
-0+ if (rtoinfo.srto_min < 1 || + rtoinfo.srto_max > 86400000 ||These should be defiend to some descriptive value.
Thanks for your suggestion. I will fix it in v5.
While you're on v5 anyway, please also fix up spacing in your commit from ...
static int proc_sctp_do_rto_min(struct
ctl_table*ctl,
int write,
void __user*buffer,size_t*lenp,loff_t*ppos)
Quoted 7 lines
... to something like ...
static int proc_sctp_do_rto_min(struct
ctl_table*ctl, int write,
void__user*buffer,size_t*lenp,loff_t*ppos)Thanks !
Hm, I do it for according to the proc_sctp_do_hmac_alg which is in the same file. If I fix this, I think it is better to fix the proc_sctp_do_hmac_alg as well. Should I do it a patch or another patch?
Thanks!
Quoted 6 lines
Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Wang Weidong
Hm, I do it for according to the
proc_sctp_do_hmac_algwhich is in the same file. If I fix this, I think it is better to fix theproc_sctp_do_hmac_algas well. Should I do it a patch or another patch?
Sure, feel free.
Quoted 21 lines · Neil Horman
Quoted 20 lines · Wang Weidong
rto_minshould be smaller thanrto_maxwhilerto_maxshould be larger thanrto_min. Add twoproc_handlerfor the checking. Add the check insctp_setsockopt_rtoinfo.
delete a blank line inproc_sctp_do_hmac_alg()declaration.Suggested-by Vlad Yasevich <[email protected]>Signed-off-by Wang Weidong <[email protected]>--- net/sctp/socket.c | 5 ++++ net/sctp/sysctl.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 74 insertions(+), 5 deletions(-)net/sctp/socket.c +0
-0@@ -2818,6 +2818,11 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigneif (copy_from_user (&rtoinfo, optval, optlen))return -EFAULT ;
Quoted 5 lines
net/sctp/socket.c static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigne · line 2822
Quoted 2 lines
net/sctp/socket.c +2
-0+ if (rtoinfo.srto_min < 1 || + rtoinfo.srto_max > 86400000 ||These should be defiend to some descriptive value.
Hi Neil,
Should I define it in net/sctp/sctp.h, so sysctl.c can use it as well. Or I just define it in the socket.c same as the definition in sysctl.c?
Regards.
Wang
Quoted 1 line
Quoted 2 lines · Wang Weidong
Should I define it in
net/sctp/sctp.h, sosysctl.ccan use it as well. Or I just define it in thesocket.csame as the definition insysctl.c?
Preferably in include/net/sctp/constants.h where we already have most other constants anyway.
Quoted 8 lines · Daniel Borkmann
Quoted 2 lines · Wang Weidong
Should I define it in
net/sctp/sctp.h, sosysctl.ccan use it as well. Or I just define it in thesocket.csame as the definition insysctl.c?Preferably in
include/net/sctp/constants.hwhere we already have most other constants anyway.
Nice, Thanks for your suggestion.
Regards.
Wang
Quoted 1 line
Quoted 9 lines · Daniel Borkmann
Quoted 2 lines · Wang Weidong
Should I define it in
net/sctp/sctp.h, sosysctl.ccan use it as well. Or I just define it in thesocket.csame as the definition insysctl.c?Preferably in
include/net/sctp/constants.hwhere we already have most other constants anyway.
Hi Daniel,
in sysctl.c it will use a point to the value while the socket.c use the value. So if I define macros SCTP_ONE or SCTP_TIMER_MAX in include/net/sctp/constants.h which only used by socket.c. Is it OK?
Regards.
Wang