summaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorPetr Malat <oss@malat.biz>2020-10-30 14:26:33 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-11-10 12:35:54 +0100
commit64752f5cfda61aa7ca12d23ca1ecc7d36e996f93 (patch)
treef7daf90b2e271b29a858103d0ffe23f278fbeaf3 /net/sctp
parent1a9118379cc7b66bfd2ac030da4af3a712a9e9e2 (diff)
downloadlinux-stable-64752f5cfda61aa7ca12d23ca1ecc7d36e996f93.tar.gz
linux-stable-64752f5cfda61aa7ca12d23ca1ecc7d36e996f93.tar.bz2
linux-stable-64752f5cfda61aa7ca12d23ca1ecc7d36e996f93.zip
sctp: Fix COMM_LOST/CANT_STR_ASSOC err reporting on big-endian platforms
[ Upstream commit b6df8c81412190fbd5eaa3cec7f642142d9c16cd ] 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. Fixes: 978aa0474115 ("sctp: fix some type cast warnings introduced since very beginning") Signed-off-by: Petr Malat <oss@malat.biz> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Link: https://lore.kernel.org/r/20201030132633.7045-1-oss@malat.biz Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/sm_sideeffect.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 567517e44811..bb4f1d0da153 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -1615,12 +1615,12 @@ static int sctp_cmd_interpreter(enum sctp_event 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: