Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2491396pxj; Mon, 10 May 2021 04:23:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBEeM57hZCOaMu3vYKrZdqCxqxeOY6zY4PZe0nsapzaNJ8mqmG7vsz1pLRnfxVXh4iwF3Y X-Received: by 2002:a17:907:2628:: with SMTP id aq8mr24957375ejc.64.1620645708808; Mon, 10 May 2021 04:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645708; cv=none; d=google.com; s=arc-20160816; b=X36svvR1gZKrIsUmAp2Cs25ZUl1Ae7VD3lOZ+7hATr40SFlQ1gQEDpMZY1Eu+peXJb lA6FdqjIVVamVY/RDyqUooe1xT5YHaEKbakd9BvQPNulUw2lMw5SFUi1xVlfAdx3x//S piwn6QO3aKruNpmDkOABDkDXZl4CfOGeCy2aTSH05y/2veRnMONCY4sP4VNU6tAzGLLF LOeynRpUIHbgDJpzrUMpyiBiFtMAjBSyh+rDYfac2cF5RisJNQq/7L0jujHVNXDB77iy 94ypUnoB1x5L2iWKFr6kOJFgQ8Drxp1xMk2XmIUODJTUuaUdn5g8RlKAT13WesZJ405v 4s2g== 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=V4cEo/nkXvjNKhcb10gD6ltBfLr8Kw+7iSl7vBNWhaU=; b=a01KHoxjeXMAim3fQyxTCwemzfC7r6Y6LeMb9CT1WDXzGdBQ0xRkmtE879pPvy46N/ y2zd5NP/BcoLS454lrONnbcNllENlJHcONOx9WW17mnbUYImCAJPK1eXbIufYgq8Na4W hiEBPcV2f2L4FqZWmMvSrjOV2JIXumPjQvZ6JeWPmKyvdkL3pRkz1Go6yRE4on6pvnfQ 4Qr81cs+3XfDOfMhP4VSqIwl40Go0IzDVpsQNKzLPP0+nnpAO8lS63LgzdJ+26azHwKW zCpPU//G+6HEyUon2g8Ky9cC19AwzgBEFH2PZe3NF+MWokgVg80QLxszpdhO538WSLQL tjEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sR+gW4vt; 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 y8si2929865edd.181.2021.05.10.04.21.25; Mon, 10 May 2021 04:21:48 -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=sR+gW4vt; 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 S238578AbhEJLSH (ORCPT + 99 others); Mon, 10 May 2021 07:18:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:42040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233230AbhEJKyc (ORCPT ); Mon, 10 May 2021 06:54:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 56DDF6192A; Mon, 10 May 2021 10:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643325; bh=u17z4p9aBS+DjyOR25T3T4rNfcm/LEGpGXkpVGE6t9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sR+gW4vtIo5hEWZMKdk9j+VMkgmht1GIJkfTi/0/mIhtUqmZMtO3Prr6yPh5RSTOI 5c+HrGSc4ld88XB8wOkgGpxukVcJib6hVjPRt3orK8VWmnuL+/UHd7dWvwGnZYC7fC DCQTd9z9r3LAp4L0wIZYoeVlGmRnQ64CJ0MTZdbI= 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 5.10 268/299] ext4: fix error code in ext4_commit_super Date: Mon, 10 May 2021 12:21:05 +0200 Message-Id: <20210510102013.786315983@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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 @@ -5489,8 +5489,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