Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2592267pxk; Sun, 20 Sep 2020 09:32:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+YilwtiNP7CwkFSeRE0JFZCGGxqoMOCHaMiB9jw8Phf5/ynMDT84vVH9xwVZhpU4x5Pj0 X-Received: by 2002:a17:906:4107:: with SMTP id j7mr47845024ejk.533.1600619556428; Sun, 20 Sep 2020 09:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600619556; cv=none; d=google.com; s=arc-20160816; b=zmYMTQhZ3HHp9dLLcF1NAQxPBjwfCwHl8UfdH5D+HyhwP4JTnWeFFAOl21lR6MCBHq 54lu5wFyhoG63FlBf0mqeSU4owZ4WR9lceNWZA76cujTDgV8i4mSFzlH8MXMXWhYT2/q 2sDcSm3kb2Dy5Xv3q/IDcMJhbQuLDjnOL54IxlbwVe2iHIw+IPRclF32z1DQds/W9+Nm pacp/nfHTIdW8VvBGCZ5l6mpK5y96U6YZrflHwW9SW3GCSYzZl+DngxahXM8bFTRDWF3 hRLMqUL9fNeq+Hj2kuowbG5EeKRX65XaAPqfu43GCQuXvKQwqWbT5Rvrqd1q0IwZg0ja Rp0Q== 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 :message-id:date:subject:cc:to:from; bh=LJwa4NCdFe+U3xCtv1Avkva1qO+xQjEGB3zkpr1HXjU=; b=JPAe2yOxV7cvhwjWqAEN3XUxMckRaN0DxvMUh9ZBcX8zfX15XYUfCIWcf+1MDJhZ/z XMYxGJNobLHi6L2iJfgexa8iTsCjT8cJXC8HIbVXLEyMjb3EHmyFSd3LqlJfuRfl41j4 DPny3yxs15b/Z6fx+dyaKC2u5buv1t+bRduLO2oUBjFLXuXnAj5Wy47vxT7ps6xVfSSQ n3rKRLnw49wjKEwq6qB+L+3s/Hk1uCDYg1SDArn1xABh4OHDtRZZc3JT1tzpbhTdLIKq 9lv8Cvm5akqKGhjNfl04oUUoTP0gnVgbXXiLwD1I9q4sGvaYaffDmgTHfNDbPpS1UzWm zYjQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bw19si6999671ejb.208.2020.09.20.09.32.11; Sun, 20 Sep 2020 09:32:36 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726326AbgITQaK (ORCPT + 99 others); Sun, 20 Sep 2020 12:30:10 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:52494 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726267AbgITQaJ (ORCPT ); Sun, 20 Sep 2020 12:30:09 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R261e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0U9VT.Ya_1600619405; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0U9VT.Ya_1600619405) by smtp.aliyun-inc.com(127.0.0.1); Mon, 21 Sep 2020 00:30:05 +0800 From: Tianjia Zhang To: Hugh Dickins , Andrew Morton , Al Viro , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Tianjia Zhang Subject: [PATCH] mm/shmem.c: Fix the missing unaccount on the failed path Date: Mon, 21 Sep 2020 00:30:05 +0800 Message-Id: <20200920163005.97079-1-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.3.ge56e4f7 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In function __shmem_file_setup(), shmem_unacct_size() is forgotten on the failed path, so add it. Fixes: 93dec2da7b234 ("... and switch shmem_file_setup() to alloc_file_pseudo()") Cc: Al Viro Signed-off-by: Tianjia Zhang --- mm/shmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 8e2b35ba93ad..591410dc3541 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -4200,8 +4200,10 @@ static struct file *__shmem_file_setup(struct vfsmount *mnt, const char *name, l if (!IS_ERR(res)) res = alloc_file_pseudo(inode, mnt, name, O_RDWR, &shmem_file_operations); - if (IS_ERR(res)) + if (IS_ERR(res)) { iput(inode); + shmem_unacct_size(flags, size); + } return res; } -- 2.19.1.3.ge56e4f7