[PATCH review for 3.18 19/30] net/packet: check length in getsockopt() called with PACKET_HDRLEN

2017-09-19 Thread Levin, Alexander (Sasha Levin)
From: Alexander Potapenko [ Upstream commit fd2c83b35752f0a8236b976978ad4658df14a59f ] In the case getsockopt() is called with PACKET_HDRLEN and optlen < 4 |val| remains uninitialized and the syscall may behave differently depending on its value, and even copy garbage to

[PATCH review for 3.18 19/30] net/packet: check length in getsockopt() called with PACKET_HDRLEN

2017-09-19 Thread Levin, Alexander (Sasha Levin)
From: Alexander Potapenko [ Upstream commit fd2c83b35752f0a8236b976978ad4658df14a59f ] In the case getsockopt() is called with PACKET_HDRLEN and optlen < 4 |val| remains uninitialized and the syscall may behave differently depending on its value, and even copy garbage to userspace on certain