Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3025666ybt; Mon, 29 Jun 2020 13:14:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKe6odRJnyPRt3QxuR0MZkyYNFTQrZmOf2ABSjdj1X2Yy3cpgPTC5tKXXQZIiZCeq0aMpB X-Received: by 2002:a17:906:c56:: with SMTP id t22mr16066380ejf.50.1593461650245; Mon, 29 Jun 2020 13:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593461650; cv=none; d=google.com; s=arc-20160816; b=qzMTbbP2z50b7zP0hrSrNIcDDQ0wzMWJtLwXy/HbuWYFngpdKx5pJ/6l5Oa03N/pa1 xDDdJJsw+2oMV3pjGL2sQoJ/msP00mGKAS/sY0zT9JHQ5qGDZwgriWOW6FrKel0ZJ9AX nF4XM1Tic0tVR1P/A6B447pkCAaIqwwq9EUmK708sXn2oyl+ZbK9uMaEzjhkVilH6ULj rqm5pdA1DWSBV94LmpICYxRiH3zkWxrRzTR6a/Wu+VX5aCjEy+7LslfAeDYLGpkJ77rL ha2fyFKFc4eNmUo4od/8PqjwAtnV5EWZDPxu3SEuJIBnA0QwLCDAhckg7LcT/XpUX21j F3BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ED75da85ZUhksFz/zdCLcMqI/r/JM/+ab/IiJAImEoU=; b=qfdgbUeD4BZuqyPrr4crpvxzyPcBVuxJedAMSPKncdMqLmDhTv8KOhkMM08UhM+i+R +8tP/ZMFOx9MNGH6ordK2WbH7bObCJx8fX57YCIc07NXFB5NyFElzc9BdHHZlunsVKCU h3IgfWWpuFBanjc93tbkxLS+thZELh/rOsslCUQ+zm93mhuwb27XqPLI36RXFEUbKYzF Mx7xrejmpj9Th7voQFmOV0ZI55URJOnDKIBPU3KB5VPGH5HDDPM2bZx4yhGPHHic+sJ/ UcWOZID2zH8u4Veo4pkFZGmdYonX6yyfXIdpSYhMKgXVQZu3qUaBSmQL9L+eTD+YPzZ/ bY1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=y5ICjroh; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs1si301346edb.76.2020.06.29.13.13.46; Mon, 29 Jun 2020 13:14:10 -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=@kernel.org header.s=default header.b=y5ICjroh; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730389AbgF2UMB (ORCPT + 99 others); Mon, 29 Jun 2020 16:12:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:40596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732889AbgF2TaV (ORCPT ); Mon, 29 Jun 2020 15:30:21 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D307F252AA; Mon, 29 Jun 2020 15:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593445018; bh=AxsttLVOxrBP8cPcE8rjkd3YtVNE7N+1sqoYyZwdLSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y5ICjroh/l6BUqS4m7Y3SvT0QYLCNjIe9TGI+KSIElFuah5AEi2WeJlvxYG3m5nH5 zt4OHDHXuAWBOGKotq53eptbl4XNxiOhSowDusRwBiXb0gVy8W5VSEJnv7++qWmDIq Ir0KQLKDansdGf/sBoQLlsaiaFdDHoKFEkpWqvmE= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Junxiao Bi , Joseph Qi , Mark Fasheh , Joel Becker , Changwei Ge , Gang He , Jun Piao , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman Subject: [PATCH 4.19 116/131] ocfs2: fix value of OCFS2_INVALID_SLOT Date: Mon, 29 Jun 2020 11:34:47 -0400 Message-Id: <20200629153502.2494656-117-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200629153502.2494656-1-sashal@kernel.org> References: <20200629153502.2494656-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.131-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.19.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.19.131-rc1 X-KernelTest-Deadline: 2020-07-01T15:34+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Junxiao Bi commit 9277f8334ffc719fe922d776444d6e4e884dbf30 upstream. In the ocfs2 disk layout, slot number is 16 bits, but in ocfs2 implementation, slot number is 32 bits. Usually this will not cause any issue, because slot number is converted from u16 to u32, but OCFS2_INVALID_SLOT was defined as -1, when an invalid slot number from disk was obtained, its value was (u16)-1, and it was converted to u32. Then the following checking in get_local_system_inode will be always skipped: static struct inode **get_local_system_inode(struct ocfs2_super *osb, int type, u32 slot) { BUG_ON(slot == OCFS2_INVALID_SLOT); ... } Link: http://lkml.kernel.org/r/20200616183829.87211-5-junxiao.bi@oracle.com Signed-off-by: Junxiao Bi Reviewed-by: Joseph Qi Cc: Mark Fasheh Cc: Joel Becker Cc: Changwei Ge Cc: Gang He Cc: Jun Piao Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/ocfs2/ocfs2_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index 263e28ebeeabe..d50b7f2c7395e 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h @@ -303,7 +303,7 @@ #define OCFS2_MAX_SLOTS 255 /* Slot map indicator for an empty slot */ -#define OCFS2_INVALID_SLOT -1 +#define OCFS2_INVALID_SLOT ((u16)-1) #define OCFS2_VOL_UUID_LEN 16 #define OCFS2_MAX_VOL_LABEL_LEN 64 -- 2.25.1