From mboxrd@z Thu Jan 1 00:00:00 1970 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=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 59D55C4338F for ; Wed, 25 Aug 2021 07:15:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A52BB610FB for ; Wed, 25 Aug 2021 07:15:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A52BB610FB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id BDF808D0001; Wed, 25 Aug 2021 03:15:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B90CD6B0071; Wed, 25 Aug 2021 03:15:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A09128D0001; Wed, 25 Aug 2021 03:15:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id 82B726B006C for ; Wed, 25 Aug 2021 03:15:00 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 29E9D8249980 for ; Wed, 25 Aug 2021 07:15:00 +0000 (UTC) X-FDA: 78512741160.16.08B7A6E Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf29.hostedemail.com (Postfix) with ESMTP id 8D7EF9000249 for ; Wed, 25 Aug 2021 07:14:59 +0000 (UTC) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 17P1N2Mt001052; Wed, 25 Aug 2021 07:14:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2021-07-09; bh=lD8oQiLarQc4ZSvJll4+hEEqRMfsPd120pElFhqqdlM=; b=iQPzjKtW88duLw8pWI/a1i3GLmlFVrHf8Yu58jZWiEbnLR4P2eftdCHojg1YkPs88C+Q OfOmbk1yjTnGUXsWcHvAWsU+Rkxi2qH4sxKeGKHh1XyPAP3abrA9DqWMP+QfQgtLbuF8 ZkXoyyDwIe9o7rmbqpKZ+OQexbbC6vN0EfxrF4sJNrG+lOATVqwnrEtfmg0RfzsvBcYA XC0DKLegQuLR7A0mS3nhmyrn7hh2aqSFyphtN9Hq9MqH5e9e7c5H6gY+6lwOv0qAbkDj od7U9CblNWPA8E5br7ZAYBB6UPvuNyy2DOiZgcNRNxeLj1ZHfh9L90q463dazC0bfK1O gw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2020-01-29; bh=lD8oQiLarQc4ZSvJll4+hEEqRMfsPd120pElFhqqdlM=; b=AkOK3mXkU2YgfSY+6rggCto+fZC1NOaAU+lYsY0kqeQkTS88YVxTVYJ4WTjgRbl40hcg OcY2qoOE63z5/lFntdkr3zLAHkm2+blctNUrmkksknoYrdj7kox+MzDSqvp1pi5UTw0x 3JZSjQlsOgVFsjPLICuPgda0LFsX9MWgAPYhGlf0TR/WZMwMiOe1XFlkqO+MqYOpTB/z 4GiNzy6RviAW2HZjja92XH2ut+1QjzJjpSrbnctrlXS8arMk/el919fdwKjE5cx8fFQm IHiU0V3EhE6CHcpbRlHnks0eAnW1oXG6yfKUrFje41KEREMQgAnPbyo1iqOXkoj6WVgD lQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3amvtvtte8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Aug 2021 07:14:50 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 17P75Q2p100264; Wed, 25 Aug 2021 07:14:49 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2171.outbound.protection.outlook.com [104.47.55.171]) by aserp3030.oracle.com with ESMTP id 3ajqhg2muy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Aug 2021 07:14:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ap4690BV2IeKbaGLg0zvg9Fa/tuVgauU824f/HSN/RCZqXEJLD+pREhe4XWYXLgowsK9dpmXvQqwUJW06xmbOeuFmGYI9fT9v5wvPfnHu67Ox3BhglZ1NnIqXUK0ldWdFvFZ+I50oasSk/SvVtPuT4iCqT1OdpuPWfL22AmGVXNytf8rYyNeJ7/p0bh+FZFBkIWrcJ1nOCJGFuT81O0xsT0Da0JGx9Pm5XAy6Se5AQYxYuam5+w2ezqrHezwlNv765kTN6xhHdMELcOTfK+85yq4nqwPSkTXQ3qynBsy9DeI8sWgKG1UJ1L/XVKfMpen91fUntgHh1cTuSHdbMUCnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lD8oQiLarQc4ZSvJll4+hEEqRMfsPd120pElFhqqdlM=; b=YpCQqfpVZyno81WDppqG0i2DSQTPGrozqOAOdAmkcKJUaOdtWKHCfFWOebEZRTmA69mvGjGlU99taesHy98Z/AiNmTL3r6yfo+/w2t58UDKanowHUMSojD0kMB8nSf6r9zZhvZSFoo+dEt4cej9e1ZGzG3MrsapTcbC/tFoDRsXPR4sjv3fsJpMydZBbg4c28Ivfst2WXhXBU+lWXN9x443huq1nZ4osrhg9+JcGMSU+/RFsK8eDNRckMeJmb+xE8P/iYN3zaqJMrVIHyGfVZbegLg86hmSi4liOf4eqJ3hz590bJGArgxlxGE68NK645SKgaRXjTbgKLuhJFuJxnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lD8oQiLarQc4ZSvJll4+hEEqRMfsPd120pElFhqqdlM=; b=jd4vNGqQZxT4ZktTurgptZlEdHYWlLadhNAdS1uGfrFDVdXUb4kXpwaX740gB9T0hOKocER1/aAGeY7YRiFiV+GSHEumPn5vOa95xlXGOZ780RIXhPwGxUb1NnwVNHiyS8CbV9k1bdgJD64x0jfTV0MjD9F13BhDTikmW6ffCpM= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by MWHPR1001MB2160.namprd10.prod.outlook.com (2603:10b6:301:36::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.21; Wed, 25 Aug 2021 07:14:46 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5820:e42b:73d7:4268]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::5820:e42b:73d7:4268%7]) with mapi id 15.20.4457.018; Wed, 25 Aug 2021 07:14:46 +0000 Date: Wed, 25 Aug 2021 10:14:27 +0300 From: Dan Carpenter To: kbuild@lists.01.org, Gao Xiang Cc: lkp@intel.com, kbuild-all@lists.01.org, Linux Memory Management List , Liu Bo , Chao Yu , Chao Yu Subject: [linux-next:master 8625/10077] fs/erofs/inode.c:210 erofs_read_inode() error: double free of 'copied' Message-ID: <202108251030.bELQozR7-lkp@intel.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: JNXP275CA0042.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:18::30) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from kadam (62.8.83.99) by JNXP275CA0042.ZAFP275.PROD.OUTLOOK.COM (2603:1086:0:18::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.17 via Frontend Transport; Wed, 25 Aug 2021 07:14:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 96480799-80cb-47e0-c322-08d967980476 X-MS-TrafficTypeDiagnostic: MWHPR1001MB2160: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:59; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ubFCMDGT/hj2bjHc9erzTmmK7bseWeT8DAamVwfbXRpLBbMYLpDmhvBPAfnrWVi3Cr3yadQ3qFM9nV9J/WdxhVfjbDugxZ2KgPTOjHqz3wytQ43c+9GYrhrrWnLovXkzPLNWVR9dCXtYbSj7APD2RgllxOUIfotj6uBEMcwhg58Rtytw6libZooGNlcsLAJvHC00a9FXTIL960a8Zf4GqytVIdkmtkLlJdEKlNa9NHoSxAnmVJiFmMw+lOuWmqP90ETVJIIAu19vNOKBG3bYvzoLJZFY1jbC4TSM0vhMjJ4y3IF/TjPc/GwvGpEkjBwhqacE3M8Su3c4sUHtlfWZCmjwj+ko0ifo+Iyva8BGChFB82xdJdAPV2RqeOwwZpMIbTYx/7CQ4Tb/4WdUxpR5ouk26JlK/G3EgYzBhG1HUh4v0FJNKX5lyDVyaIwyRj0+yLQxsnYy/ZP1AvBQpNol1PTbD10dvsPwCh4OOcVXK0TJVTkFlEuohEyyIkiJyRB0lglcCyOh+MspSC1LZvxlbeuDIOICxAPDt5nWKmKQCu3TpAnK6ytP4bCIAn3xyJdzimvm0dQduqYgrQEN8+AfRqwi5EXcKVrC9S7OLIP5t/ZsB3EKNs5burJmBTdNNIPNCxv5d8xx8TFcduVoNdhkEQ1L1WI1SaKGqAFPK/iEtMFpZuXEsaLzpjIWKZybuqDGeAqeI9neDi0DcTrkwaMOxu/ENld6uMDVPN4jN+cFnqHScYBC2zs8tqa1iT4e6Z7qiREgsKc7QacR040/dShWdXXE+vig8M3SrJpY91GOcs3Nibn8VryO2vo9GlkrTob472W2ggTDqcRDsm9ffUcVhg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2365.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(39860400002)(346002)(136003)(366004)(396003)(8676002)(956004)(44832011)(30864003)(26005)(966005)(2906002)(186003)(52116002)(6496006)(9686003)(478600001)(6486002)(4326008)(83380400001)(38350700002)(38100700002)(86362001)(54906003)(1076003)(66946007)(6916009)(66476007)(66556008)(6666004)(36756003)(8936002)(316002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?V0mHPyT/QkBoZvhpJptOq2BU2vQLElq2qf2IIurjLQnE4P/Jd5khYA5i45AI?= =?us-ascii?Q?MFU/kEtowEgZb1P+pqpqkobmHS28OOhZ1Ilp9KFZnqlx/gKwa+R0qho4uTZV?= =?us-ascii?Q?hw3c8yYwUXpAARkrwZM74CnGK1EMLoQdU59HufQrmTRJe1gRmu9prxsp7G9C?= =?us-ascii?Q?LB7/g96INJEOAevktyRgURaP43jwtFfHqPsiq+1mpbh+5FAcsUFnLkZQdbMZ?= =?us-ascii?Q?AMpSq8RUDK1cw7+2+YEy/BhVcDfHObFUP8eSYKrSqR7Ue+IrUxEuhW+UlwZ8?= =?us-ascii?Q?MtgF/ohQSZK4xAxVDlFyJQ8BFKfNvC7LpiqT3+dJVDL8JYT/ugrGzY9MG+B9?= =?us-ascii?Q?qNqmMbW62h5isYFiAas8542YIx7MkCKANBnIqA58N1snqBq3cR9LOAZkfG/8?= =?us-ascii?Q?lQ3kqHchzkVa3f/q8hjTaRd1yTK4cAaIJvCa0FKiok89vcJjNZtkrUg/fLNA?= =?us-ascii?Q?zQyFADobChfyA8yzlcK+mswfptImD7+9gZZmPlzRAXHMZf/DaqDqUuRGu2BW?= =?us-ascii?Q?C19oNXZlu5+K6kixbLcq6mcLfayMkMvWxpdNZrcXeJ8/mJZ290M20+v8YZ6e?= =?us-ascii?Q?eNs8LCNJz26HFgd/XcJlNoanwT9OZSEps5WFM2DEEBCRoWDiDhcznzZh5flR?= =?us-ascii?Q?9Gx6coCdbFGRsBW5HGOqD7wXuETyJlqhnySoFP0w9OhUtap1oEHYlxaBgHYt?= =?us-ascii?Q?yqCBGbs0xMLCjGeeFIRzsFYFWgIejPBw7PN94x4Dukl3IKebJigxY29ueNzR?= =?us-ascii?Q?kG1tLK0vbP4z+qyg+41npL6f+oZKaFjKIlSSlvbYlvynI0FYTpu4ApKcJLka?= =?us-ascii?Q?SWUA9uPNyriRGBT+cBMm3dr4+wN8rlabayNlnPsc73NHKCOrOhbRY9T7BCgf?= =?us-ascii?Q?EjTajbj8Vjd6IBz3wuMtYIsFpzgBSiJNjmWGrrLd9ino+zZ7sXR0WzM8/0I5?= =?us-ascii?Q?0bvelrvGU7ZlmHtxucNZr5eYK82OEnP4wN+hr+IXb0HYl4lUFcBkm65m5Ojx?= =?us-ascii?Q?V6eVOJjhNXtly16JmYJSMxset5ejZSGZVB4LlA/xJRxoiA4iXalmA5X3TdTy?= =?us-ascii?Q?nR7IEGpawYVLMmunayIyHBRl6AkunGPrvBA7mZJWz0yuU8Y7zOixxZO7zb1F?= =?us-ascii?Q?MaY2nTkjA1jRbf9Kfl+kSiRJuG0xWi0PhQAwJ7Z93cSziccQ+xAOTfutasAA?= =?us-ascii?Q?DM7WbT/3EA9q7WTIhjHg9iguz400tmAYP/a+LrfX+5mbjVFE4KpX9uLlhvlJ?= =?us-ascii?Q?SnC4FBUicblSzdpVZCt0996Es8sO3ghtkWLZadkZpZlDJu4DGdtVtH/Wh6+B?= =?us-ascii?Q?AHSoCuqcUL13V97GaqGSxgDJ?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96480799-80cb-47e0-c322-08d967980476 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2021 07:14:46.1210 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fcuPBsnoOTdHi0nFW9usthUGtHo4rDWyjnjYy5FjzjdmQpNcosndRLj6JixVx45mSudgv3yUoen7CAryFM3gjUtUJS/mS7SQ0wJzTq3rWQA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2160 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10086 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxlogscore=999 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108250042 X-Proofpoint-ORIG-GUID: g830liK_XuhShz4OWEHuvkNtQ2xlZNci X-Proofpoint-GUID: g830liK_XuhShz4OWEHuvkNtQ2xlZNci Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=iQPzjKtW; dkim=pass header.d=oracle.com header.s=corp-2020-01-29 header.b=AkOK3mXk; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=jd4vNGqQ; dmarc=pass (policy=none) header.from=oracle.com; spf=none (imf29.hostedemail.com: domain of dan.carpenter@oracle.com has no SPF policy when checking 205.220.165.32) smtp.mailfrom=dan.carpenter@oracle.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8D7EF9000249 X-Stat-Signature: efc1szmz83dqojb9im1odk48ks9bjm14 X-HE-Tag: 1629875699-352742 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 372b2891c15acbf7b90d948b08ac174bde77102c commit: c5aa903a59db274554718cddfda9039913409ec9 [8625/10077] erofs: support reading chunk-based uncompressed files config: openrisc-randconfig-m031-20210824 (attached as .config) compiler: or1k-linux-gcc (GCC) 11.2.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot Reported-by: Dan Carpenter New smatch warnings: fs/erofs/inode.c:210 erofs_read_inode() error: double free of 'copied' vim +/copied +210 fs/erofs/inode.c 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 16 static struct page *erofs_read_inode(struct inode *inode, 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 17 unsigned int *ofs) 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 18 { 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 19 struct super_block *sb = inode->i_sb; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 20 struct erofs_sb_info *sbi = EROFS_SB(sb); a5876e24f13f134 fs/erofs/inode.c Gao Xiang 2019-09-04 21 struct erofs_inode *vi = EROFS_I(inode); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 22 const erofs_off_t inode_loc = iloc(sbi, vi->nid); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 23 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 24 erofs_blk_t blkaddr, nblks = 0; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 25 struct page *page; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 26 struct erofs_inode_compact *dic; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 27 struct erofs_inode_extended *die, *copied = NULL; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 28 unsigned int ifmt; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 29 int err; 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 30 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 31 blkaddr = erofs_blknr(inode_loc); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 32 *ofs = erofs_blkoff(inode_loc); 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 33 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 34 erofs_dbg("%s, reading inode nid %llu at %u of blkaddr %u", 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 35 __func__, vi->nid, *ofs, blkaddr); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 36 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 37 page = erofs_get_meta_page(sb, blkaddr); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 38 if (IS_ERR(page)) { 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 39 erofs_err(sb, "failed to get inode (nid: %llu) page, err %ld", 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 40 vi->nid, PTR_ERR(page)); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 41 return page; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 42 } 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 43 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 44 dic = page_address(page) + *ofs; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 45 ifmt = le16_to_cpu(dic->i_format); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 46 24a806d849c0b0c fs/erofs/inode.c Gao Xiang 2021-03-29 47 if (ifmt & ~EROFS_I_ALL) { 24a806d849c0b0c fs/erofs/inode.c Gao Xiang 2021-03-29 48 erofs_err(inode->i_sb, "unsupported i_format %u of nid %llu", 24a806d849c0b0c fs/erofs/inode.c Gao Xiang 2021-03-29 49 ifmt, vi->nid); 24a806d849c0b0c fs/erofs/inode.c Gao Xiang 2021-03-29 50 err = -EOPNOTSUPP; 24a806d849c0b0c fs/erofs/inode.c Gao Xiang 2021-03-29 51 goto err_out; 24a806d849c0b0c fs/erofs/inode.c Gao Xiang 2021-03-29 52 } 24a806d849c0b0c fs/erofs/inode.c Gao Xiang 2021-03-29 53 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 54 vi->datalayout = erofs_inode_datalayout(ifmt); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 55 if (vi->datalayout >= EROFS_INODE_DATALAYOUT_MAX) { 4f761fa253b49f6 fs/erofs/inode.c Gao Xiang 2019-09-04 56 erofs_err(inode->i_sb, "unsupported datalayout %u of nid %llu", 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 57 vi->datalayout, vi->nid); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 58 err = -EOPNOTSUPP; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 59 goto err_out; 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 60 } 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 61 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 62 switch (erofs_inode_version(ifmt)) { 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 63 case EROFS_INODE_LAYOUT_EXTENDED: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 64 vi->inode_isize = sizeof(struct erofs_inode_extended); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 65 /* check if the inode acrosses page boundary */ 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 66 if (*ofs + vi->inode_isize <= PAGE_SIZE) { 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 67 *ofs += vi->inode_isize; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 68 die = (struct erofs_inode_extended *)dic; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 69 } else { 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 70 const unsigned int gotten = PAGE_SIZE - *ofs; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 71 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 72 copied = kmalloc(vi->inode_isize, GFP_NOFS); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 73 if (!copied) { 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 74 err = -ENOMEM; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 75 goto err_out; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 76 } 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 77 memcpy(copied, dic, gotten); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 78 unlock_page(page); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 79 put_page(page); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 80 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 81 page = erofs_get_meta_page(sb, blkaddr + 1); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 82 if (IS_ERR(page)) { 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 83 erofs_err(sb, "failed to get inode payload page (nid: %llu), err %ld", 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 84 vi->nid, PTR_ERR(page)); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 85 kfree(copied); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 86 return page; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 87 } 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 88 *ofs = vi->inode_isize - gotten; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 89 memcpy((u8 *)copied + gotten, page_address(page), *ofs); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 90 die = copied; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 91 } 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 92 vi->xattr_isize = erofs_xattr_ibody_size(die->i_xattr_icount); 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 93 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 94 inode->i_mode = le16_to_cpu(die->i_mode); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 95 switch (inode->i_mode & S_IFMT) { 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 96 case S_IFREG: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 97 case S_IFDIR: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 98 case S_IFLNK: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 99 vi->raw_blkaddr = le32_to_cpu(die->i_u.raw_blkaddr); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 100 break; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 101 case S_IFCHR: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 102 case S_IFBLK: d5beb31b6b1c0a3 drivers/staging/erofs/inode.c Chao Yu 2018-07-26 103 inode->i_rdev = 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 104 new_decode_dev(le32_to_cpu(die->i_u.rdev)); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 105 break; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 106 case S_IFIFO: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 107 case S_IFSOCK: d5beb31b6b1c0a3 drivers/staging/erofs/inode.c Chao Yu 2018-07-26 108 inode->i_rdev = 0; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 109 break; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 110 default: a6b9b1d5eae61a6 drivers/staging/erofs/inode.c Gao Xiang 2019-08-14 111 goto bogusimode; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 112 } 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 113 i_uid_write(inode, le32_to_cpu(die->i_uid)); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 114 i_gid_write(inode, le32_to_cpu(die->i_gid)); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 115 set_nlink(inode, le32_to_cpu(die->i_nlink)); 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 116 d3938ee23e97bfc fs/erofs/inode.c Gao Xiang 2020-11-01 117 /* extended inode has its own timestamp */ d3938ee23e97bfc fs/erofs/inode.c Gao Xiang 2020-11-01 118 inode->i_ctime.tv_sec = le64_to_cpu(die->i_ctime); d3938ee23e97bfc fs/erofs/inode.c Gao Xiang 2020-11-01 119 inode->i_ctime.tv_nsec = le32_to_cpu(die->i_ctime_nsec); 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 120 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 121 inode->i_size = le64_to_cpu(die->i_size); fe6d98750cf0459 drivers/staging/erofs/inode.c Gao Xiang 2019-05-28 122 fe6d98750cf0459 drivers/staging/erofs/inode.c Gao Xiang 2019-05-28 123 /* total blocks for compressed files */ 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 124 if (erofs_inode_is_data_compressed(vi->datalayout)) 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 125 nblks = le32_to_cpu(die->i_u.compressed_blocks); c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 126 else if (vi->datalayout == EROFS_INODE_CHUNK_BASED) c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 127 /* fill chunked inode summary info */ c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 128 vi->chunkformat = le16_to_cpu(die->i_u.c.format); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 129 kfree(copied); ^^^^^^^^^^^^^^ Free 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 130 break; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 131 case EROFS_INODE_LAYOUT_COMPACT: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 132 vi->inode_isize = sizeof(struct erofs_inode_compact); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 133 *ofs += vi->inode_isize; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 134 vi->xattr_isize = erofs_xattr_ibody_size(dic->i_xattr_icount); 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 135 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 136 inode->i_mode = le16_to_cpu(dic->i_mode); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 137 switch (inode->i_mode & S_IFMT) { 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 138 case S_IFREG: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 139 case S_IFDIR: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 140 case S_IFLNK: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 141 vi->raw_blkaddr = le32_to_cpu(dic->i_u.raw_blkaddr); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 142 break; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 143 case S_IFCHR: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 144 case S_IFBLK: d5beb31b6b1c0a3 drivers/staging/erofs/inode.c Chao Yu 2018-07-26 145 inode->i_rdev = 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 146 new_decode_dev(le32_to_cpu(dic->i_u.rdev)); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 147 break; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 148 case S_IFIFO: 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 149 case S_IFSOCK: d5beb31b6b1c0a3 drivers/staging/erofs/inode.c Chao Yu 2018-07-26 150 inode->i_rdev = 0; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 151 break; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 152 default: a6b9b1d5eae61a6 drivers/staging/erofs/inode.c Gao Xiang 2019-08-14 153 goto bogusimode; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 154 } 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 155 i_uid_write(inode, le16_to_cpu(dic->i_uid)); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 156 i_gid_write(inode, le16_to_cpu(dic->i_gid)); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 157 set_nlink(inode, le16_to_cpu(dic->i_nlink)); 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 158 d3938ee23e97bfc fs/erofs/inode.c Gao Xiang 2020-11-01 159 /* use build time for compact inodes */ d3938ee23e97bfc fs/erofs/inode.c Gao Xiang 2020-11-01 160 inode->i_ctime.tv_sec = sbi->build_time; d3938ee23e97bfc fs/erofs/inode.c Gao Xiang 2020-11-01 161 inode->i_ctime.tv_nsec = sbi->build_time_nsec; 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 162 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 163 inode->i_size = le32_to_cpu(dic->i_size); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 164 if (erofs_inode_is_data_compressed(vi->datalayout)) 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 165 nblks = le32_to_cpu(dic->i_u.compressed_blocks); c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 166 else if (vi->datalayout == EROFS_INODE_CHUNK_BASED) c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 167 vi->chunkformat = le16_to_cpu(dic->i_u.c.format); 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 168 break; 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 169 default: 4f761fa253b49f6 fs/erofs/inode.c Gao Xiang 2019-09-04 170 erofs_err(inode->i_sb, 4f761fa253b49f6 fs/erofs/inode.c Gao Xiang 2019-09-04 171 "unsupported on-disk inode version %u of nid %llu", 8a76568225deae1 fs/erofs/inode.c Gao Xiang 2019-09-04 172 erofs_inode_version(ifmt), vi->nid); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 173 err = -EOPNOTSUPP; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 174 goto err_out; 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 175 } 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 176 c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 177 if (vi->datalayout == EROFS_INODE_CHUNK_BASED) { c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 178 if (!(vi->chunkformat & EROFS_CHUNK_FORMAT_ALL)) { c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 179 erofs_err(inode->i_sb, c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 180 "unsupported chunk format %x of nid %llu", c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 181 vi->chunkformat, vi->nid); c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 182 err = -EOPNOTSUPP; c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 183 goto err_out; c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 184 } c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 185 vi->chunkbits = LOG_BLOCK_SIZE + c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 186 (vi->chunkformat & EROFS_CHUNK_FORMAT_BLKBITS_MASK); c5aa903a59db274 fs/erofs/inode.c Gao Xiang 2021-08-20 187 } d3938ee23e97bfc fs/erofs/inode.c Gao Xiang 2020-11-01 188 inode->i_mtime.tv_sec = inode->i_ctime.tv_sec; d3938ee23e97bfc fs/erofs/inode.c Gao Xiang 2020-11-01 189 inode->i_atime.tv_sec = inode->i_ctime.tv_sec; d3938ee23e97bfc fs/erofs/inode.c Gao Xiang 2020-11-01 190 inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec; d3938ee23e97bfc fs/erofs/inode.c Gao Xiang 2020-11-01 191 inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec; d3938ee23e97bfc fs/erofs/inode.c Gao Xiang 2020-11-01 192 06252e9ce05b94b fs/erofs/inode.c Gao Xiang 2021-08-05 193 inode->i_flags &= ~S_DAX; 06252e9ce05b94b fs/erofs/inode.c Gao Xiang 2021-08-05 194 if (test_opt(&sbi->ctx, DAX_ALWAYS) && S_ISREG(inode->i_mode) && 06252e9ce05b94b fs/erofs/inode.c Gao Xiang 2021-08-05 195 vi->datalayout == EROFS_INODE_FLAT_PLAIN) 06252e9ce05b94b fs/erofs/inode.c Gao Xiang 2021-08-05 196 inode->i_flags |= S_DAX; fe6d98750cf0459 drivers/staging/erofs/inode.c Gao Xiang 2019-05-28 197 if (!nblks) fe6d98750cf0459 drivers/staging/erofs/inode.c Gao Xiang 2019-05-28 198 /* measure inode.i_blocks as generic filesystems */ fe6d98750cf0459 drivers/staging/erofs/inode.c Gao Xiang 2019-05-28 199 inode->i_blocks = roundup(inode->i_size, EROFS_BLKSIZ) >> 9; fe6d98750cf0459 drivers/staging/erofs/inode.c Gao Xiang 2019-05-28 200 else fe6d98750cf0459 drivers/staging/erofs/inode.c Gao Xiang 2019-05-28 201 inode->i_blocks = nblks << LOG_SECTORS_PER_BLOCK; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 202 return page; a6b9b1d5eae61a6 drivers/staging/erofs/inode.c Gao Xiang 2019-08-14 203 a6b9b1d5eae61a6 drivers/staging/erofs/inode.c Gao Xiang 2019-08-14 204 bogusimode: 4f761fa253b49f6 fs/erofs/inode.c Gao Xiang 2019-09-04 205 erofs_err(inode->i_sb, "bogus i_mode (%o) @ nid %llu", 4f761fa253b49f6 fs/erofs/inode.c Gao Xiang 2019-09-04 206 inode->i_mode, vi->nid); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 207 err = -EFSCORRUPTED; 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 208 err_out: a6b9b1d5eae61a6 drivers/staging/erofs/inode.c Gao Xiang 2019-08-14 209 DBG_BUGON(1); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 @210 kfree(copied); ^^^^^^^^^^^^^ Double free. 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 211 unlock_page(page); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 212 put_page(page); 0dcd3c94e02438f fs/erofs/inode.c Gao Xiang 2020-07-30 213 return ERR_PTR(err); 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 214 } 431339ba90423a0 drivers/staging/erofs/inode.c Gao Xiang 2018-07-26 215 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org