Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2110203lkv; Thu, 20 May 2021 03:39:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD/5UjN07BEwmcg8g7YczdSqdS0tXOW69ucQEfms3H1ZPBdJL2AQ/s6fIP0jVJ+0MSoPFd X-Received: by 2002:a05:6602:54:: with SMTP id z20mr4458159ioz.48.1621507147819; Thu, 20 May 2021 03:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621507147; cv=none; d=google.com; s=arc-20160816; b=leQdoYce3xgKE8ZQA0CifZLpO0nuf1LV6Ge0x/BoKmuGuo9bmq2LTzrjnqEJJmeMPz TOS2fAB2hy9Sqcfsur0OxkDJH+tGCs7ca9kU3NaQgwrMf8LBpR1M/mOwy4e+U2QKuAnS SYtRNXKcR2hzESeft6wghYJwU1SQpZUKSGgYUVVdMYuNTM7Faq3yFmXcNbgP+rkNc+3P 4A+pPghkQxg6nHFgQbyYW6bjoKOAO5wUXr+GC/HNWf+RgQVDt/j0XbrpUEIPafdmrWEa GIItGDYRH+iYQJV6kvbiUHxt2/wkLkKzoo5s34m9aNVaRcQa8GtZJrKim8F2izRVdKw0 KhnA== 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=S+C4CsZQpJnrMWYTmRPKrP/oW1wgiZEnWjKyL+wh7MQ=; b=rKaD/bC+jgtiAUo1CF9xqcKfMblHy4zuMztv+Wf45xUJFZMZ3IvazVtP0VTdLyt4n7 F4P9VFFnjcFz+rzeUox2m7cpRNPFW5WX6zArI7EL6PRAeWo4dZMeIz7WFiIKBhi8ZBKA e5Sa1+AffmEUH6fzsNAB6wutvw7NADqLEbXDiHBDScKRc3guBobELWxChjNsfjXZc2GK siUJ34JuhigMh4vfkyMa6OReADotfuJ3TYeY750BvYwwJLQ33Fva8omC4oCJXMf1AnGV O0FZ3gjFXjqmE3NHI+0SG4/9OLEeq17bnIYHCrGWJdDpWE7Sjw7lkcq6oNOrHPY58q8r c7vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BR88xsOP; 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 b11si1854810iok.1.2021.05.20.03.38.54; Thu, 20 May 2021 03:39:07 -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=BR88xsOP; 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 S237505AbhETKiV (ORCPT + 99 others); Thu, 20 May 2021 06:38:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:52120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236568AbhETKYT (ORCPT ); Thu, 20 May 2021 06:24:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0ADBA61C17; Thu, 20 May 2021 09:48:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504140; bh=BUF5Bm9miGGW7wnl2rij172wFK7x1PRkVpUmBSyejfY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BR88xsOPfA3rvbifHTUJoHMVRtTiEXiApO52qApqmuUdh9zyqaQWAGKxCKhvI/NxN CpaoevU+jJwWidGHYQNcW6gbszeDVTroyzLNIoifzXPWfqPZnsVSNag2TdcfUEHnO8 EMTZMXEy+4De6fjlHMvULEYiT+JTlKvE0F8CqLVk= 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.14 093/323] ext4: fix error code in ext4_commit_super Date: Thu, 20 May 2021 11:19:45 +0200 Message-Id: <20210520092123.289133420@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 @@ -4859,8 +4859,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