From patchwork Tue Jan 1 03:37:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 1019737 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mit.edu Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=mit.edu header.i=@mit.edu header.b="U4w7s9VM"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43TKdT2dlpz9sBQ for ; Tue, 1 Jan 2019 14:38:04 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729135AbfAADiD (ORCPT ); Mon, 31 Dec 2018 22:38:03 -0500 Received: from mail-eopbgr740112.outbound.protection.outlook.com ([40.107.74.112]:47856 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728381AbfAADiD (ORCPT ); Mon, 31 Dec 2018 22:38:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3HkbHz60m9PoNAxs/XD6TV/ITOxogQvwALw0pPNDPB4=; b=U4w7s9VMVGASMJrSZK9qf5cdVUJ74XwiMTWdD4t76y/1Gv8C+tv0BSMhjQF510SAZNkfSms+7VwRpzX86bdKdnhplA8XO2aOnK4p8frFg49eMjtf69FSdHXBRv1CBdXN/fUvmkc3SqIZL8JYX1oW+CjpOiG2CgCONwZsSe67VXM= Received: from MWHPR01CA0039.prod.exchangelabs.com (2603:10b6:300:101::25) by BYAPR01MB4024.prod.exchangelabs.com (2603:10b6:a03:16::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1471.20; Tue, 1 Jan 2019 03:37:58 +0000 Received: from CO1NAM03FT051.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::208) by MWHPR01CA0039.outlook.office365.com (2603:10b6:300:101::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1471.20 via Frontend Transport; Tue, 1 Jan 2019 03:37:58 +0000 Authentication-Results: spf=pass (sender IP is 18.9.28.11) smtp.mailfrom=mit.edu; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=mit.edu; Received-SPF: Pass (protection.outlook.com: domain of mit.edu designates 18.9.28.11 as permitted sender) receiver=protection.outlook.com; client-ip=18.9.28.11; helo=outgoing.mit.edu; Received: from outgoing.mit.edu (18.9.28.11) by CO1NAM03FT051.mail.protection.outlook.com (10.152.80.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1471.13 via Frontend Transport; Tue, 1 Jan 2019 03:37:58 +0000 Received: from callcc.thunk.org ([66.31.38.53]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id x013brAM030091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Dec 2018 22:37:54 -0500 Received: by callcc.thunk.org (Postfix, from userid 15806) id 7AD687A02FA; Mon, 31 Dec 2018 22:37:53 -0500 (EST) From: Theodore Ts'o To: Ext4 Developers List CC: , Theodore Ts'o , Subject: [PATCH] ext4: fix special inode number checks in __ext4_iget() Date: Mon, 31 Dec 2018 22:37:46 -0500 Message-ID: <20190101033746.4910-1-tytso@mit.edu> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181220191428.GA4895@kadam> References: <20181220191428.GA4895@kadam> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:18.9.28.11; IPV:CAL; SCL:-1; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(346002)(39860400002)(396003)(376002)(136003)(2980300002)(189003)(199004)(103686004)(90966002)(36756003)(47776003)(126002)(476003)(2616005)(478600001)(26826003)(76176011)(446003)(11346002)(1076003)(50466002)(48376002)(26005)(336012)(186003)(54906003)(106002)(52956003)(8936002)(8676002)(5660300001)(86362001)(6916009)(50226002)(6666004)(2906002)(246002)(14444005)(4326008)(75432002)(486006)(106466001)(52396003)(51416003)(36906005)(786003)(316002)(42186006)(356004)(6266002)(2870700001)(88552002)(305945005); DIR:OUT; SFP:1102; SCL:1; SRVR:BYAPR01MB4024; H:outgoing.mit.edu; FPR:; SPF:Pass; LANG:en; PTR:outgoing-auth-1.mit.edu; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT051; 1:3Q5IydbvfGA9FpvvaLqIZ2RZNkTWNo9BgxliZsbkIkB5YdQ6cCyQa/Ml0jzbOpc4B5t4TBOmBdNO1xxo/Um1L7aZl8bbB3MHU4EFVC4mcde7b2euQSQK3vIzoPiLmddl X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eed11ec0-b372-4e49-c6a6-08d66f9a8616 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4608076)(4709027)(2017052603328)(7153060); SRVR:BYAPR01MB4024; X-Microsoft-Exchange-Diagnostics: 1; BYAPR01MB4024; 3:QEnbj82bpSscs1CeHwH8aOoBkYIrLPBhgLGXGId+sjQ6ZzVXk+ILyl+YbOh+x/bi8ARU8jFrABYPRKW6ADPxl4gScVApOx678P7j4XmxxQcxOyB03yF2k2rB9kURSw4dqxLJqfuWJ6uvBMCyfvcNP+Ubi2PWdG9rkLZYwlFOuYLSRcICfEyHQ2Yi5UdMv+SkoGLdtjIsOf9QafgadCqdi2207lWb+DaGB563F2hmMdbAJr8y5SM8pB/ZKcfIChGBHPhp9aY7Bn9RSNYhvmEpQZaDO3tWhHFjL00draqomcqN3L1OjPRo5jIKOsVWZ+n7ML8lZDasXpFOGqkyppBS3g==; 25:2HU+z4297UC8LiW3c0KKl94B/9TiEFQQjzLPkgrwYZY6wnEDaaNR2tS/t+YtSriuavgIow8J0nc2LaKj36XAtoBQZJC/GPo6ws3qdIXMmstDinnCmUfhLvyLK6vaZoNsrN+Xy9LlTECIRd7DQB1jdmWfiEOne0CqldqPO4bVRA5KpUYWkaOFbLhowAIMNDaCxp2qncGSk7Nrud2bFxxRMF/Ick2vS0gsByXKldcA2idb0fS2uY2ijsTT2TH61bfObr0uz30f4oYq20DSVSmLMPHe2644uBpvLAhbHVl+7y4G7kJse/3yJss+GvXMZOLuGG2nIjplFKfpIOZvwg5rPA==; 31:OCNFK6syDIjFbGb/SEyNer44y4iRUno+QL2MemZcVsXmXKeaeuJfJZ7ClysaOgtQv3bSFv3K1e936iiNN3+Mr06RFNdv0KStlaXYgeAjBLnxjG518GYYt++VYVHmzs6khMSi89dVVSTKd/PLkqp6NAJTznaEWv1EgdEUfiMyW/SpjdNakB+hzqHSiSLIkvNGGwTReXpuMOqUoZfyFyu6x2ImUM6svvkbVLfM+im95fM= X-MS-TrafficTypeDiagnostic: BYAPR01MB4024: X-LD-Processed: 64afd9ba-0ecf-4acf-bc36-935f6235ba8b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; BYAPR01MB4024; 20:Cwyx3yyUApVQK3c0DpMwXDXJkx5BDvlU+FdCSI/hZGtsVJnqACKe6Hio6JdUsfgvMLIp4fflnQxf0rypdSqmP/O3VUU0BcwrJwgfbxwbUOJ0O+6PHXa502aCguz3+RgXjCHpG42Q0lamewHUFEqd08QjUYATU3tG+l1Iy/vBXVTOf1Yog7BSmDaiWP88hEjWoJ5gMd5KHtNOiCmF0d7OIUOPNCfJk0p9weD+bhfViUqfONGJQcHehw/VnIDmMi61tP8dS9X+jd4IVa8tREvhxyn5oDv8WkmEpDwirqPS5Yfhvf4mTo2iCmygPu+sTPuK1EKKttB7uC2pdk+hXtDFJ52yqnJgfJFH+v6GviBXBv/hocqQLt0WeKRnMcxCL9tLInG5guuFSgmHsyroGv4/cVzRXfTm8nTR3djO/1UohkCMaJAbtJjnq2gvip8LhsGpSsQF02R6OHPNRA7iXf+CMpH3EqrhzS2NMhOeocxHjP+dOuZGyI0YHf+IcI77CEOZ; 4:Ql0CdirjaTmcYUj4H7g0j9jna+D7mLAGN4hHCkp5yqnXJ1GPQJd8zRM+0BEaSjtwP5GCmxUM7vr9deZdkRKoquxGRypZNw6MnVXgDUQhILc+u+bd2PXmR7uMz3MY6RlgMO5ojltmvSufPXeqcBlLzJJQIAKbELcxhB1l7lOIvDpylqou6HqzcfBfYBhInNg8ueRkts98LDIQuqaJQpSQM4mTgFQ5Jhm9jknd4fKp8VzI0Nr98lgEbnNeGWAWtADsRmY+Kn3m2T7FMpx+wCSTDA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(10201501046)(93006095)(93004095)(3231475)(944501520)(52105112)(3002001)(6041310)(20161123564045)(201703131423095)(201702281528075)(201702281529075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:BYAPR01MB4024; BCL:0; PCL:0; RULEID:; SRVR:BYAPR01MB4024; X-Forefront-PRVS: 0904004ECB X-Microsoft-Exchange-Diagnostics: 1; BYAPR01MB4024; 23:9TsvdITsCGsQjS6yaaGkTQOb79j/yqfTVW1IW6qjxE71GxaPZAdTFvHc0k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2FBhtOM1iKCgshhkP3+HX8lTcEmB1zNZm3wnYcpIACIcYY9C+dcPn+yeXSJQnYl1wXpoh9faxCo= X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 0tzWoHLOTgOPfGqq0hV1ghd+PbjQA4bjRaciNjx5SCL7Ikz0OeT/p/3NmAWwtv2vNNhRGmkuFj8BjaTTpNu2TMh/wlUxvRl1XOrkUty7qRAfjYXILeJuRhixx9krWQe4g1DHRfSYn1lytXkGbL/iU8zJTyDN8iqMk4ueCi3svrB3vgbSghLP9UQ5eSHcap22Jsg9b8qQiGX8GXi+63lPRdorXtMWPfIt1S9vizVURS6JnYiYLCqfYfHIzFLoKj8H580+yjT16i4slbWWX6vkftq41pKSI0rurrGiU66JrcgfuQWlA/lwEv4coq5e5CO/ X-Microsoft-Exchange-Diagnostics: 1; BYAPR01MB4024; 6:+ty4gyhbuawOr2nm2dQ8F3U5GagORjidaXvd6oub8RTNAyG6HA2ow7y6btm8jbDrykysfRZZMh7HW9IB52V19PaT6Zn0DLhZtHTSvJNTG/1YCelMErICrDd7FaO+7WAvsPhQzf6nZySUcnAMV7N3SsMIFZONOih/uTsrSq8tlhcWLguFBOFSScj/wzflaps7sXMy7Ih6iicMIVuKB/Gb/+5GMNPF58N4964sMl3pqQPoBXNVvDT+F1UfPlwqt8Az9feZPZ6Z4k08fSeIzjlYmYafyxHAfD4D+CHC0rLiMGIAOyxhExHHIkuNCgVSBh3w168lxb4hlftXV5i4dcAsddstjbZISAhG15ZXmARKwC2g2NpWWtgONRnONrtTdBkwHQHIwEHMnbFmFyJa8k18aUgMWPdxN8HRZb9Tmk32XQzEYPSPPvlm401NPh79rUa17wSrMmrH7RYcIN7iDqub3Q==; 5:wAVUZsL+M8wwjQkAg3977V3GWYZvLB5QVJOwy2MrD2u8Dx0Q9jea6sK4ICaTi07kSo0kBZj0dY8aZ/7qwDA+2lTNeIvZlenuY2cah9JdD3Tm+o99PjE2imMw0J/lqdudsVFpHxkcuWXHGJG2qh0Xsp00DdL5nORnzJzxvZM6txg=; 7:7fzDwGvUDWoi2WRPESfGUWi/6/gVunKuAFJTUqCXsCK7Dim8Zb5n0GhZQpkPgyyhCP8/e6XxJxVlBYViGqCtkOKdy7kDwEeZyqsCiHQXIsfWI9AlTtseGRvBdzKNJtlRfX+KNAnLyOgY2l906JILVA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: mit.edu X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jan 2019 03:37:58.1508 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eed11ec0-b372-4e49-c6a6-08d66f9a8616 X-MS-Exchange-CrossTenant-Id: 64afd9ba-0ecf-4acf-bc36-935f6235ba8b X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=64afd9ba-0ecf-4acf-bc36-935f6235ba8b; Ip=[18.9.28.11]; Helo=[outgoing.mit.edu] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR01MB4024 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The check for special (reserved) inode number checks in __ext4_iget() was broken by commit 8a363970d1dc: ("ext4: avoid declaring fs inconsistent due to invalid file handles"). This was caused by a botched reversal of the sense of the flag now known as EXT4_IGET_SPECIAL (when it was previously named EXT4_IGET_NORMAL). Fix the logic appropriately. Fixes: 8a363970d1dc ("ext4: avoid declaring fs inconsistent...") Signed-off-by: Theodore Ts'o Reported-by: Dan Carpenter Cc: stable@kernel.org --- fs/ext4/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 165ff331d998..34d7e0703cc6 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4834,7 +4834,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, gid_t i_gid; projid_t i_projid; - if (((flags & EXT4_IGET_NORMAL) && + if ((!(flags & EXT4_IGET_SPECIAL) && (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO)) || (ino < EXT4_ROOT_INO) || (ino > le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count))) {