]> git.karo-electronics.de Git - karo-tx-linux.git/commit
inet_diag: validate port comparison byte code to prevent unsafe reads
authorNeal Cardwell <ncardwell@google.com>
Sun, 9 Dec 2012 11:09:54 +0000 (11:09 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Jan 2013 17:06:29 +0000 (09:06 -0800)
commitf762136f85f60e7d9e8a0422f078bb187fbfc9f0
tree9d986bde672f6ec0a4a090bc5d2a2fca7d6b1d91
parentb2aa2e70f9d6d5c4aadccdda5956991e8d1869e8
inet_diag: validate port comparison byte code to prevent unsafe reads

[ Upstream commit 5e1f54201cb481f40a04bc47e1bc8c093a189e23 ]

Add logic to verify that a port comparison byte code operation
actually has the second inet_diag_bc_op from which we read the port
for such operations.

Previously the code blindly referenced op[1] without first checking
whether a second inet_diag_bc_op struct could fit there. So a
malicious user could make the kernel read 4 bytes beyond the end of
the bytecode array by claiming to have a whole port comparison byte
code (2 inet_diag_bc_op structs) when in fact the bytecode was not
long enough to hold both.

Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/inet_diag.c