Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp573523pxj; Thu, 20 May 2021 16:37:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoxS631X/yfq8NvW1kTu4Z1tP8fQqshql/Y6GkSnLwBfba45CO3V6mkfSD4nQFib24h/ec X-Received: by 2002:a05:6e02:1a49:: with SMTP id u9mr8062058ilv.306.1621553867976; Thu, 20 May 2021 16:37:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621553867; cv=none; d=google.com; s=arc-20160816; b=InyLyKbyWcvq5adkLG75KPejIYruG3SBhn8ysaCO1e+OnuUFSeI8pZcyhaKUoOX8Eq jG0H+5/wwCecZfA2xOCztKou04As8zfcLHD8eqyb9yrLkDBxF5jMyvrQNuXPFew+feWW fIyu+UlMydexCUinyPU8VG0SBp0qDbSjTDJWPHtALN1YJNtdIkD660WEUN0YbyOSQqqS vuCUPRRAdYfD8nd7jt1OSBF0IpNqpX5M9R8y04BQrG3e5E5dQnI8mkphGuvBO6wsRdJX SkXUyMalErIxVBrbaQ9cU7OSxscCb+PBLY92OPhbYy+r0DeazRlo37EYNk0QYLNwRMw6 O5pQ== 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=EICgo7aAwnk+sO2fVjp9un9y2A/oFMCOoNtWBFuyR+s=; b=w/Xn0CHKKbk1FTjgnmKmUdFtAa+JLvUe5ABRQUw40yPF9Rellz+ieHiz/Yl82SmIBV p5ii8uVxctz/DEdIx38dcQa2Vd8q69SidDsX03LSxas04YEoACKeJbRmmu1IiyqfdGB2 LUgrJhrH5DmGj57IOj+zpWkeBXcWKzDMT9NkQLUinOVZaBHf6AuMx77FwOV9+m7MtFq7 qN3dsOX8TeByk0gUqwEQurnOM+502x+qXWLu3V0jgtmFLQyksleSSzRH/ukC+MNY+Fz5 qpQPItYPL2diw8+FH+LU+6bJvxLCGwYMMNcWIOi18Hh595jHG8Xn5SmbGMEcv9bUmoqy QHCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nR1Tmfel; 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 u8si3996199ilv.32.2021.05.20.16.37.33; Thu, 20 May 2021 16:37:47 -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=nR1Tmfel; 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 S240786AbhETLcI (ORCPT + 99 others); Thu, 20 May 2021 07:32:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:55230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239608AbhETLLT (ORCPT ); Thu, 20 May 2021 07:11:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 17D9961D44; Thu, 20 May 2021 10:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505247; bh=h5+CUGgC8WYm+NRzWUxIdxZ0SBfkVvfR6nZpa9ZKVw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nR1TmfellIvqXOWEP51t5fJULH7t6LB1PItYGOpg79b1plhRnSfF2wU2wpvT52SYr igmxjn8ukmk8B43KvRF8j5ZQwaFQa4jO7UgQhXEHJ53gCad2Z2dxKHdi5tjHCrPOLA fR4LoqFUwRZzYYhEGwtL9zyMYjWrbfxnA+zhoAt4= 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.4 049/190] ext4: fix error code in ext4_commit_super Date: Thu, 20 May 2021 11:21:53 +0200 Message-Id: <20210520092103.795095770@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 @@ -4494,8 +4494,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; /* * The superblock bh should be mapped, but it might not be if the