Mateusz Jurczyk 80176161f4 af_iucv: Move sockaddr length checks to before accessing sa_family in bind and connect handlers
[ Upstream commit e3c42b61ff813921ba58cfc0019e3fd63f651190 ]

Verify that the caller-provided sockaddr structure is large enough to
contain the sa_family field, before accessing it in bind() and connect()
handlers of the AF_IUCV socket. Since neither syscall enforces a minimum
size of the corresponding memory region, very short sockaddrs (zero or
one byte long) result in operating on uninitialized memory while
referencing .sa_family.

Fixes: 52a82e23b9f2 ("af_iucv: Validate socket address length in iucv_sock_bind()")
Signed-off-by: Mateusz Jurczyk <mjurczyk@google.com>
[jwi: removed unneeded null-check for addr]
Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-11-10 07:41:35 -08:00
..
2018-05-16 10:06:51 +02:00
2015-11-23 14:56:15 -05:00
2015-10-07 04:27:43 -07:00
2018-04-24 09:32:11 +02:00
2018-11-10 07:41:34 -08:00
2018-11-10 07:41:33 -08:00
2018-02-25 11:03:37 +01:00