Skip to contentSkip to conversation

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

PATCH Applied Petr Malat 3 participants 3 messages Oct 30, 2020 – Nov 2, 2020

Subsystems (3)
lore
Share & tools
lore

Petr Malat

author
#0 lore raw

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

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.

---
 net/sctp/sm_sideeffect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/sctp/sm_sideeffect.c +2 -2
index aa821e71f05e..813d30767204 100644
@@ -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:
Signature · 1 line
2.20.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Petr Malat

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.

Quoted 2 lines

Then, it also needs:

Fixes 978aa0474115 ("sctp: fix some type cast warnings introduced since very beginning")'

(If the maintainers can't add the Fixes tag above, please keep the ack on the v2)

Thanks.

maintainer Applied
#2 lore raw
Quoted 12 lines · On Mon, 2 Nov 2020 10:27:17 -0300 Marcelo Ricardo Leitner wrote:
Quoted 7 lines · Petr Malat

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.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Then, it also needs:

Fixes 978aa0474115 ("sctp: fix some type cast warnings introduced since very beginning")'

(If the maintainers can't add the Fixes tag above, please keep the ack on the v2)

Applied, thanks!