diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-06-29 23:52:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-01 12:08:41 -0400 |
commit | 922dbc5be2186659d2c453a53f2ae569e55b6101 (patch) | |
tree | 5d86f92e1e86d0e3da98255617ecafc3db969d89 | |
parent | ae146d9b76589d636d11c5e4382bbba2fe8bdb9b (diff) |
sctp: remove the typedef sctp_chunkhdr_t
This patch is to remove the typedef sctp_chunkhdr_t, and replace
with struct sctp_chunkhdr in the places where it's using this
typedef.
It is also to fix some indents and use sizeof(variable) instead
of sizeof(type)., especially in sctp_new.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/sctp.h | 34 | ||||
-rw-r--r-- | include/net/sctp/sctp.h | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_core.c | 4 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_proto_sctp.c | 6 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_sctp.c | 29 | ||||
-rw-r--r-- | net/netfilter/xt_sctp.c | 4 | ||||
-rw-r--r-- | net/sctp/input.c | 20 | ||||
-rw-r--r-- | net/sctp/inqueue.c | 15 | ||||
-rw-r--r-- | net/sctp/sm_make_chunk.c | 17 | ||||
-rw-r--r-- | net/sctp/sm_sideeffect.c | 5 | ||||
-rw-r--r-- | net/sctp/sm_statefuns.c | 67 | ||||
-rw-r--r-- | net/sctp/ulpevent.c | 2 |
12 files changed, 102 insertions, 103 deletions
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 85540ec4b561..9ad5b9e8df78 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
@@ -70,11 +70,11 @@ static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | /* Section 3.2. Chunk Field Descriptions. */ | 72 | /* Section 3.2. Chunk Field Descriptions. */ |
73 | typedef struct sctp_chunkhdr { | 73 | struct sctp_chunkhdr { |
74 | __u8 type; | 74 | __u8 type; |
75 | __u8 flags; | 75 | __u8 flags; |
76 | __be16 length; | 76 | __be16 length; |
77 | } sctp_chunkhdr_t; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | /* Section 3.2. Chunk Type Values. | 80 | /* Section 3.2. Chunk Type Values. |
@@ -236,8 +236,8 @@ typedef struct sctp_datahdr { | |||
236 | } sctp_datahdr_t; | 236 | } sctp_datahdr_t; |
237 | 237 | ||
238 | typedef struct sctp_data_chunk { | 238 | typedef struct sctp_data_chunk { |
239 | sctp_chunkhdr_t chunk_hdr; | 239 | struct sctp_chunkhdr chunk_hdr; |
240 | sctp_datahdr_t data_hdr; | 240 | sctp_datahdr_t data_hdr; |
241 | } sctp_data_chunk_t; | 241 | } sctp_data_chunk_t; |
242 | 242 | ||
243 | /* DATA Chuck Specific Flags */ | 243 | /* DATA Chuck Specific Flags */ |
@@ -267,7 +267,7 @@ typedef struct sctp_inithdr { | |||
267 | } sctp_inithdr_t; | 267 | } sctp_inithdr_t; |
268 | 268 | ||
269 | typedef struct sctp_init_chunk { | 269 | typedef struct sctp_init_chunk { |
270 | sctp_chunkhdr_t chunk_hdr; | 270 | struct sctp_chunkhdr chunk_hdr; |
271 | sctp_inithdr_t init_hdr; | 271 | sctp_inithdr_t init_hdr; |
272 | } sctp_init_chunk_t; | 272 | } sctp_init_chunk_t; |
273 | 273 | ||
@@ -386,7 +386,7 @@ typedef struct sctp_sackhdr { | |||
386 | } sctp_sackhdr_t; | 386 | } sctp_sackhdr_t; |
387 | 387 | ||
388 | typedef struct sctp_sack_chunk { | 388 | typedef struct sctp_sack_chunk { |
389 | sctp_chunkhdr_t chunk_hdr; | 389 | struct sctp_chunkhdr chunk_hdr; |
390 | sctp_sackhdr_t sack_hdr; | 390 | sctp_sackhdr_t sack_hdr; |
391 | } sctp_sack_chunk_t; | 391 | } sctp_sack_chunk_t; |
392 | 392 | ||
@@ -403,7 +403,7 @@ typedef struct sctp_heartbeathdr { | |||
403 | } sctp_heartbeathdr_t; | 403 | } sctp_heartbeathdr_t; |
404 | 404 | ||
405 | typedef struct sctp_heartbeat_chunk { | 405 | typedef struct sctp_heartbeat_chunk { |
406 | sctp_chunkhdr_t chunk_hdr; | 406 | struct sctp_chunkhdr chunk_hdr; |
407 | sctp_heartbeathdr_t hb_hdr; | 407 | sctp_heartbeathdr_t hb_hdr; |
408 | } sctp_heartbeat_chunk_t; | 408 | } sctp_heartbeat_chunk_t; |
409 | 409 | ||
@@ -413,7 +413,7 @@ typedef struct sctp_heartbeat_chunk { | |||
413 | * chunk descriptor. | 413 | * chunk descriptor. |
414 | */ | 414 | */ |
415 | typedef struct sctp_abort_chunk { | 415 | typedef struct sctp_abort_chunk { |
416 | sctp_chunkhdr_t uh; | 416 | struct sctp_chunkhdr uh; |
417 | } sctp_abort_chunk_t; | 417 | } sctp_abort_chunk_t; |
418 | 418 | ||
419 | 419 | ||
@@ -425,8 +425,8 @@ typedef struct sctp_shutdownhdr { | |||
425 | } sctp_shutdownhdr_t; | 425 | } sctp_shutdownhdr_t; |
426 | 426 | ||
427 | struct sctp_shutdown_chunk_t { | 427 | struct sctp_shutdown_chunk_t { |
428 | sctp_chunkhdr_t chunk_hdr; | 428 | struct sctp_chunkhdr chunk_hdr; |
429 | sctp_shutdownhdr_t shutdown_hdr; | 429 | sctp_shutdownhdr_t shutdown_hdr; |
430 | }; | 430 | }; |
431 | 431 | ||
432 | /* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ | 432 | /* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ |
@@ -438,8 +438,8 @@ typedef struct sctp_errhdr { | |||
438 | } sctp_errhdr_t; | 438 | } sctp_errhdr_t; |
439 | 439 | ||
440 | typedef struct sctp_operr_chunk { | 440 | typedef struct sctp_operr_chunk { |
441 | sctp_chunkhdr_t chunk_hdr; | 441 | struct sctp_chunkhdr chunk_hdr; |
442 | sctp_errhdr_t err_hdr; | 442 | sctp_errhdr_t err_hdr; |
443 | } sctp_operr_chunk_t; | 443 | } sctp_operr_chunk_t; |
444 | 444 | ||
445 | /* RFC 2960 3.3.10 - Operation Error | 445 | /* RFC 2960 3.3.10 - Operation Error |
@@ -528,7 +528,7 @@ typedef struct sctp_ecnehdr { | |||
528 | } sctp_ecnehdr_t; | 528 | } sctp_ecnehdr_t; |
529 | 529 | ||
530 | typedef struct sctp_ecne_chunk { | 530 | typedef struct sctp_ecne_chunk { |
531 | sctp_chunkhdr_t chunk_hdr; | 531 | struct sctp_chunkhdr chunk_hdr; |
532 | sctp_ecnehdr_t ence_hdr; | 532 | sctp_ecnehdr_t ence_hdr; |
533 | } sctp_ecne_chunk_t; | 533 | } sctp_ecne_chunk_t; |
534 | 534 | ||
@@ -540,7 +540,7 @@ typedef struct sctp_cwrhdr { | |||
540 | } sctp_cwrhdr_t; | 540 | } sctp_cwrhdr_t; |
541 | 541 | ||
542 | typedef struct sctp_cwr_chunk { | 542 | typedef struct sctp_cwr_chunk { |
543 | sctp_chunkhdr_t chunk_hdr; | 543 | struct sctp_chunkhdr chunk_hdr; |
544 | sctp_cwrhdr_t cwr_hdr; | 544 | sctp_cwrhdr_t cwr_hdr; |
545 | } sctp_cwr_chunk_t; | 545 | } sctp_cwr_chunk_t; |
546 | 546 | ||
@@ -649,7 +649,7 @@ typedef struct sctp_addiphdr { | |||
649 | } sctp_addiphdr_t; | 649 | } sctp_addiphdr_t; |
650 | 650 | ||
651 | typedef struct sctp_addip_chunk { | 651 | typedef struct sctp_addip_chunk { |
652 | sctp_chunkhdr_t chunk_hdr; | 652 | struct sctp_chunkhdr chunk_hdr; |
653 | sctp_addiphdr_t addip_hdr; | 653 | sctp_addiphdr_t addip_hdr; |
654 | } sctp_addip_chunk_t; | 654 | } sctp_addip_chunk_t; |
655 | 655 | ||
@@ -709,7 +709,7 @@ typedef struct sctp_authhdr { | |||
709 | } sctp_authhdr_t; | 709 | } sctp_authhdr_t; |
710 | 710 | ||
711 | typedef struct sctp_auth_chunk { | 711 | typedef struct sctp_auth_chunk { |
712 | sctp_chunkhdr_t chunk_hdr; | 712 | struct sctp_chunkhdr chunk_hdr; |
713 | sctp_authhdr_t auth_hdr; | 713 | sctp_authhdr_t auth_hdr; |
714 | } sctp_auth_chunk_t; | 714 | } sctp_auth_chunk_t; |
715 | 715 | ||
@@ -719,7 +719,7 @@ struct sctp_infox { | |||
719 | }; | 719 | }; |
720 | 720 | ||
721 | struct sctp_reconf_chunk { | 721 | struct sctp_reconf_chunk { |
722 | sctp_chunkhdr_t chunk_hdr; | 722 | struct sctp_chunkhdr chunk_hdr; |
723 | __u8 params[0]; | 723 | __u8 params[0]; |
724 | }; | 724 | }; |
725 | 725 | ||
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 069582ee5d7f..d756bd095683 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -478,7 +478,7 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) | |||
478 | 478 | ||
479 | #define _sctp_walk_errors(err, chunk_hdr, end)\ | 479 | #define _sctp_walk_errors(err, chunk_hdr, end)\ |
480 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ | 480 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ |
481 | sizeof(sctp_chunkhdr_t));\ | 481 | sizeof(struct sctp_chunkhdr));\ |
482 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ | 482 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ |
483 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ | 483 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ |
484 | err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length)))) | 484 | err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length)))) |
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 6f39af9fd6df..e31956b58aba 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c | |||
@@ -1037,7 +1037,7 @@ static int ip_vs_out_icmp_v6(struct netns_ipvs *ipvs, struct sk_buff *skb, | |||
1037 | */ | 1037 | */ |
1038 | static inline int is_sctp_abort(const struct sk_buff *skb, int nh_len) | 1038 | static inline int is_sctp_abort(const struct sk_buff *skb, int nh_len) |
1039 | { | 1039 | { |
1040 | sctp_chunkhdr_t *sch, schunk; | 1040 | struct sctp_chunkhdr *sch, schunk; |
1041 | sch = skb_header_pointer(skb, nh_len + sizeof(struct sctphdr), | 1041 | sch = skb_header_pointer(skb, nh_len + sizeof(struct sctphdr), |
1042 | sizeof(schunk), &schunk); | 1042 | sizeof(schunk), &schunk); |
1043 | if (sch == NULL) | 1043 | if (sch == NULL) |
@@ -1070,7 +1070,7 @@ static inline bool is_new_conn(const struct sk_buff *skb, | |||
1070 | return th->syn; | 1070 | return th->syn; |
1071 | } | 1071 | } |
1072 | case IPPROTO_SCTP: { | 1072 | case IPPROTO_SCTP: { |
1073 | sctp_chunkhdr_t *sch, schunk; | 1073 | struct sctp_chunkhdr *sch, schunk; |
1074 | 1074 | ||
1075 | sch = skb_header_pointer(skb, iph->len + sizeof(struct sctphdr), | 1075 | sch = skb_header_pointer(skb, iph->len + sizeof(struct sctphdr), |
1076 | sizeof(schunk), &schunk); | 1076 | sizeof(schunk), &schunk); |
diff --git a/net/netfilter/ipvs/ip_vs_proto_sctp.c b/net/netfilter/ipvs/ip_vs_proto_sctp.c index 6b38cadab822..3ffad4adaddf 100644 --- a/net/netfilter/ipvs/ip_vs_proto_sctp.c +++ b/net/netfilter/ipvs/ip_vs_proto_sctp.c | |||
@@ -15,7 +15,7 @@ sctp_conn_schedule(struct netns_ipvs *ipvs, int af, struct sk_buff *skb, | |||
15 | struct ip_vs_iphdr *iph) | 15 | struct ip_vs_iphdr *iph) |
16 | { | 16 | { |
17 | struct ip_vs_service *svc; | 17 | struct ip_vs_service *svc; |
18 | sctp_chunkhdr_t _schunkh, *sch; | 18 | struct sctp_chunkhdr _schunkh, *sch; |
19 | struct sctphdr *sh, _sctph; | 19 | struct sctphdr *sh, _sctph; |
20 | __be16 _ports[2], *ports = NULL; | 20 | __be16 _ports[2], *ports = NULL; |
21 | 21 | ||
@@ -377,7 +377,7 @@ static inline void | |||
377 | set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, | 377 | set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, |
378 | int direction, const struct sk_buff *skb) | 378 | int direction, const struct sk_buff *skb) |
379 | { | 379 | { |
380 | sctp_chunkhdr_t _sctpch, *sch; | 380 | struct sctp_chunkhdr _sctpch, *sch; |
381 | unsigned char chunk_type; | 381 | unsigned char chunk_type; |
382 | int event, next_state; | 382 | int event, next_state; |
383 | int ihl, cofs; | 383 | int ihl, cofs; |
@@ -409,7 +409,7 @@ set_sctp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp, | |||
409 | (sch->type == SCTP_CID_COOKIE_ACK)) { | 409 | (sch->type == SCTP_CID_COOKIE_ACK)) { |
410 | int clen = ntohs(sch->length); | 410 | int clen = ntohs(sch->length); |
411 | 411 | ||
412 | if (clen >= sizeof(sctp_chunkhdr_t)) { | 412 | if (clen >= sizeof(_sctpch)) { |
413 | sch = skb_header_pointer(skb, cofs + ALIGN(clen, 4), | 413 | sch = skb_header_pointer(skb, cofs + ALIGN(clen, 4), |
414 | sizeof(_sctpch), &_sctpch); | 414 | sizeof(_sctpch), &_sctpch); |
415 | if (sch && sch->type == SCTP_CID_ABORT) | 415 | if (sch && sch->type == SCTP_CID_ABORT) |
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c index db87af41c342..b841a8aeee7c 100644 --- a/net/netfilter/nf_conntrack_proto_sctp.c +++ b/net/netfilter/nf_conntrack_proto_sctp.c | |||
@@ -202,7 +202,7 @@ static int do_basic_checks(struct nf_conn *ct, | |||
202 | unsigned long *map) | 202 | unsigned long *map) |
203 | { | 203 | { |
204 | u_int32_t offset, count; | 204 | u_int32_t offset, count; |
205 | sctp_chunkhdr_t _sch, *sch; | 205 | struct sctp_chunkhdr _sch, *sch; |
206 | int flag; | 206 | int flag; |
207 | 207 | ||
208 | flag = 0; | 208 | flag = 0; |
@@ -397,7 +397,7 @@ static int sctp_packet(struct nf_conn *ct, | |||
397 | sch->type == SCTP_CID_INIT_ACK) { | 397 | sch->type == SCTP_CID_INIT_ACK) { |
398 | sctp_inithdr_t _inithdr, *ih; | 398 | sctp_inithdr_t _inithdr, *ih; |
399 | 399 | ||
400 | ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), | 400 | ih = skb_header_pointer(skb, offset + sizeof(_sch), |
401 | sizeof(_inithdr), &_inithdr); | 401 | sizeof(_inithdr), &_inithdr); |
402 | if (ih == NULL) | 402 | if (ih == NULL) |
403 | goto out_unlock; | 403 | goto out_unlock; |
@@ -471,23 +471,20 @@ static bool sctp_new(struct nf_conn *ct, const struct sk_buff *skb, | |||
471 | 471 | ||
472 | /* Copy the vtag into the state info */ | 472 | /* Copy the vtag into the state info */ |
473 | if (sch->type == SCTP_CID_INIT) { | 473 | if (sch->type == SCTP_CID_INIT) { |
474 | if (sh->vtag == 0) { | 474 | sctp_inithdr_t _inithdr, *ih; |
475 | sctp_inithdr_t _inithdr, *ih; | 475 | /* Sec 8.5.1 (A) */ |
476 | if (sh->vtag) | ||
477 | return false; | ||
476 | 478 | ||
477 | ih = skb_header_pointer(skb, offset + sizeof(sctp_chunkhdr_t), | 479 | ih = skb_header_pointer(skb, offset + sizeof(_sch), |
478 | sizeof(_inithdr), &_inithdr); | 480 | sizeof(_inithdr), &_inithdr); |
479 | if (ih == NULL) | 481 | if (!ih) |
480 | return false; | 482 | return false; |
481 | 483 | ||
482 | pr_debug("Setting vtag %x for new conn\n", | 484 | pr_debug("Setting vtag %x for new conn\n", |
483 | ih->init_tag); | 485 | ih->init_tag); |
484 | 486 | ||
485 | ct->proto.sctp.vtag[IP_CT_DIR_REPLY] = | 487 | ct->proto.sctp.vtag[IP_CT_DIR_REPLY] = ih->init_tag; |
486 | ih->init_tag; | ||
487 | } else { | ||
488 | /* Sec 8.5.1 (A) */ | ||
489 | return false; | ||
490 | } | ||
491 | } else if (sch->type == SCTP_CID_HEARTBEAT) { | 488 | } else if (sch->type == SCTP_CID_HEARTBEAT) { |
492 | pr_debug("Setting vtag %x for secondary conntrack\n", | 489 | pr_debug("Setting vtag %x for secondary conntrack\n", |
493 | sh->vtag); | 490 | sh->vtag); |
diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c index 0f20ea4f511e..2d2fa1d53ea6 100644 --- a/net/netfilter/xt_sctp.c +++ b/net/netfilter/xt_sctp.c | |||
@@ -42,8 +42,8 @@ match_packet(const struct sk_buff *skb, | |||
42 | bool *hotdrop) | 42 | bool *hotdrop) |
43 | { | 43 | { |
44 | u_int32_t chunkmapcopy[256 / sizeof (u_int32_t)]; | 44 | u_int32_t chunkmapcopy[256 / sizeof (u_int32_t)]; |
45 | const sctp_chunkhdr_t *sch; | 45 | const struct sctp_chunkhdr *sch; |
46 | sctp_chunkhdr_t _sch; | 46 | struct sctp_chunkhdr _sch; |
47 | int chunk_match_type = info->chunk_match_type; | 47 | int chunk_match_type = info->chunk_match_type; |
48 | const struct xt_sctp_flag_info *flag_info = info->flag_info; | 48 | const struct xt_sctp_flag_info *flag_info = info->flag_info; |
49 | int flag_count = info->flag_count; | 49 | int flag_count = info->flag_count; |
diff --git a/net/sctp/input.c b/net/sctp/input.c index ba9ad32fc447..a9994c4afc18 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c | |||
@@ -663,19 +663,19 @@ out_unlock: | |||
663 | */ | 663 | */ |
664 | static int sctp_rcv_ootb(struct sk_buff *skb) | 664 | static int sctp_rcv_ootb(struct sk_buff *skb) |
665 | { | 665 | { |
666 | sctp_chunkhdr_t *ch, _ch; | 666 | struct sctp_chunkhdr *ch, _ch; |
667 | int ch_end, offset = 0; | 667 | int ch_end, offset = 0; |
668 | 668 | ||
669 | /* Scan through all the chunks in the packet. */ | 669 | /* Scan through all the chunks in the packet. */ |
670 | do { | 670 | do { |
671 | /* Make sure we have at least the header there */ | 671 | /* Make sure we have at least the header there */ |
672 | if (offset + sizeof(sctp_chunkhdr_t) > skb->len) | 672 | if (offset + sizeof(_ch) > skb->len) |
673 | break; | 673 | break; |
674 | 674 | ||
675 | ch = skb_header_pointer(skb, offset, sizeof(*ch), &_ch); | 675 | ch = skb_header_pointer(skb, offset, sizeof(*ch), &_ch); |
676 | 676 | ||
677 | /* Break out if chunk length is less then minimal. */ | 677 | /* Break out if chunk length is less then minimal. */ |
678 | if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) | 678 | if (ntohs(ch->length) < sizeof(_ch)) |
679 | break; | 679 | break; |
680 | 680 | ||
681 | ch_end = offset + SCTP_PAD4(ntohs(ch->length)); | 681 | ch_end = offset + SCTP_PAD4(ntohs(ch->length)); |
@@ -1106,7 +1106,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net, | |||
1106 | */ | 1106 | */ |
1107 | static struct sctp_association *__sctp_rcv_asconf_lookup( | 1107 | static struct sctp_association *__sctp_rcv_asconf_lookup( |
1108 | struct net *net, | 1108 | struct net *net, |
1109 | sctp_chunkhdr_t *ch, | 1109 | struct sctp_chunkhdr *ch, |
1110 | const union sctp_addr *laddr, | 1110 | const union sctp_addr *laddr, |
1111 | __be16 peer_port, | 1111 | __be16 peer_port, |
1112 | struct sctp_transport **transportp) | 1112 | struct sctp_transport **transportp) |
@@ -1144,7 +1144,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, | |||
1144 | struct sctp_transport **transportp) | 1144 | struct sctp_transport **transportp) |
1145 | { | 1145 | { |
1146 | struct sctp_association *asoc = NULL; | 1146 | struct sctp_association *asoc = NULL; |
1147 | sctp_chunkhdr_t *ch; | 1147 | struct sctp_chunkhdr *ch; |
1148 | int have_auth = 0; | 1148 | int have_auth = 0; |
1149 | unsigned int chunk_num = 1; | 1149 | unsigned int chunk_num = 1; |
1150 | __u8 *ch_end; | 1150 | __u8 *ch_end; |
@@ -1152,10 +1152,10 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, | |||
1152 | /* Walk through the chunks looking for AUTH or ASCONF chunks | 1152 | /* Walk through the chunks looking for AUTH or ASCONF chunks |
1153 | * to help us find the association. | 1153 | * to help us find the association. |
1154 | */ | 1154 | */ |
1155 | ch = (sctp_chunkhdr_t *) skb->data; | 1155 | ch = (struct sctp_chunkhdr *)skb->data; |
1156 | do { | 1156 | do { |
1157 | /* Break out if chunk length is less then minimal. */ | 1157 | /* Break out if chunk length is less then minimal. */ |
1158 | if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) | 1158 | if (ntohs(ch->length) < sizeof(*ch)) |
1159 | break; | 1159 | break; |
1160 | 1160 | ||
1161 | ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length)); | 1161 | ch_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length)); |
@@ -1192,7 +1192,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, | |||
1192 | if (asoc) | 1192 | if (asoc) |
1193 | break; | 1193 | break; |
1194 | 1194 | ||
1195 | ch = (sctp_chunkhdr_t *) ch_end; | 1195 | ch = (struct sctp_chunkhdr *)ch_end; |
1196 | chunk_num++; | 1196 | chunk_num++; |
1197 | } while (ch_end < skb_tail_pointer(skb)); | 1197 | } while (ch_end < skb_tail_pointer(skb)); |
1198 | 1198 | ||
@@ -1210,7 +1210,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net, | |||
1210 | const union sctp_addr *laddr, | 1210 | const union sctp_addr *laddr, |
1211 | struct sctp_transport **transportp) | 1211 | struct sctp_transport **transportp) |
1212 | { | 1212 | { |
1213 | sctp_chunkhdr_t *ch; | 1213 | struct sctp_chunkhdr *ch; |
1214 | 1214 | ||
1215 | /* We do not allow GSO frames here as we need to linearize and | 1215 | /* We do not allow GSO frames here as we need to linearize and |
1216 | * then cannot guarantee frame boundaries. This shouldn't be an | 1216 | * then cannot guarantee frame boundaries. This shouldn't be an |
@@ -1220,7 +1220,7 @@ static struct sctp_association *__sctp_rcv_lookup_harder(struct net *net, | |||
1220 | if ((skb_shinfo(skb)->gso_type & SKB_GSO_SCTP) == SKB_GSO_SCTP) | 1220 | if ((skb_shinfo(skb)->gso_type & SKB_GSO_SCTP) == SKB_GSO_SCTP) |
1221 | return NULL; | 1221 | return NULL; |
1222 | 1222 | ||
1223 | ch = (sctp_chunkhdr_t *) skb->data; | 1223 | ch = (struct sctp_chunkhdr *)skb->data; |
1224 | 1224 | ||
1225 | /* The code below will attempt to walk the chunk and extract | 1225 | /* The code below will attempt to walk the chunk and extract |
1226 | * parameter information. Before we do that, we need to verify | 1226 | * parameter information. Before we do that, we need to verify |
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c index f731de3e8428..48392552ee7c 100644 --- a/net/sctp/inqueue.c +++ b/net/sctp/inqueue.c | |||
@@ -99,7 +99,7 @@ void sctp_inq_push(struct sctp_inq *q, struct sctp_chunk *chunk) | |||
99 | struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue) | 99 | struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue) |
100 | { | 100 | { |
101 | struct sctp_chunk *chunk; | 101 | struct sctp_chunk *chunk; |
102 | sctp_chunkhdr_t *ch = NULL; | 102 | struct sctp_chunkhdr *ch = NULL; |
103 | 103 | ||
104 | chunk = queue->in_progress; | 104 | chunk = queue->in_progress; |
105 | /* If there is no more chunks in this packet, say so */ | 105 | /* If there is no more chunks in this packet, say so */ |
@@ -108,7 +108,7 @@ struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue) | |||
108 | chunk->pdiscard) | 108 | chunk->pdiscard) |
109 | return NULL; | 109 | return NULL; |
110 | 110 | ||
111 | ch = (sctp_chunkhdr_t *)chunk->chunk_end; | 111 | ch = (struct sctp_chunkhdr *)chunk->chunk_end; |
112 | 112 | ||
113 | return ch; | 113 | return ch; |
114 | } | 114 | } |
@@ -122,7 +122,7 @@ struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *queue) | |||
122 | struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) | 122 | struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) |
123 | { | 123 | { |
124 | struct sctp_chunk *chunk; | 124 | struct sctp_chunk *chunk; |
125 | sctp_chunkhdr_t *ch = NULL; | 125 | struct sctp_chunkhdr *ch = NULL; |
126 | 126 | ||
127 | /* The assumption is that we are safe to process the chunks | 127 | /* The assumption is that we are safe to process the chunks |
128 | * at this time. | 128 | * at this time. |
@@ -151,7 +151,7 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) | |||
151 | chunk = queue->in_progress = NULL; | 151 | chunk = queue->in_progress = NULL; |
152 | } else { | 152 | } else { |
153 | /* Nothing to do. Next chunk in the packet, please. */ | 153 | /* Nothing to do. Next chunk in the packet, please. */ |
154 | ch = (sctp_chunkhdr_t *) chunk->chunk_end; | 154 | ch = (struct sctp_chunkhdr *)chunk->chunk_end; |
155 | /* Force chunk->skb->data to chunk->chunk_end. */ | 155 | /* Force chunk->skb->data to chunk->chunk_end. */ |
156 | skb_pull(chunk->skb, chunk->chunk_end - chunk->skb->data); | 156 | skb_pull(chunk->skb, chunk->chunk_end - chunk->skb->data); |
157 | /* We are guaranteed to pull a SCTP header. */ | 157 | /* We are guaranteed to pull a SCTP header. */ |
@@ -195,7 +195,7 @@ next_chunk: | |||
195 | 195 | ||
196 | new_skb: | 196 | new_skb: |
197 | /* This is the first chunk in the packet. */ | 197 | /* This is the first chunk in the packet. */ |
198 | ch = (sctp_chunkhdr_t *) chunk->skb->data; | 198 | ch = (struct sctp_chunkhdr *)chunk->skb->data; |
199 | chunk->singleton = 1; | 199 | chunk->singleton = 1; |
200 | chunk->data_accepted = 0; | 200 | chunk->data_accepted = 0; |
201 | chunk->pdiscard = 0; | 201 | chunk->pdiscard = 0; |
@@ -214,11 +214,10 @@ new_skb: | |||
214 | 214 | ||
215 | chunk->chunk_hdr = ch; | 215 | chunk->chunk_hdr = ch; |
216 | chunk->chunk_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length)); | 216 | chunk->chunk_end = ((__u8 *)ch) + SCTP_PAD4(ntohs(ch->length)); |
217 | skb_pull(chunk->skb, sizeof(sctp_chunkhdr_t)); | 217 | skb_pull(chunk->skb, sizeof(*ch)); |
218 | chunk->subh.v = NULL; /* Subheader is no longer valid. */ | 218 | chunk->subh.v = NULL; /* Subheader is no longer valid. */ |
219 | 219 | ||
220 | if (chunk->chunk_end + sizeof(sctp_chunkhdr_t) < | 220 | if (chunk->chunk_end + sizeof(*ch) < skb_tail_pointer(chunk->skb)) { |
221 | skb_tail_pointer(chunk->skb)) { | ||
222 | /* This is not a singleton */ | 221 | /* This is not a singleton */ |
223 | chunk->singleton = 0; | 222 | chunk->singleton = 0; |
224 | } else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) { | 223 | } else if (chunk->chunk_end > skb_tail_pointer(chunk->skb)) { |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 4b1967997c16..7d4c5a870f0e 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1379,20 +1379,20 @@ static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc, | |||
1379 | gfp_t gfp) | 1379 | gfp_t gfp) |
1380 | { | 1380 | { |
1381 | struct sctp_chunk *retval; | 1381 | struct sctp_chunk *retval; |
1382 | sctp_chunkhdr_t *chunk_hdr; | 1382 | struct sctp_chunkhdr *chunk_hdr; |
1383 | struct sk_buff *skb; | 1383 | struct sk_buff *skb; |
1384 | struct sock *sk; | 1384 | struct sock *sk; |
1385 | 1385 | ||
1386 | /* No need to allocate LL here, as this is only a chunk. */ | 1386 | /* No need to allocate LL here, as this is only a chunk. */ |
1387 | skb = alloc_skb(SCTP_PAD4(sizeof(sctp_chunkhdr_t) + paylen), gfp); | 1387 | skb = alloc_skb(SCTP_PAD4(sizeof(*chunk_hdr) + paylen), gfp); |
1388 | if (!skb) | 1388 | if (!skb) |
1389 | goto nodata; | 1389 | goto nodata; |
1390 | 1390 | ||
1391 | /* Make room for the chunk header. */ | 1391 | /* Make room for the chunk header. */ |
1392 | chunk_hdr = skb_put(skb, sizeof(sctp_chunkhdr_t)); | 1392 | chunk_hdr = (struct sctp_chunkhdr *)skb_put(skb, sizeof(*chunk_hdr)); |
1393 | chunk_hdr->type = type; | 1393 | chunk_hdr->type = type; |
1394 | chunk_hdr->flags = flags; | 1394 | chunk_hdr->flags = flags; |
1395 | chunk_hdr->length = htons(sizeof(sctp_chunkhdr_t)); | 1395 | chunk_hdr->length = htons(sizeof(*chunk_hdr)); |
1396 | 1396 | ||
1397 | sk = asoc ? asoc->base.sk : NULL; | 1397 | sk = asoc ? asoc->base.sk : NULL; |
1398 | retval = sctp_chunkify(skb, asoc, sk, gfp); | 1398 | retval = sctp_chunkify(skb, asoc, sk, gfp); |
@@ -1402,7 +1402,7 @@ static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc, | |||
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | retval->chunk_hdr = chunk_hdr; | 1404 | retval->chunk_hdr = chunk_hdr; |
1405 | retval->chunk_end = ((__u8 *)chunk_hdr) + sizeof(struct sctp_chunkhdr); | 1405 | retval->chunk_end = ((__u8 *)chunk_hdr) + sizeof(*chunk_hdr); |
1406 | 1406 | ||
1407 | /* Determine if the chunk needs to be authenticated */ | 1407 | /* Determine if the chunk needs to be authenticated */ |
1408 | if (sctp_auth_send_cid(type, asoc)) | 1408 | if (sctp_auth_send_cid(type, asoc)) |
@@ -1710,7 +1710,7 @@ struct sctp_association *sctp_unpack_cookie( | |||
1710 | /* Header size is static data prior to the actual cookie, including | 1710 | /* Header size is static data prior to the actual cookie, including |
1711 | * any padding. | 1711 | * any padding. |
1712 | */ | 1712 | */ |
1713 | headersize = sizeof(sctp_chunkhdr_t) + | 1713 | headersize = sizeof(struct sctp_chunkhdr) + |
1714 | (sizeof(struct sctp_signed_cookie) - | 1714 | (sizeof(struct sctp_signed_cookie) - |
1715 | sizeof(struct sctp_cookie)); | 1715 | sizeof(struct sctp_cookie)); |
1716 | bodysize = ntohs(chunk->chunk_hdr->length) - headersize; | 1716 | bodysize = ntohs(chunk->chunk_hdr->length) - headersize; |
@@ -3218,7 +3218,8 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, | |||
3218 | int chunk_len; | 3218 | int chunk_len; |
3219 | __u32 serial; | 3219 | __u32 serial; |
3220 | 3220 | ||
3221 | chunk_len = ntohs(asconf->chunk_hdr->length) - sizeof(sctp_chunkhdr_t); | 3221 | chunk_len = ntohs(asconf->chunk_hdr->length) - |
3222 | sizeof(struct sctp_chunkhdr); | ||
3222 | hdr = (sctp_addiphdr_t *)asconf->skb->data; | 3223 | hdr = (sctp_addiphdr_t *)asconf->skb->data; |
3223 | serial = ntohl(hdr->serial); | 3224 | serial = ntohl(hdr->serial); |
3224 | 3225 | ||
@@ -3364,7 +3365,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack, | |||
3364 | err_code = SCTP_ERROR_REQ_REFUSED; | 3365 | err_code = SCTP_ERROR_REQ_REFUSED; |
3365 | 3366 | ||
3366 | asconf_ack_len = ntohs(asconf_ack->chunk_hdr->length) - | 3367 | asconf_ack_len = ntohs(asconf_ack->chunk_hdr->length) - |
3367 | sizeof(sctp_chunkhdr_t); | 3368 | sizeof(struct sctp_chunkhdr); |
3368 | 3369 | ||
3369 | /* Skip the addiphdr from the asconf_ack chunk and store a pointer to | 3370 | /* Skip the addiphdr from the asconf_ack chunk and store a pointer to |
3370 | * the first asconf_ack parameter. | 3371 | * the first asconf_ack parameter. |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index dfe1fcb520ba..b255339f22a3 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -955,9 +955,10 @@ static void sctp_cmd_process_operr(sctp_cmd_seq_t *cmds, | |||
955 | switch (err_hdr->cause) { | 955 | switch (err_hdr->cause) { |
956 | case SCTP_ERROR_UNKNOWN_CHUNK: | 956 | case SCTP_ERROR_UNKNOWN_CHUNK: |
957 | { | 957 | { |
958 | sctp_chunkhdr_t *unk_chunk_hdr; | 958 | struct sctp_chunkhdr *unk_chunk_hdr; |
959 | 959 | ||
960 | unk_chunk_hdr = (sctp_chunkhdr_t *)err_hdr->variable; | 960 | unk_chunk_hdr = (struct sctp_chunkhdr *) |
961 | err_hdr->variable; | ||
961 | switch (unk_chunk_hdr->type) { | 962 | switch (unk_chunk_hdr->type) { |
962 | /* ADDIP 4.1 A9) If the peer responds to an ASCONF with | 963 | /* ADDIP 4.1 A9) If the peer responds to an ASCONF with |
963 | * an ERROR chunk reporting that it did not recognized | 964 | * an ERROR chunk reporting that it did not recognized |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 8feff96a5bef..2b7c07f19b08 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -235,7 +235,7 @@ sctp_disposition_t sctp_sf_do_4_C(struct net *net, | |||
235 | return sctp_sf_violation_chunk(net, ep, asoc, type, arg, commands); | 235 | return sctp_sf_violation_chunk(net, ep, asoc, type, arg, commands); |
236 | 236 | ||
237 | /* Make sure that the SHUTDOWN_COMPLETE chunk has a valid length. */ | 237 | /* Make sure that the SHUTDOWN_COMPLETE chunk has a valid length. */ |
238 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | 238 | if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) |
239 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | 239 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, |
240 | commands); | 240 | commands); |
241 | 241 | ||
@@ -368,9 +368,9 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net, | |||
368 | if (err_chunk) { | 368 | if (err_chunk) { |
369 | packet = sctp_abort_pkt_new(net, ep, asoc, arg, | 369 | packet = sctp_abort_pkt_new(net, ep, asoc, arg, |
370 | (__u8 *)(err_chunk->chunk_hdr) + | 370 | (__u8 *)(err_chunk->chunk_hdr) + |
371 | sizeof(sctp_chunkhdr_t), | 371 | sizeof(struct sctp_chunkhdr), |
372 | ntohs(err_chunk->chunk_hdr->length) - | 372 | ntohs(err_chunk->chunk_hdr->length) - |
373 | sizeof(sctp_chunkhdr_t)); | 373 | sizeof(struct sctp_chunkhdr)); |
374 | 374 | ||
375 | sctp_chunk_free(err_chunk); | 375 | sctp_chunk_free(err_chunk); |
376 | 376 | ||
@@ -417,7 +417,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net, | |||
417 | len = 0; | 417 | len = 0; |
418 | if (err_chunk) | 418 | if (err_chunk) |
419 | len = ntohs(err_chunk->chunk_hdr->length) - | 419 | len = ntohs(err_chunk->chunk_hdr->length) - |
420 | sizeof(sctp_chunkhdr_t); | 420 | sizeof(struct sctp_chunkhdr); |
421 | 421 | ||
422 | repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); | 422 | repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); |
423 | if (!repl) | 423 | if (!repl) |
@@ -437,7 +437,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net, | |||
437 | */ | 437 | */ |
438 | unk_param = (sctp_unrecognized_param_t *) | 438 | unk_param = (sctp_unrecognized_param_t *) |
439 | ((__u8 *)(err_chunk->chunk_hdr) + | 439 | ((__u8 *)(err_chunk->chunk_hdr) + |
440 | sizeof(sctp_chunkhdr_t)); | 440 | sizeof(struct sctp_chunkhdr)); |
441 | /* Replace the cause code with the "Unrecognized parameter" | 441 | /* Replace the cause code with the "Unrecognized parameter" |
442 | * parameter type. | 442 | * parameter type. |
443 | */ | 443 | */ |
@@ -540,9 +540,9 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(struct net *net, | |||
540 | if (err_chunk) { | 540 | if (err_chunk) { |
541 | packet = sctp_abort_pkt_new(net, ep, asoc, arg, | 541 | packet = sctp_abort_pkt_new(net, ep, asoc, arg, |
542 | (__u8 *)(err_chunk->chunk_hdr) + | 542 | (__u8 *)(err_chunk->chunk_hdr) + |
543 | sizeof(sctp_chunkhdr_t), | 543 | sizeof(struct sctp_chunkhdr), |
544 | ntohs(err_chunk->chunk_hdr->length) - | 544 | ntohs(err_chunk->chunk_hdr->length) - |
545 | sizeof(sctp_chunkhdr_t)); | 545 | sizeof(struct sctp_chunkhdr)); |
546 | 546 | ||
547 | sctp_chunk_free(err_chunk); | 547 | sctp_chunk_free(err_chunk); |
548 | 548 | ||
@@ -673,7 +673,7 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net, | |||
673 | * chunk header. More detailed verification is done | 673 | * chunk header. More detailed verification is done |
674 | * in sctp_unpack_cookie(). | 674 | * in sctp_unpack_cookie(). |
675 | */ | 675 | */ |
676 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | 676 | if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) |
677 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | 677 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); |
678 | 678 | ||
679 | /* If the endpoint is not listening or if the number of associations | 679 | /* If the endpoint is not listening or if the number of associations |
@@ -691,7 +691,7 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net, | |||
691 | chunk->subh.cookie_hdr = | 691 | chunk->subh.cookie_hdr = |
692 | (struct sctp_signed_cookie *)chunk->skb->data; | 692 | (struct sctp_signed_cookie *)chunk->skb->data; |
693 | if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - | 693 | if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - |
694 | sizeof(sctp_chunkhdr_t))) | 694 | sizeof(struct sctp_chunkhdr))) |
695 | goto nomem; | 695 | goto nomem; |
696 | 696 | ||
697 | /* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint | 697 | /* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint |
@@ -770,9 +770,10 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(struct net *net, | |||
770 | auth.skb = chunk->auth_chunk; | 770 | auth.skb = chunk->auth_chunk; |
771 | auth.asoc = chunk->asoc; | 771 | auth.asoc = chunk->asoc; |
772 | auth.sctp_hdr = chunk->sctp_hdr; | 772 | auth.sctp_hdr = chunk->sctp_hdr; |
773 | auth.chunk_hdr = skb_push(chunk->auth_chunk, | 773 | auth.chunk_hdr = (struct sctp_chunkhdr *) |
774 | sizeof(sctp_chunkhdr_t)); | 774 | skb_push(chunk->auth_chunk, |
775 | skb_pull(chunk->auth_chunk, sizeof(sctp_chunkhdr_t)); | 775 | sizeof(struct sctp_chunkhdr)); |
776 | skb_pull(chunk->auth_chunk, sizeof(struct sctp_chunkhdr)); | ||
776 | auth.transport = chunk->transport; | 777 | auth.transport = chunk->transport; |
777 | 778 | ||
778 | ret = sctp_sf_authenticate(net, ep, new_asoc, type, &auth); | 779 | ret = sctp_sf_authenticate(net, ep, new_asoc, type, &auth); |
@@ -886,7 +887,7 @@ sctp_disposition_t sctp_sf_do_5_1E_ca(struct net *net, | |||
886 | /* Verify that the chunk length for the COOKIE-ACK is OK. | 887 | /* Verify that the chunk length for the COOKIE-ACK is OK. |
887 | * If we don't do this, any bundled chunks may be junked. | 888 | * If we don't do this, any bundled chunks may be junked. |
888 | */ | 889 | */ |
889 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | 890 | if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) |
890 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | 891 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, |
891 | commands); | 892 | commands); |
892 | 893 | ||
@@ -1099,7 +1100,7 @@ sctp_disposition_t sctp_sf_beat_8_3(struct net *net, | |||
1099 | */ | 1100 | */ |
1100 | chunk->subh.hb_hdr = (sctp_heartbeathdr_t *) chunk->skb->data; | 1101 | chunk->subh.hb_hdr = (sctp_heartbeathdr_t *) chunk->skb->data; |
1101 | param_hdr = (sctp_paramhdr_t *) chunk->subh.hb_hdr; | 1102 | param_hdr = (sctp_paramhdr_t *) chunk->subh.hb_hdr; |
1102 | paylen = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t); | 1103 | paylen = ntohs(chunk->chunk_hdr->length) - sizeof(struct sctp_chunkhdr); |
1103 | 1104 | ||
1104 | if (ntohs(param_hdr->length) > paylen) | 1105 | if (ntohs(param_hdr->length) > paylen) |
1105 | return sctp_sf_violation_paramlen(net, ep, asoc, type, arg, | 1106 | return sctp_sf_violation_paramlen(net, ep, asoc, type, arg, |
@@ -1164,7 +1165,7 @@ sctp_disposition_t sctp_sf_backbeat_8_3(struct net *net, | |||
1164 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | 1165 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); |
1165 | 1166 | ||
1166 | /* Make sure that the HEARTBEAT-ACK chunk has a valid length. */ | 1167 | /* Make sure that the HEARTBEAT-ACK chunk has a valid length. */ |
1167 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t) + | 1168 | if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr) + |
1168 | sizeof(sctp_sender_hb_info_t))) | 1169 | sizeof(sctp_sender_hb_info_t))) |
1169 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | 1170 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, |
1170 | commands); | 1171 | commands); |
@@ -1469,9 +1470,9 @@ static sctp_disposition_t sctp_sf_do_unexpected_init( | |||
1469 | if (err_chunk) { | 1470 | if (err_chunk) { |
1470 | packet = sctp_abort_pkt_new(net, ep, asoc, arg, | 1471 | packet = sctp_abort_pkt_new(net, ep, asoc, arg, |
1471 | (__u8 *)(err_chunk->chunk_hdr) + | 1472 | (__u8 *)(err_chunk->chunk_hdr) + |
1472 | sizeof(sctp_chunkhdr_t), | 1473 | sizeof(struct sctp_chunkhdr), |
1473 | ntohs(err_chunk->chunk_hdr->length) - | 1474 | ntohs(err_chunk->chunk_hdr->length) - |
1474 | sizeof(sctp_chunkhdr_t)); | 1475 | sizeof(struct sctp_chunkhdr)); |
1475 | 1476 | ||
1476 | if (packet) { | 1477 | if (packet) { |
1477 | sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, | 1478 | sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, |
@@ -1535,7 +1536,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init( | |||
1535 | len = 0; | 1536 | len = 0; |
1536 | if (err_chunk) { | 1537 | if (err_chunk) { |
1537 | len = ntohs(err_chunk->chunk_hdr->length) - | 1538 | len = ntohs(err_chunk->chunk_hdr->length) - |
1538 | sizeof(sctp_chunkhdr_t); | 1539 | sizeof(struct sctp_chunkhdr); |
1539 | } | 1540 | } |
1540 | 1541 | ||
1541 | repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); | 1542 | repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); |
@@ -1556,7 +1557,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init( | |||
1556 | */ | 1557 | */ |
1557 | unk_param = (sctp_unrecognized_param_t *) | 1558 | unk_param = (sctp_unrecognized_param_t *) |
1558 | ((__u8 *)(err_chunk->chunk_hdr) + | 1559 | ((__u8 *)(err_chunk->chunk_hdr) + |
1559 | sizeof(sctp_chunkhdr_t)); | 1560 | sizeof(struct sctp_chunkhdr)); |
1560 | /* Replace the cause code with the "Unrecognized parameter" | 1561 | /* Replace the cause code with the "Unrecognized parameter" |
1561 | * parameter type. | 1562 | * parameter type. |
1562 | */ | 1563 | */ |
@@ -2044,7 +2045,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(struct net *net, | |||
2044 | * enough for the chunk header. Cookie length verification is | 2045 | * enough for the chunk header. Cookie length verification is |
2045 | * done later. | 2046 | * done later. |
2046 | */ | 2047 | */ |
2047 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | 2048 | if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) |
2048 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | 2049 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, |
2049 | commands); | 2050 | commands); |
2050 | 2051 | ||
@@ -2053,7 +2054,7 @@ sctp_disposition_t sctp_sf_do_5_2_4_dupcook(struct net *net, | |||
2053 | */ | 2054 | */ |
2054 | chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; | 2055 | chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; |
2055 | if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - | 2056 | if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - |
2056 | sizeof(sctp_chunkhdr_t))) | 2057 | sizeof(struct sctp_chunkhdr))) |
2057 | goto nomem; | 2058 | goto nomem; |
2058 | 2059 | ||
2059 | /* In RFC 2960 5.2.4 3, if both Verification Tags in the State Cookie | 2060 | /* In RFC 2960 5.2.4 3, if both Verification Tags in the State Cookie |
@@ -2806,7 +2807,7 @@ sctp_disposition_t sctp_sf_do_9_2_reshutack(struct net *net, | |||
2806 | struct sctp_chunk *reply; | 2807 | struct sctp_chunk *reply; |
2807 | 2808 | ||
2808 | /* Make sure that the chunk has a valid length */ | 2809 | /* Make sure that the chunk has a valid length */ |
2809 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | 2810 | if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) |
2810 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | 2811 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, |
2811 | commands); | 2812 | commands); |
2812 | 2813 | ||
@@ -3358,7 +3359,7 @@ sctp_disposition_t sctp_sf_do_9_2_final(struct net *net, | |||
3358 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | 3359 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); |
3359 | 3360 | ||
3360 | /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */ | 3361 | /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */ |
3361 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | 3362 | if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) |
3362 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | 3363 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, |
3363 | commands); | 3364 | commands); |
3364 | /* 10.2 H) SHUTDOWN COMPLETE notification | 3365 | /* 10.2 H) SHUTDOWN COMPLETE notification |
@@ -3435,7 +3436,7 @@ sctp_disposition_t sctp_sf_ootb(struct net *net, | |||
3435 | { | 3436 | { |
3436 | struct sctp_chunk *chunk = arg; | 3437 | struct sctp_chunk *chunk = arg; |
3437 | struct sk_buff *skb = chunk->skb; | 3438 | struct sk_buff *skb = chunk->skb; |
3438 | sctp_chunkhdr_t *ch; | 3439 | struct sctp_chunkhdr *ch; |
3439 | sctp_errhdr_t *err; | 3440 | sctp_errhdr_t *err; |
3440 | __u8 *ch_end; | 3441 | __u8 *ch_end; |
3441 | int ootb_shut_ack = 0; | 3442 | int ootb_shut_ack = 0; |
@@ -3443,10 +3444,10 @@ sctp_disposition_t sctp_sf_ootb(struct net *net, | |||
3443 | 3444 | ||
3444 | SCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES); | 3445 | SCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES); |
3445 | 3446 | ||
3446 | ch = (sctp_chunkhdr_t *) chunk->chunk_hdr; | 3447 | ch = (struct sctp_chunkhdr *)chunk->chunk_hdr; |
3447 | do { | 3448 | do { |
3448 | /* Report violation if the chunk is less then minimal */ | 3449 | /* Report violation if the chunk is less then minimal */ |
3449 | if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) | 3450 | if (ntohs(ch->length) < sizeof(*ch)) |
3450 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | 3451 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, |
3451 | commands); | 3452 | commands); |
3452 | 3453 | ||
@@ -3487,7 +3488,7 @@ sctp_disposition_t sctp_sf_ootb(struct net *net, | |||
3487 | } | 3488 | } |
3488 | } | 3489 | } |
3489 | 3490 | ||
3490 | ch = (sctp_chunkhdr_t *) ch_end; | 3491 | ch = (struct sctp_chunkhdr *)ch_end; |
3491 | } while (ch_end < skb_tail_pointer(skb)); | 3492 | } while (ch_end < skb_tail_pointer(skb)); |
3492 | 3493 | ||
3493 | if (ootb_shut_ack) | 3494 | if (ootb_shut_ack) |
@@ -3560,7 +3561,7 @@ static sctp_disposition_t sctp_sf_shut_8_4_5(struct net *net, | |||
3560 | /* If the chunk length is invalid, we don't want to process | 3561 | /* If the chunk length is invalid, we don't want to process |
3561 | * the reset of the packet. | 3562 | * the reset of the packet. |
3562 | */ | 3563 | */ |
3563 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | 3564 | if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) |
3564 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | 3565 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); |
3565 | 3566 | ||
3566 | /* We need to discard the rest of the packet to prevent | 3567 | /* We need to discard the rest of the packet to prevent |
@@ -3591,7 +3592,7 @@ sctp_disposition_t sctp_sf_do_8_5_1_E_sa(struct net *net, | |||
3591 | struct sctp_chunk *chunk = arg; | 3592 | struct sctp_chunk *chunk = arg; |
3592 | 3593 | ||
3593 | /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */ | 3594 | /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */ |
3594 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | 3595 | if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) |
3595 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | 3596 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, |
3596 | commands); | 3597 | commands); |
3597 | 3598 | ||
@@ -4256,7 +4257,7 @@ sctp_disposition_t sctp_sf_unk_chunk(struct net *net, | |||
4256 | { | 4257 | { |
4257 | struct sctp_chunk *unk_chunk = arg; | 4258 | struct sctp_chunk *unk_chunk = arg; |
4258 | struct sctp_chunk *err_chunk; | 4259 | struct sctp_chunk *err_chunk; |
4259 | sctp_chunkhdr_t *hdr; | 4260 | struct sctp_chunkhdr *hdr; |
4260 | 4261 | ||
4261 | pr_debug("%s: processing unknown chunk id:%d\n", __func__, type.chunk); | 4262 | pr_debug("%s: processing unknown chunk id:%d\n", __func__, type.chunk); |
4262 | 4263 | ||
@@ -4267,7 +4268,7 @@ sctp_disposition_t sctp_sf_unk_chunk(struct net *net, | |||
4267 | * Since we don't know the chunk type, we use a general | 4268 | * Since we don't know the chunk type, we use a general |
4268 | * chunkhdr structure to make a comparison. | 4269 | * chunkhdr structure to make a comparison. |
4269 | */ | 4270 | */ |
4270 | if (!sctp_chunk_length_valid(unk_chunk, sizeof(sctp_chunkhdr_t))) | 4271 | if (!sctp_chunk_length_valid(unk_chunk, sizeof(*hdr))) |
4271 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | 4272 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, |
4272 | commands); | 4273 | commands); |
4273 | 4274 | ||
@@ -4340,7 +4341,7 @@ sctp_disposition_t sctp_sf_discard_chunk(struct net *net, | |||
4340 | * Since we don't know the chunk type, we use a general | 4341 | * Since we don't know the chunk type, we use a general |
4341 | * chunkhdr structure to make a comparison. | 4342 | * chunkhdr structure to make a comparison. |
4342 | */ | 4343 | */ |
4343 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | 4344 | if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) |
4344 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | 4345 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, |
4345 | commands); | 4346 | commands); |
4346 | 4347 | ||
@@ -4405,7 +4406,7 @@ sctp_disposition_t sctp_sf_violation(struct net *net, | |||
4405 | struct sctp_chunk *chunk = arg; | 4406 | struct sctp_chunk *chunk = arg; |
4406 | 4407 | ||
4407 | /* Make sure that the chunk has a valid length. */ | 4408 | /* Make sure that the chunk has a valid length. */ |
4408 | if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) | 4409 | if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_chunkhdr))) |
4409 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, | 4410 | return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, |
4410 | commands); | 4411 | commands); |
4411 | 4412 | ||
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index 17854fb0e512..5f86c5062a98 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -158,7 +158,7 @@ struct sctp_ulpevent *sctp_ulpevent_make_assoc_change( | |||
158 | /* Trim the buffer to the right length. */ | 158 | /* Trim the buffer to the right length. */ |
159 | skb_trim(skb, sizeof(struct sctp_assoc_change) + | 159 | skb_trim(skb, sizeof(struct sctp_assoc_change) + |
160 | ntohs(chunk->chunk_hdr->length) - | 160 | ntohs(chunk->chunk_hdr->length) - |
161 | sizeof(sctp_chunkhdr_t)); | 161 | sizeof(struct sctp_chunkhdr)); |
162 | } else { | 162 | } else { |
163 | event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change), | 163 | event = sctp_ulpevent_new(sizeof(struct sctp_assoc_change), |
164 | MSG_NOTIFICATION, gfp); | 164 | MSG_NOTIFICATION, gfp); |