From patchwork Fri Jun 26 03:29:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 223003 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54D05C433DF for ; Fri, 26 Jun 2020 03:29:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 297FD208C9 for ; Fri, 26 Jun 2020 03:29:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593142182; bh=c9dYFhRT3mVmYx9tNYP7+Af3F0aNcfc8rcYBPx0okFg=; h=Date:From:To:Subject:In-Reply-To:List-ID:From; b=X6t2D1ItGIeCuYJjnFqRBWqh6jzEVohd5pRrOsPMul3lULQYxgCC7Bpdv5lPFQAEV dLYnb6AUkmG6JGiFc/mCLQsjZMs8kThISp5JYfLo13dIjvAmqdp2PIbk911Oys9kuo 7MZElEAMYRFpaZ6CTXQv5UGfwUp4FysNnr2WaSPk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728318AbgFZD3l (ORCPT ); Thu, 25 Jun 2020 23:29:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:48064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728333AbgFZD3l (ORCPT ); Thu, 25 Jun 2020 23:29:41 -0400 Received: from localhost.localdomain (c-71-198-47-131.hsd1.ca.comcast.net [71.198.47.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7C48420899; Fri, 26 Jun 2020 03:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593142180; bh=c9dYFhRT3mVmYx9tNYP7+Af3F0aNcfc8rcYBPx0okFg=; h=Date:From:To:Subject:In-Reply-To:From; b=hrlipQaRLn+SbSE5HcYLV0f7oOb1NHIjIRQjZ6oINMCGQWo43nPKyR9FOu13gJGa/ HRiBn7zPJwxuvMyA5DyNP5oGgHHKTWJrn+HsuYA//OP5xEYJmnVTaxIMPWvTnfFXX/ eCRCVU9cKy4wusC2Cq16xJ+aE/TgJrlsdLOeuZLA= Date: Thu, 25 Jun 2020 20:29:40 -0700 From: Andrew Morton To: akpm@linux-foundation.org, gechangwei@live.cn, ghe@suse.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, junxiao.bi@oracle.com, mark@fasheh.com, mm-commits@vger.kernel.org, piaojun@huawei.com, stable@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 08/32] ocfs2: fix value of OCFS2_INVALID_SLOT Message-ID: <20200626032940.e1Dlt7Co6%akpm@linux-foundation.org> In-Reply-To: <20200625202807.b630829d6fa55388148bee7d@linux-foundation.org> User-Agent: s-nail v14.8.16 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Junxiao Bi Subject: ocfs2: fix value of OCFS2_INVALID_SLOT 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 --- fs/ocfs2/ocfs2_fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ocfs2/ocfs2_fs.h~ocfs2-fix-value-of-ocfs2_invalid_slot +++ a/fs/ocfs2/ocfs2_fs.h @@ -290,7 +290,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