Skip to content

Commit c2cc187

Browse files
Dan Carpenterdavem330
authored andcommitted
sctp: Fix a big endian bug in sctp_diag_dump()
The sctp_for_each_transport() function takes an pointer to int. The cb->args[] array holds longs so it's only using the high 32 bits. It works on little endian system but will break on big endian 64 bit machines. Fixes: d25adbe ("sctp: fix an use-after-free issue in sctp_sock_dump") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Neil Horman <[email protected]> Reviewed-by: Xin Long <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 20c62c7 commit c2cc187

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/sctp/sctp_diag.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ static void sctp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
463463
.r = r,
464464
.net_admin = netlink_net_capable(cb->skb, CAP_NET_ADMIN),
465465
};
466+
int pos = cb->args[2];
466467

467468
/* eps hashtable dumps
468469
* args:
@@ -493,7 +494,8 @@ static void sctp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
493494
goto done;
494495

495496
sctp_for_each_transport(sctp_sock_filter, sctp_sock_dump,
496-
net, (int *)&cb->args[2], &commp);
497+
net, &pos, &commp);
498+
cb->args[2] = pos;
497499

498500
done:
499501
cb->args[1] = cb->args[4];

0 commit comments

Comments
 (0)