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, 11 Sep 2023 11:49:49 +0200
From:   Pavel Machek <pavel@...x.de>
To:     Sasha Levin <sashal@...nel.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Zhang Shurong <zhang_shurong@...mail.com>,
        Yu Kuai <yukuai3@...wei.com>, Song Liu <song@...nel.org>,
        linux-raid@...r.kernel.org
Subject: Re: [PATCH AUTOSEL 4.14 2/3] md: raid1: fix potential OOB in
 raid1_remove_disk()

Hi!

> From: Zhang Shurong <zhang_shurong@...mail.com>
> 
> [ Upstream commit 8b0472b50bcf0f19a5119b00a53b63579c8e1e4d ]
> 
> If rddev->raid_disk is greater than mddev->raid_disks, there will be
> an out-of-bounds in raid1_remove_disk(). We have already found
> similar reports as follows:
> 
> 1) commit d17f744e883b ("md-raid10: fix KASAN warning")
> 2) commit 1ebc2cec0b7d ("dm raid: fix KASAN warning in raid5_remove_disk")
> 
> Fix this bug by checking whether the "number" variable is
> valid.

> +++ b/drivers/md/raid1.c
> @@ -1775,6 +1775,10 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev)
>  	struct r1conf *conf = mddev->private;
>  	int err = 0;
>  	int number = rdev->raid_disk;
> +
> +	if (unlikely(number >= conf->raid_disks))
> +		goto abort;
> +
>  	struct raid1_info *p = conf->mirrors + number;
>  
>  	if (rdev != p->rdev)

Wow. Mixing declarations and code. I'm pretty sure that's not ok
according to our coding style, and I'd be actually surprised if all
our compiler configurations allowed this.

Best regards,
								Pavel	
-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ