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] [day] [month] [year] [list]
Message-ID: <ZKQgThjFIjflEV9A@corigine.com>
Date: Tue, 4 Jul 2023 14:36:14 +0100
From: Simon Horman <simon.horman@...igine.com>
To: Pedro Tammela <pctammela@...atatu.com>
Cc: netdev@...r.kernel.org, jhs@...atatu.com, xiyou.wangcong@...il.com,
	jiri@...nulli.us, davem@...emloft.net, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, shuah@...nel.org,
	shaozhengchao@...wei.com, victor@...atatu.com
Subject: Re: [PATCH net 1/2] net/sched: sch_qfq: reintroduce lmax bound check
 for MTU

On Mon, Jul 03, 2023 at 12:10:37PM -0300, Pedro Tammela wrote:
> Commit 25369891fcef deletes a check for the case where no 'lmax' is
> specified which commit 3037933448f6 fixes as 'lmax'
> could be set to the device's MTU without any bound checking
> for QFQ_LMAX_MIN and QFQ_LMAX_MAX. Therefore, reintroduce the check.
> 
> Fixes: 25369891fcef ("net/sched: sch_qfq: refactor parsing of netlink parameters")
> Signed-off-by: Pedro Tammela <pctammela@...atatu.com>
> ---
>  net/sched/sch_qfq.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/net/sched/sch_qfq.c b/net/sched/sch_qfq.c
> index dfd9a99e6257..b624ae539c8c 100644
> --- a/net/sched/sch_qfq.c
> +++ b/net/sched/sch_qfq.c
> @@ -425,8 +425,15 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
>  
>  	if (tb[TCA_QFQ_LMAX])
>  		lmax = nla_get_u32(tb[TCA_QFQ_LMAX]);
> -	else
> +	else {
> +		/* MTU size is user controlled */
>  		lmax = psched_mtu(qdisc_dev(sch));
> +		if (lmax < QFQ_MIN_LMAX || lmax > QFQ_MAX_LMAX) {
> +			NL_SET_ERR_MSG_MOD(extack,
> +					   "MTU size out of bounds for qfq");
> +			return -EINVAL;
> +		}
> +	}

Hi Pedro,

a minor nit from my side.

If any arm of a condition has {}, then all should.

	if (...) {
		...
	} else {
		...
	}

>  
>  	inv_w = ONE_FP / weight;
>  	weight = ONE_FP / inv_w;
> -- 
> 2.39.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ