Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937025AbdLRRIk (ORCPT ); Mon, 18 Dec 2017 12:08:40 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39772 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935516AbdLRQDf (ORCPT ); Mon, 18 Dec 2017 11:03:35 -0500 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Bo , Guoqing Jiang , Shaohua Li , Sasha Levin Subject: [PATCH 4.9 129/177] badblocks: fix wrong return value in badblocks_set if badblocks are disabled Date: Mon, 18 Dec 2017 16:49:12 +0100 Message-Id: <20171218152916.696575158@linuxfoundation.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171218152909.823644066@linuxfoundation.org> References: <20171218152909.823644066@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1154 Lines: 38 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Liu Bo [ Upstream commit 39b4954c0a1556f8f7f1fdcf59a227117fcd8a0b ] MD's rdev_set_badblocks() expects that badblocks_set() returns 1 if badblocks are disabled, otherwise, rdev_set_badblocks() will record superblock changes and return success in that case and md will fail to report an IO error which it should. This bug has existed since badblocks were introduced in commit 9e0e252a048b ("badblocks: Add core badblock management code"). Signed-off-by: Liu Bo Acked-by: Guoqing Jiang Signed-off-by: Shaohua Li Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- block/badblocks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/block/badblocks.c +++ b/block/badblocks.c @@ -178,7 +178,7 @@ int badblocks_set(struct badblocks *bb, if (bb->shift < 0) /* badblocks are disabled */ - return 0; + return 1; if (bb->shift) { /* round the start down, and the end up */