lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 09 Dec 2012 19:02:23 -0500 (EST)
From:	David Miller <>
Subject: Re: [PATCH net] inet_diag: validate port comparison byte code to
 prevent unsafe reads

From: Neal Cardwell <>
Date: Sun,  9 Dec 2012 16:03:00 -0500

> 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 <>

Haste makes waste...

> +/* Validate a port comparison operator. */
> +static inline bool valid_port_comparison(const struct inet_diag_bc_op *op,
> +					 int len, int *min_len)
> +{
> +	/* Port comparisons put the port in a follow-on inet_diag_bc_op. */
> +	*min_len += sizeof(struct inet_diag_bc_op);
> +	if (len < *min_len)
> +		return false;
> +}
> +

I added the missing "return true" at the end of this new function.

Applied, but please be more careful and at least look at the compiler
warnings when you submit your changes.

To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at

Powered by blists - more mailing lists