lists.openwall.net   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  linux-hardening  linux-cve-announce  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]
Message-ID: <CO1PR11MB5089ADDBFA04502A6F7D56ABD63FA@CO1PR11MB5089.namprd11.prod.outlook.com>
Date: Fri, 21 Jul 2023 16:45:33 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: Jiri Pirko <jiri@...nulli.us>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>
CC: "kuba@...nel.org" <kuba@...nel.org>, "pabeni@...hat.com"
	<pabeni@...hat.com>, "davem@...emloft.net" <davem@...emloft.net>,
	"edumazet@...gle.com" <edumazet@...gle.com>
Subject: RE: [patch net-next] genetlink: add explicit ordering break check for
 split ops



> -----Original Message-----
> From: Jiri Pirko <jiri@...nulli.us>
> Sent: Thursday, July 20, 2023 4:14 AM
> To: netdev@...r.kernel.org
> Cc: kuba@...nel.org; pabeni@...hat.com; davem@...emloft.net;
> edumazet@...gle.com; Keller, Jacob E <jacob.e.keller@...el.com>
> Subject: [patch net-next] genetlink: add explicit ordering break check for split ops
> 
> From: Jiri Pirko <jiri@...dia.com>
> 
> Currently, if cmd in the split ops array is of lower value than the
> previous one, genl_validate_ops() continues to do the checks as if
> the values are equal. This may result in non-obvious WARN_ON() hit in
> these check.
> 
> Instead, check the incorrect ordering explicitly and put a WARN_ON()
> in case it is broken.
> 
> Signed-off-by: Jiri Pirko <jiri@...dia.com>


Good fix.

Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>

> ---
>  net/netlink/genetlink.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
> index a157247a1e45..6bd2ce51271f 100644
> --- a/net/netlink/genetlink.c
> +++ b/net/netlink/genetlink.c
> @@ -593,8 +593,12 @@ static int genl_validate_ops(const struct genl_family
> *family)
>  			return -EINVAL;
> 
>  		/* Check sort order */
> -		if (a->cmd < b->cmd)
> +		if (a->cmd < b->cmd) {
>  			continue;
> +		} else if (a->cmd > b->cmd) {
> +			WARN_ON(1);
> +			return -EINVAL;
> +		}
> 
>  		if (a->internal_flags != b->internal_flags ||
>  		    ((a->flags ^ b->flags) & ~(GENL_CMD_CAP_DO |
> --
> 2.41.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ