Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp543588pxj; Thu, 20 May 2021 15:48:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4jAwVvu+t//3BS0wEWjPvKGYS8jO8laW1S8v89YjghO/obIbhbxHnmBiQgmwz9AXBXyZP X-Received: by 2002:a6b:7d0b:: with SMTP id c11mr8118570ioq.8.1621550915674; Thu, 20 May 2021 15:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621550915; cv=none; d=google.com; s=arc-20160816; b=nqaZtucAg8pddMpAm5OHQ7KH3a9LD8jfrUXbrKD0p4bwbf2xfCNqSBksKI7ISAXxRR oTQ2F/lZa59ThHsLIkkC/V6pmLMec9KssU40HRntL2G/9IGq1/aA+ma9tRledN2BiO++ JjKW7u5qIUylV5hQAjLQcUqWMDDlfWpEOYdqWP854R/K/77O8TFXKeYlYhGSjF7fF2sv YQc4oTcnN/wg2f25p1moTM8hz842YfsvcX3hdR1pvSrYvriEFGvmQVURLqBtgHLblXqP cO6qFKX/c0MAb6v9ArDaw0UobDuqOeLve1LemETFNBAHBbb+sktExe87OSoPe15btWl1 jtTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=u1LdmW+bMh55ZNoFtMSECnDczh0Bn3Pj5Hw/C/fdMtg=; b=uUvjB3UBZi9NFBuO6RLUab81YhwFxAbs4NfwHa33KFOyjaU63Q8JtJkhBaFb7TO2E0 1JxJDnT2VTLarMXpa5WTP24zFx/suc04YGfaCG9y7iXAJhSfC1qCP2Uil/4n9svh1kZC Kd0wPgvxhrQtKRmVMNHS1kvaRwDyj2GhEKJkBKMsPP7z02L5qTzQhNu2y+jgyhcyMZOr Mu1eqjVZir+oz1MnvUQtHDqEuZP+MCDftMV5AVFyx9/eOO4wA8WaNdOmZIXatWDFohj+ uerTszyAjis1Iy/NDpb7f2LvQbcNcbn+KBWOFerRqIzywO+uvaALBkFdmbEd0nLetSvg nGhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AJH7Lu3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y3si3410958iom.73.2021.05.20.15.48.21; Thu, 20 May 2021 15:48:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AJH7Lu3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239076AbhETLHe (ORCPT + 99 others); Thu, 20 May 2021 07:07:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:49004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238511AbhETKt2 (ORCPT ); Thu, 20 May 2021 06:49:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 98ADC61624; Thu, 20 May 2021 09:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504743; bh=I8jmfYHEiMAQZxO0KSLEM3bvt/fJTbONMc5LuOWcpOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AJH7Lu3FnfF8WCRfhIkvgOE8QAnYZLMW2ygYpV3YB56WeKTbNNVHoWMtIujL3IL56 uFcf2BJJRlapECu/axuXsWvLJSgp5iR1QAWxWsa082S7AlefDNjDaUihD6aG3/ZqKb cGCk6hL36DaK70UqsYUVvgAK2ZmFRP06IoAeMCkU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Fengnan Chang , Andreas Dilger , Theodore Tso Subject: [PATCH 4.9 060/240] ext4: fix error code in ext4_commit_super Date: Thu, 20 May 2021 11:20:52 +0200 Message-Id: <20210520092110.701773877@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092108.587553970@linuxfoundation.org> References: <20210520092108.587553970@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fengnan Chang commit f88f1466e2a2e5ca17dfada436d3efa1b03a3972 upstream. We should set the error code when ext4_commit_super check argument failed. Found in code review. Fixes: c4be0c1dc4cdc ("filesystem freeze: add error handling of write_super_lockfs/unlockfs"). Cc: stable@kernel.org Signed-off-by: Fengnan Chang Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/20210402101631.561-1-changfengnan@vivo.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/super.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4678,8 +4678,10 @@ static int ext4_commit_super(struct supe struct buffer_head *sbh = EXT4_SB(sb)->s_sbh; int error = 0; - if (!sbh || block_device_ejected(sb)) - return error; + if (!sbh) + return -EINVAL; + if (block_device_ejected(sb)) + return -ENODEV; /* * If the file system is mounted read-only, don't update the