sctp: fix the issue that a __u16 variable may overflow in sctp_ulpq_renege
authorXin Long <lucien.xin@gmail.com>
Mon, 18 Dec 2017 06:07:25 +0000 (14:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Mar 2018 09:24:24 +0000 (10:24 +0100)
commit60f1c1f279925a5c3b68edc303c275ae50451c4b
tree170176f0206f1ba2cb583c5e0e413ef63c4c9371
parentc8b8dd735938be43afa6a2b6a9ea8c43441bcc09
sctp: fix the issue that a __u16 variable may overflow in sctp_ulpq_renege

[ Upstream commit 5c468674d17056148da06218d4da5d04baf22eac ]

Now when reneging events in sctp_ulpq_renege(), the variable freed
could be increased by a __u16 value twice while freed is of __u16
type. It means freed may overflow at the second addition.

This patch is to fix it by using __u32 type for 'freed', while at
it, also to remove 'if (chunk)' check, as all renege commands are
generated in sctp_eat_data and it can't be NULL.

Reported-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sctp/ulpqueue.c