Skip to content

Commit ce7b4cc

Browse files
lxindavem330
authored andcommitted
sctp: asconf's process should verify address parameter is in the beginning
in sctp_process_asconf(), we get address parameter from the beginning of the addip params. but we never check if it's really there. if the addr param is not there, it still can pass sctp_verify_asconf(), then to be handled by sctp_process_asconf(), it will not be safe. so add a code in sctp_verify_asconf() to check the address parameter is in the beginning, or return false to send abort. note that this can also detect multiple address parameters, and reject it. Signed-off-by: Xin Long <[email protected]> Signed-off-by: Marcelo Ricardo Leitner <[email protected]> Acked-by: Vlad Yasevich <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fbe4307 commit ce7b4cc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

net/sctp/sm_make_chunk.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3132,11 +3132,18 @@ bool sctp_verify_asconf(const struct sctp_association *asoc,
31323132
case SCTP_PARAM_IPV4_ADDRESS:
31333133
if (length != sizeof(sctp_ipv4addr_param_t))
31343134
return false;
3135+
/* ensure there is only one addr param and it's in the
3136+
* beginning of addip_hdr params, or we reject it.
3137+
*/
3138+
if (param.v != addip->addip_hdr.params)
3139+
return false;
31353140
addr_param_seen = true;
31363141
break;
31373142
case SCTP_PARAM_IPV6_ADDRESS:
31383143
if (length != sizeof(sctp_ipv6addr_param_t))
31393144
return false;
3145+
if (param.v != addip->addip_hdr.params)
3146+
return false;
31403147
addr_param_seen = true;
31413148
break;
31423149
case SCTP_PARAM_ADD_IP:

0 commit comments

Comments
 (0)