From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE11523244A for ; Tue, 14 Jan 2025 14:16:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736864198; cv=none; b=oSJ+U/FQqBw/tAv46PtemnF/AcJdSnkzBWM77lwgSE8QmTBX2PD30p/JH0wZk7PzxQWj2AV6qH/XIye/6QEGJyBeCPQGblamJ8huttBNvpx0GgNl1XkkfDw4Hq63v5DGnQTLaZVjEBAWWdRNNTX1IQTsUCI9N2je/cbAhF9g1Dk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736864198; c=relaxed/simple; bh=zLYV/p4NbWucnZdMWOxClcKApUEICGzHbrP82gUQFUA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aFEgOYwUb/WgNimbwHpmdZ0u45MapKH9yQmPVKgK4+eGl9XOUYoOrl+qQKKlUQm254DBQuWpL1oQrTDmIC+togAPtEt5DZciHB9iPH2MbnZvgJreure/59BErmytOkBPgYZ/bcOHUQFl5Djnw2dsQDL+M1nAkT4lBy3cbRHm8YI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk; spf=pass smtp.mailfrom=kernel.dk; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b=Z3S+/wBB; arc=none smtp.client-ip=209.85.166.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20230601.gappssmtp.com header.i=@kernel-dk.20230601.gappssmtp.com header.b="Z3S+/wBB" Received: by mail-io1-f46.google.com with SMTP id ca18e2360f4ac-844e12f702dso186757139f.3 for ; Tue, 14 Jan 2025 06:16:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20230601.gappssmtp.com; s=20230601; t=1736864194; x=1737468994; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=piueM2ZbjRCE6konTEuQoeTyqo98eT09jJWpTOuRcvQ=; b=Z3S+/wBBK0Tg4ecsdBYYEyl5yg/PJ2nKQH5AwefO3sYQR13Wc6wvTX22CEDWvGC2Nw ZCvCS8Ux6bVnPXL4iYAZjCj7ZFSbn2Jp/0GzGc0fUy/Kl8WaHFLCMi/8LzsrfCRvO/Iu R3ogJwXKCI0TM53+EgH4FUFHBBhBXqX/COeiSImI/jUTLwQw1KohOUZJSjH0Nx5Gtgd/ 3ise4IlqMRzlDGOI/wEKULo+icgn4qU6iOwJ0smYazRvyMFo7avFbauBWzeOoWYG54Co aFzZYqeXkIQRqzp7CbnXYPM9bduGBCKF7P+Fti1rVlDkm+afRSzhSD1OedEzeGxqJpcG 6HPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736864194; x=1737468994; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=piueM2ZbjRCE6konTEuQoeTyqo98eT09jJWpTOuRcvQ=; b=U4PlqO0SJSBquBm12bwkBmjVwsiZs6q5G9ETSNfn05GMCoAupeZU92DQxE9JpUy9SV KIzCkXLh3jw8UAwn2rt6twt4gv7uXqDofs8xg96yfT4RzqpcY/SvLzj7Z4sYhH3zQZG6 C37scXXW345+OQpiVUjuxak5tu795ukNz25Ut47ItmIa6/55KG4ecwBPY+/Lpi3ZRQR4 KjvXg8fVO0ibdaEexNvxe9IegDgymyz+eA5QD85oLLOSKSicx5Ah7N+89ePiOYtVnDKK 2AnybBLl03w9lpF5dosa7nVq4DwPfTK2Bn+xYWKFzBYy+SSz9JCXE9ZKGByMOmfuf0Cd XWbw== X-Forwarded-Encrypted: i=1; AJvYcCVjNQb0aIx/gmVVBxIf5+RuQNpnA9eu4ybIA4Vgy69PB8cDfBbJPjxFeRStUFHGfmZxSWoI4S/JYkUM/qo=@vger.kernel.org X-Gm-Message-State: AOJu0YxyCH4pyBzPVNauBJyWDVl05VAkgo+nAZ31Tz2c0bUWKNcFFwjq MmeT5tv94hgYa/DXLYYspbv0QYu+c1zwog99I96uFqnqUu8q6aQgdmlYDpFzlOw= X-Gm-Gg: ASbGncuySZKHgQQu4b1Z7ELAZFGsJkMv5vg6P8L2VbjttWdCUd57OdZNEdKuJlRG0vV OF1cgxG8yGwAygBhF/Cz5UcbYsbGxz1FPCXBf6/+ecid9Wo5L+iLYkJYYIY2aLoKVIa9LJD+X/I 66BdmJdwb6zQW0u+NTTarPey+pJjcVMSqlMQOlsqtr3MDDfdzjFRRFpr5ZDkBAmWuUefjIwpLrO KJdhYX0BGxUcShr3PUsBi/aD4v3thKPY9bb2g5GQFbOZjvqCiVa X-Google-Smtp-Source: AGHT+IFvZTCl3oJ+SK73bM2PFw5HmarmpttrBz6f2pmfBDtURiNZ/JAdwv8cVfDxUiql3uvfEok/vA== X-Received: by 2002:a05:6e02:1789:b0:3a7:8040:595b with SMTP id e9e14a558f8ab-3ce3a9b8fd6mr148487455ab.9.1736864193723; Tue, 14 Jan 2025 06:16:33 -0800 (PST) Received: from [192.168.1.116] ([96.43.243.2]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3ce6387bee8sm23453545ab.72.2025.01.14.06.16.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Jan 2025 06:16:33 -0800 (PST) Message-ID: Date: Tue, 14 Jan 2025 07:16:31 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V2] block: no show partitions if partno corrupted To: Edward Adam Davis , hare@suse.de Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+fcee6b76cf2e261c51a4@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com References: From: Jens Axboe Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 1/14/25 1:51 AM, Edward Adam Davis wrote: > diff --git a/block/genhd.c b/block/genhd.c > index 9130e163e191..8d539a4a3b37 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -890,7 +890,9 @@ static int show_partition(struct seq_file *seqf, void *v) > > rcu_read_lock(); > xa_for_each(&sgp->part_tbl, idx, part) { > - if (!bdev_nr_sectors(part)) > + int partno = bdev_partno(part); > + > + if (!bdev_nr_sectors(part) || WARN_ON(partno >= DISK_MAX_PARTS)) > continue; > seq_printf(seqf, "%4d %7d %10llu %pg\n", > MAJOR(part->bd_dev), MINOR(part->bd_dev), This should be a WARN_ON_ONCE(), and please put warn-on's on a separate line. -- Jens Axboe