From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 6B37B10E8; Sun, 24 Dec 2023 00:32:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="AilYrcRY"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="VQjviSH5"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="AilYrcRY"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="VQjviSH5" Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7751021CD8; Sun, 24 Dec 2023 00:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1703377976; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M/d6jhLWIAoafyZMIbU7FyHZ5o1LeCN0mHS2QimSYDY=; b=AilYrcRYOHo7HnTp96YKlhRGRte5ApMzUN3rk0J07PpvmQJS6FCNQbZX5/LM4IHAluVZbN +aMtqA5cT9nvlc0rbiGf5yJFgFpSFUKh6N8xRx7tiXF8hL8X48H8GS+aELVzc5z0GzbA0S xTcdi/uxxOCZZIoG/jvENsl0qEpC11Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1703377976; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M/d6jhLWIAoafyZMIbU7FyHZ5o1LeCN0mHS2QimSYDY=; b=VQjviSH5KURZfCachlhBP+FqWv7iT9CFthS4cjmyk4lhTliGNFrbx4SdVPqlWSWOxioGKQ LO57/xCdKxGfYpAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1703377976; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M/d6jhLWIAoafyZMIbU7FyHZ5o1LeCN0mHS2QimSYDY=; b=AilYrcRYOHo7HnTp96YKlhRGRte5ApMzUN3rk0J07PpvmQJS6FCNQbZX5/LM4IHAluVZbN +aMtqA5cT9nvlc0rbiGf5yJFgFpSFUKh6N8xRx7tiXF8hL8X48H8GS+aELVzc5z0GzbA0S xTcdi/uxxOCZZIoG/jvENsl0qEpC11Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1703377976; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M/d6jhLWIAoafyZMIbU7FyHZ5o1LeCN0mHS2QimSYDY=; b=VQjviSH5KURZfCachlhBP+FqWv7iT9CFthS4cjmyk4lhTliGNFrbx4SdVPqlWSWOxioGKQ LO57/xCdKxGfYpAw== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id AF25D13902; Sun, 24 Dec 2023 00:32:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id MRmtFzR8h2X6fgAAn2gu4w (envelope-from ); Sun, 24 Dec 2023 00:32:52 +0000 Content-Type: text/plain; charset=utf-8 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.300.61.1.2\)) Subject: Re: [PATCH] badblocks: avoid checking invalid range in badblocks_check() From: Coly Li In-Reply-To: <20231224002820.20234-1-colyli@suse.de> Date: Sun, 24 Dec 2023 08:32:35 +0800 Cc: nvdimm@lists.linux.dev, Linux Kernel Mailing List , Linux Block Devices , Ira Weiny , Dan Williams , Geliang Tang , Hannes Reinecke , NeilBrown , Vishal L Verma , Xiao Ni Content-Transfer-Encoding: quoted-printable Message-Id: References: <20231224002820.20234-1-colyli@suse.de> To: Jens Axboe X-Mailer: Apple Mail (2.3774.300.61.1.2) X-Spam-Level: X-Spam-Level: X-Spamd-Result: default: False [-0.47 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-0.87)[85.65%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_SEVEN(0.00)[11]; DBL_BLOCKED_OPENRESOLVER(0.00)[intel.com:email,suse.com:email,kernel.dk:email,suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -0.47 X-Spam-Flag: NO > 2023=E5=B9=B412=E6=9C=8824=E6=97=A5 08:28=EF=BC=8CColy Li = =E5=86=99=E9=81=93=EF=BC=9A >=20 > If prev_badblocks() returns '-1', it means no valid badblocks record > before the checking range. It doesn't make sense to check whether > the input checking range is overlapped with the non-existed invalid > front range. >=20 > This patch checkes whether 'prev >=3D 0' is true before calling > overlap_front(), to void such invalid operations. >=20 > Fixes: 3ea3354cb9f0 ("badblocks: improve badblocks_check() for = multiple ranges handling") > Reported-and-tested-by: Ira Weiny > Signed-off-by: Coly Li > Link: = https://lore.kernel.org/nvdimm/3035e75a-9be0-4bc3-8d4a-6e52c207f277@leemhu= is.info/ > Cc: Dan Williams > Cc: Geliang Tang > Cc: Hannes Reinecke > Cc: Jens Axboe > Cc: NeilBrown > Cc: Vishal L Verma > Cc: Xiao Ni > --- > block/badblocks.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) Hi Jens, Is it possible to take this fix into 6.7 still? Thanks in advance. Coly Li [snipped]