]> git.baikalelectronics.ru Git - kernel.git/commit
sctp: check policy more carefully when getting pr status
authorXin Long <lucien.xin@gmail.com>
Mon, 29 Oct 2018 15:13:11 +0000 (23:13 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 30 Oct 2018 03:50:41 +0000 (20:50 -0700)
commitc199332d7156755a4fb10ccafdd1a93803b624e2
tree6c8de4c6dba99bc5b78eefa807eb047cff2505ff
parenteec13d2a752ec6e8c3889a987b13f071cc5ba221
sctp: check policy more carefully when getting pr status

When getting pr_assocstatus and pr_streamstatus by sctp_getsockopt,
it doesn't correctly process the case when policy is set with
SCTP_PR_SCTP_ALL | SCTP_PR_SCTP_MASK. It even causes a
slab-out-of-bounds in sctp_getsockopt_pr_streamstatus().

This patch fixes it by return -EINVAL for this case.

Fixes: 5e3dc4e455dd ("sctp: get pr_assoc and pr_stream all status with SCTP_PR_SCTP_ALL")
Reported-by: syzbot+5da0d0a72a9e7d791748@syzkaller.appspotmail.com
Suggested-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/socket.c