af_iucv: Validate socket address length in iucv_sock_bind()
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com> Reported-by: Dmitry Vyukov <dvyukov@google.com> Reviewed-by: Evgeny Cherkashin <Eugene.Crosser@ru.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ed0dfffd7d
commit
52a82e23b9
1 changed files with 3 additions and 0 deletions
|
@ -708,6 +708,9 @@ static int iucv_sock_bind(struct socket *sock, struct sockaddr *addr,
|
||||||
if (!addr || addr->sa_family != AF_IUCV)
|
if (!addr || addr->sa_family != AF_IUCV)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (addr_len < sizeof(struct sockaddr_iucv))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
lock_sock(sk);
|
lock_sock(sk);
|
||||||
if (sk->sk_state != IUCV_OPEN) {
|
if (sk->sk_state != IUCV_OPEN) {
|
||||||
err = -EBADFD;
|
err = -EBADFD;
|
||||||
|
|
Loading…
Reference in a new issue