Skip to content

Commit

Permalink
sctp: Fix COMM_LOST/CANT_STR_ASSOC err reporting on big-endian platforms
Browse files Browse the repository at this point in the history
Commit 978aa04 ("sctp: fix some type cast warnings introduced since
very beginning")' broke err reading from sctp_arg, because it reads the
value as 32-bit integer, although the value is stored as 16-bit integer.
Later this value is passed to the userspace in 16-bit variable, thus the
user always gets 0 on big-endian platforms. Fix it by reading the __u16
field of sctp_arg union, as reading err field would produce a sparse
warning.

Fixes: 978aa04 ("sctp: fix some type cast warnings introduced since very beginning")
Signed-off-by: Petr Malat <[email protected]>
Acked-by: Marcelo Ricardo Leitner <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
petris authored and kuba-moo committed Nov 2, 2020
1 parent 0a26ba0 commit b6df8c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/sctp/sm_sideeffect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1601,12 +1601,12 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type,
break;

case SCTP_CMD_INIT_FAILED:
sctp_cmd_init_failed(commands, asoc, cmd->obj.u32);
sctp_cmd_init_failed(commands, asoc, cmd->obj.u16);
break;

case SCTP_CMD_ASSOC_FAILED:
sctp_cmd_assoc_failed(commands, asoc, event_type,
subtype, chunk, cmd->obj.u32);
subtype, chunk, cmd->obj.u16);
break;

case SCTP_CMD_INIT_COUNTER_INC:
Expand Down

0 comments on commit b6df8c8

Please sign in to comment.