l2tp: check sockaddr length in pppol2tp_connect()
[ Upstream commiteb1c28c058
] Check sockaddr_len before dereferencing sp->sa_protocol, to ensure that it actually points to valid data. Fixes:fd558d186d
("l2tp: Split pppol2tp patch into separate l2tp and ppp parts") Reported-by: syzbot+a70ac890b23b1bf29f5c@syzkaller.appspotmail.com Signed-off-by: Guillaume Nault <g.nault@alphalink.fr> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
c7a936b1dd
Коммит
dbf57fd1e0
|
@ -591,6 +591,13 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
|
|||
lock_sock(sk);
|
||||
|
||||
error = -EINVAL;
|
||||
|
||||
if (sockaddr_len != sizeof(struct sockaddr_pppol2tp) &&
|
||||
sockaddr_len != sizeof(struct sockaddr_pppol2tpv3) &&
|
||||
sockaddr_len != sizeof(struct sockaddr_pppol2tpin6) &&
|
||||
sockaddr_len != sizeof(struct sockaddr_pppol2tpv3in6))
|
||||
goto end;
|
||||
|
||||
if (sp->sa_protocol != PX_PROTO_OL2TP)
|
||||
goto end;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче