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: <Y+5KyhntRjMzDM2G@lincoln>
Date:   Thu, 16 Feb 2023 16:24:58 +0100
From:   Larysa Zaremba <larysa.zaremba@...el.com>
To:     Alok Tiwari <alok.a.tiwari@...cle.com>
CC:     <netdev@...r.kernel.org>, <darren.kenny@...cle.com>,
        <linux-kernel@...r.kernel.org>, <jhs@...atatu.com>,
        <xiyou.wangcong@...il.com>, <jiri@...nulli.us>, <kuba@...nel.org>,
        <simon.horman@...igine.com>, <keescook@...omium.org>
Subject: Re: [PATCH] net: sched: sch: null pointer dereference in
 htb_offload_move_qdisc()

On Thu, Feb 16, 2023 at 02:49:40AM -0800, Alok Tiwari wrote:
> A possible case of null pointer dereference detected by static analyzer
> htb_destroy_class_offload() is calling htb_find() which can return NULL value
> for invalid class id, moved_cl=htb_find(classid, sch);
> in that case it should not pass 'moved_cl' to htb_offload_move_qdisc()
> if 'moved_cl' is NULL pointer return -EINVAL.
> 
> Signed-off-by: Alok Tiwari <alok.a.tiwari@...cle.com>

Conceptually, code looks fine, but it probably won't be accepted without:
- imperative verb in the title
- tree, to which patch must be applied [0]
- more nicely written and formatted commit message. If you are referring to a 
  static analyzer and not to common logic, maybe include, how the warning looks.
  Separate your text into sentences and paragraphs.

[0] https://www.kernel.org/doc/html/v5.3/networking/netdev-FAQ.html#q-how-do-i-indicate-which-tree-net-vs-net-next-my-patch-should-be-in

> ---
>  net/sched/sch_htb.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
> index 92f2975b6a82..5a96d9ea3221 100644
> --- a/net/sched/sch_htb.c
> +++ b/net/sched/sch_htb.c
> @@ -1601,6 +1601,8 @@ static int htb_destroy_class_offload(struct Qdisc *sch, struct htb_class *cl,
>  		u32 classid = TC_H_MAJ(sch->handle) |
>  			      TC_H_MIN(offload_opt.classid);
>  		struct htb_class *moved_cl = htb_find(classid, sch);
> +		if (WARN_ON_ONCE(!moved_cl))
> +			return -EINVAL;
>  
>  		htb_offload_move_qdisc(sch, moved_cl, cl, destroying);
>  	}
> -- 
> 2.39.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ