Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp328721ybt; Fri, 26 Jun 2020 00:00:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH+yu3sCtKuqNKw0mGNBi3AweXuMCp6GvoQivEicxCNfrGilqJ7A/K2O69jUemA/Vax9Xv X-Received: by 2002:aa7:dc57:: with SMTP id g23mr1836234edu.352.1593154853523; Fri, 26 Jun 2020 00:00:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1593154853; cv=pass; d=google.com; s=arc-20160816; b=F+6IivaQ/BO3orv1gYZsaAwbuC4rHC9oM+jyxfyB27nB6ILpkoWxQFh9NkAYtXnKOc XdPp1AVc5UI48KU42QykpdjBPh+L1u5VVxUGvAIDxgaaoYWQZyeivQX4L8zNiGP2X0uf cBZ0+lK9bYrtjn7F6G6zMHbdpAqdv2VVFZUkJaSke7h5+t+PP5zVPFQRJVDU7gnAZoVQ NjXd9HYydK9asrs5/9KzTGAZPyw4YBNEKiQwb76ejPt+x0X6L5z16V6CjLZ3jaB/r4D4 8lW7GW4wf3PfcS8xQ/gXPVnuhSTjyXrYkXDnC809Z1E3Dg3LLWstxQTM4voRI5kRiN6G i8Xw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :date:subject:message-id:cc:to:from:dkim-signature; bh=Q/wZPfYcGHuLtlPMV76jVmP66spWX1/75D/PQMqytOc=; b=SWncGQ2vgYgPEv6aEAUSxpByA3nQYMD9XWFxlLYCqvoBIwZCqJPVc4/t86RbKkJMJT dZH6dbEfTO97K4JsHXhT8N+m3JtQMNDJxLr31Qr4eJm3JDVRLG4ARSyoYEhJ5ZhWPMZe 3tWKKKjmPxaguo/Cu3g64QhGCsFhy+K7nP5Bx5p8WdONNIglrwNLyLG489DIS3Tp9yAy Zu/ztM/EY8X++cRZ0WcJCnDQ6/laJuaflg8XBmlYMtI0is23ShJZlJTPIukXJ1+Us5md A4Ux+x9prfnZfC1sreTazGpPrjJd29zbB5URGp+cZZMN1DBwUU8sJSbO1WLKp8RtIcJX aGLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mykernel.net header.s=zohomail header.b=SW2jVGfh; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k1si16605346ejb.562.2020.06.26.00.00.20; Fri, 26 Jun 2020 00:00:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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=@mykernel.net header.s=zohomail header.b=SW2jVGfh; arc=pass (i=1 spf=pass spfdomain=mykernel.net dkim=pass dkdomain=mykernel.net dmarc=pass fromdomain=mykernel.net>); spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728069AbgFZFuV (ORCPT + 99 others); Fri, 26 Jun 2020 01:50:21 -0400 Received: from sender2-op-o12.zoho.com.cn ([163.53.93.243]:17150 "EHLO sender2-op-o12.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728012AbgFZFuV (ORCPT ); Fri, 26 Jun 2020 01:50:21 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1593150613; cv=none; d=zoho.com.cn; s=zohoarc; b=BZ9Jp6Rww9yaIclh4XgDQB+LOPTZl7Xhwpbejbem/4bp5odHa4rDcES55auBIcU9+Usbpq/j3R1VQeDMcejjoVNQwtWbKmD0ccAzvMDrXLdzDVxaQwSNIeYy0/SdnzhVchkHfMi4KXdVc9+UY1y4Jjhg9bPHKZgYW87/C5t4Xvs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1593150613; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=Q/wZPfYcGHuLtlPMV76jVmP66spWX1/75D/PQMqytOc=; b=cWgkAyo9yh/0SIVPOUbYrNvFk2kzXpuYtxiyecB+iYp84sSzID1eqsi9xBlc9VQnmp4VH+i8E9h6Kn5G4/0CyavRqWng/0StU2Bkpg05runP0Ajqx700FBeyMk3mXVorctHVklSWN9A4Q2k30wrEVLyMakUWTzK4XOfoZL+lK1o= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=mykernel.net; spf=pass smtp.mailfrom=cgxu519@mykernel.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1593150613; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:To:Cc:Message-ID:Subject:Date:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=Q/wZPfYcGHuLtlPMV76jVmP66spWX1/75D/PQMqytOc=; b=SW2jVGfhfR3/J1VuIkjWj32xxhJFiTFLuhDw57hCq//RXtuw3ErluDeDLpD7T6kc FbIpDo3gMteQ84x8YtfCOkkSDjxrXBPYJ133Aau8zeKI0QHvff4DD50QzzqX7VFDNn5 RBlJYWJ1ElzPe9zIyWieH2kLpSIoWPufWB6OWds4= Received: from localhost.localdomain (116.30.194.71 [116.30.194.71]) by mx.zoho.com.cn with SMTPS id 1593150610473828.0364217997824; Fri, 26 Jun 2020 13:50:10 +0800 (CST) From: Chengguang Xu To: jack@suse.com Cc: linux-ext4@vger.kernel.org, Chengguang Xu Message-ID: <20200626054959.114177-1-cgxu519@mykernel.net> Subject: [PATCH] ext2: initialize quota info in ext2_xattr_set() Date: Fri, 26 Jun 2020 13:49:59 +0800 X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External Content-Type: text/plain; charset=utf8 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org In order to correctly account/limit space usage, should initialize quota info before calling quota related functions. Signed-off-by: Chengguang Xu --- fs/ext2/xattr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index 943cc469f42f..913e5c4921ec 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c @@ -437,6 +437,9 @@ ext2_xattr_set(struct inode *inode, int name_index, con= st char *name, =09name_len =3D strlen(name); =09if (name_len > 255 || value_len > sb->s_blocksize) =09=09return -ERANGE; +=09error =3D dquot_initialize(inode); +=09if (error) +=09=09return error; =09down_write(&EXT2_I(inode)->xattr_sem); =09if (EXT2_I(inode)->i_file_acl) { =09=09/* The inode already has an extended attribute block. */ --=20 2.26.2