Message ID | 20201030132633.7045-1-oss@malat.biz |
---|---|
State | Accepted |
Delegated to: | David Miller |
Headers | show |
Series | sctp: Fix COMM_LOST/CANT_STR_ASSOC err reporting on big-endian platforms | expand |
Context | Check | Description |
---|---|---|
jkicinski/cover_letter | success | Link |
jkicinski/fixes_present | success | Link |
jkicinski/patch_count | success | Link |
jkicinski/tree_selection | success | Guessed tree name to be net-next |
jkicinski/subject_prefix | warning | Target tree name not specified in the subject |
jkicinski/source_inline | success | Was 0 now: 0 |
jkicinski/verify_signedoff | success | Link |
jkicinski/module_param | success | Was 0 now: 0 |
jkicinski/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
jkicinski/kdoc | success | Errors and warnings before: 0 this patch: 0 |
jkicinski/verify_fixes | success | Link |
jkicinski/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 14 lines checked |
jkicinski/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
jkicinski/header_inline | success | Link |
jkicinski/stable | success | Stable not CCed |
On Fri, Oct 30, 2020 at 02:26:33PM +0100, Petr Malat wrote: > Commit 978aa0474115 ("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. Makes sense. > > Signed-off-by: Petr Malat <oss@malat.biz> Then, it also needs: Fixes: 978aa0474115 ("sctp: fix some type cast warnings introduced since very beginning")' Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> (If the maintainers can't add the Fixes tag above, please keep the ack on the v2) Thanks.
On Mon, 2 Nov 2020 10:27:17 -0300 Marcelo Ricardo Leitner wrote: > On Fri, Oct 30, 2020 at 02:26:33PM +0100, Petr Malat wrote: > > Commit 978aa0474115 ("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. > > Makes sense. > > > > > Signed-off-by: Petr Malat <oss@malat.biz> > > Then, it also needs: > Fixes: 978aa0474115 ("sctp: fix some type cast warnings introduced since very beginning")' > > Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> > (If the maintainers can't add the Fixes tag above, please keep the ack > on the v2) Applied, thanks!
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index aa821e71f05e..813d30767204 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c @@ -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:
Commit 978aa0474115 ("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. Signed-off-by: Petr Malat <oss@malat.biz> --- net/sctp/sm_sideeffect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)