]> git.baikalelectronics.ru Git - kernel.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)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Dec 2012 00:00:48 +0000 (19:00 -0500)
commitc2cb3408bfbdcef661944b280758338cef02f69f
treef5fa04ab4f52467197692f6ddf3cb56d5908595e
parentc02bcbedb632365f6643cd1f3481998fcaae7c0a
inet_diag: validate port comparison byte code to prevent unsafe reads

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>
net/ipv4/inet_diag.c