提交 4c326b8c 编写于 作者: P Petr Malat 提交者: Yang Yingliang

sctp: Fix COMM_LOST/CANT_STR_ASSOC err reporting on big-endian platforms

stable inclusion
from linux-4.19.156
commit 64752f5cfda61aa7ca12d23ca1ecc7d36e996f93

--------------------------------

[ Upstream commit b6df8c81 ]

Commit 978aa047 ("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: 978aa047 ("sctp: fix some type cast warnings introduced since very beginning")
Signed-off-by: NPetr Malat <oss@malat.biz>
Acked-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Link: https://lore.kernel.org/r/20201030132633.7045-1-oss@malat.bizSigned-off-by: NJakub Kicinski <kuba@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NAichun Li <liaichun@huawei.com>
Reviewed-by: Nwangxiaopeng <wangxiaopeng7@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 5248e957
...@@ -1615,12 +1615,12 @@ static int sctp_cmd_interpreter(enum sctp_event event_type, ...@@ -1615,12 +1615,12 @@ static int sctp_cmd_interpreter(enum sctp_event event_type,
break; break;
case SCTP_CMD_INIT_FAILED: case SCTP_CMD_INIT_FAILED:
sctp_cmd_init_failed(commands, asoc, cmd->obj.u32); sctp_cmd_init_failed(commands, asoc, cmd->obj.u16);
break; break;
case SCTP_CMD_ASSOC_FAILED: case SCTP_CMD_ASSOC_FAILED:
sctp_cmd_assoc_failed(commands, asoc, event_type, sctp_cmd_assoc_failed(commands, asoc, event_type,
subtype, chunk, cmd->obj.u32); subtype, chunk, cmd->obj.u16);
break; break;
case SCTP_CMD_INIT_COUNTER_INC: case SCTP_CMD_INIT_COUNTER_INC:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册