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]
Date: Mon, 1 Apr 2024 12:09:42 -0700
From: Alison Schofield <alison.schofield@...el.com>
To: Kwangjin Ko <kwangjin.ko@...com>
Cc: dave@...olabs.net, jonathan.cameron@...wei.com, dave.jiang@...el.com,
	vishal.l.verma@...el.com, ira.weiny@...el.com,
	dan.j.williams@...el.com, linux-cxl@...r.kernel.org,
	linux-kernel@...r.kernel.org, kernel_team@...ynix.com
Subject: Re: [PATCH 2/2] cxl/core: Fix incorrect array index in
 cxl_clear_event_record()

On Mon, Apr 01, 2024 at 06:10:56PM +0900, Kwangjin Ko wrote:
> The variable 'i' should be incremented after dev_dbg(), or print
> gen->hdr.handle instead. Otherwise, the handle value of the next loop
> will be printed. Furthermore, in the final loop, accessing 'handles[i]'
> will cause a buffer overflow.

This fix is already queued:
https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git/?h=fixes

> 
> Signed-off-by: Kwangjin Ko <kwangjin.ko@...com>
> ---
>  drivers/cxl/core/mbox.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index a38531a055c8..84014aa01c95 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -913,9 +913,9 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds,
>  		struct cxl_event_record_raw *raw = &get_pl->records[cnt];
>  		struct cxl_event_generic *gen = &raw->event.generic;
>  
> -		payload->handles[i++] = gen->hdr.handle;
>  		dev_dbg(mds->cxlds.dev, "Event log '%d': Clearing %u\n", log,
> -			le16_to_cpu(payload->handles[i]));
> +			le16_to_cpu(gen->hdr.handle));
> +		payload->handles[i++] = gen->hdr.handle;
>  
>  		if (i == max_handles) {
>  			payload->nr_recs = i;
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ