sctp: fix potential panics in the SCTP-AUTH API.
All of the SCTP-AUTH socket options could cause a panic if the extension is disabled and the API is envoked. Additionally, there were some additional assumptions that certain pointers would always be valid which may not always be the case. This patch hardens the API and address all of the crash scenarios. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
6a55617ed5
commit
5e739d1752
@@ -103,6 +103,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
|
||||
|
||||
/* Initialize the CHUNKS parameter */
|
||||
auth_chunks->param_hdr.type = SCTP_PARAM_CHUNKS;
|
||||
auth_chunks->param_hdr.length = htons(sizeof(sctp_paramhdr_t));
|
||||
|
||||
/* If the Add-IP functionality is enabled, we must
|
||||
* authenticate, ASCONF and ASCONF-ACK chunks
|
||||
@@ -110,8 +111,7 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep,
|
||||
if (sctp_addip_enable) {
|
||||
auth_chunks->chunks[0] = SCTP_CID_ASCONF;
|
||||
auth_chunks->chunks[1] = SCTP_CID_ASCONF_ACK;
|
||||
auth_chunks->param_hdr.length =
|
||||
htons(sizeof(sctp_paramhdr_t) + 2);
|
||||
auth_chunks->param_hdr.length += htons(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user