Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1922870pxb; Mon, 13 Sep 2021 08:14:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcGWsh9K3Gn8/0fvm0JQR/pvn+NmRGuzpBS2DV33R2tvlrHTKdfjSIVqARRf1Tfx5vzKVG X-Received: by 2002:a92:cd8b:: with SMTP id r11mr8867714ilb.136.1631546088458; Mon, 13 Sep 2021 08:14:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631546088; cv=none; d=google.com; s=arc-20160816; b=sCoYVyX4df0lrHRELqBvoIA/nMho+ZE1vtaNEeNMpS92hbBtGfokndvPgM4jbU3exB aYIybKwS6mHZBnvqykKjvzXGx0wa6waVaAdxKwj8K+/xVFxRVfoIa7NnxvoY6FeD4le4 bUwmAhwp/RCVl1OWAedo9hOkRLoWQni1jjRavzWTeBOuHMkJ/+Ff00Sc6kLqGD2DVMPX KB/q4gW90nDnRtHBbDNO3YZ/T5df8LZwXXL3UZOwEu1rz9LeKya5zScT1eEpRXZawUVO VZWF75oVgGuVhqG6sr/OQXmwumH6oIAPcyhVhvjMhcJi/IUZi4q9apNaBWSHKWPYL16q r+uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:cc :references:to:from:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=yJHpnfO2XyPKYiuXAIOMsx6Rrjs+v6RJzRc0invVEfk=; b=TqMpqXNxFEs1hLUJ1+P2s619e8gxfi2UbzgXAHzwqnzEGDQRMaQ7Og6d2riTHJ2HWj ouRSAFciuKgDNqyivSkqo/OMVeZ/XnJWlWFx1UIZvRavGOSP2GI5+qeM0kq1qgpykNfr 0A6pHcUCt1clQImw4Jp9plVUmPb3NJNk1PhFyoC4S9I6IoRJHD5sjiS2k6bCup9G8I5l hgUC6tuMGaoBqNydVhVrLLG1Dkdfwydt5SeQ+WD9E8yyLMjhnxHb6HNRJBR0cvQCVZt1 4LAeSd9jpZo5xsb0GmK6uG4RDkYtwBFiQz8hQjoday2rwXpPrX7/QEgUmsOQDb3IxR0L yk3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=TkluKFH6; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x6si7330494ilv.42.2021.09.13.08.14.34; Mon, 13 Sep 2021 08:14:48 -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; dkim=pass header.i=@paragon-software.com header.s=mail header.b=TkluKFH6; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244906AbhIMPO0 (ORCPT + 99 others); Mon, 13 Sep 2021 11:14:26 -0400 Received: from relaydlg-01.paragon-software.com ([81.5.88.159]:34552 "EHLO relaydlg-01.paragon-software.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346468AbhIMPOQ (ORCPT ); Mon, 13 Sep 2021 11:14:16 -0400 Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relaydlg-01.paragon-software.com (Postfix) with ESMTPS id 228DA82267; Mon, 13 Sep 2021 18:12:59 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1631545979; bh=yJHpnfO2XyPKYiuXAIOMsx6Rrjs+v6RJzRc0invVEfk=; h=Date:Subject:From:To:References:CC:In-Reply-To; b=TkluKFH6eMbHQKllAKbH7gXd/hulbUrazley5kAmT67JEjzw4n+Dxli4LicR9cEdT WzDJNJJIJdrMnYs6P1F9uvQgd/cyKKgb2NWW5ESQbxA0hDQ2q2rgC/UhtFAUd8iH0K TbuvrZzfgPT4tTBOpd1Z9qvzJ44bA/5z7iVW+/iA= Received: from [192.168.211.103] (192.168.211.103) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 13 Sep 2021 18:12:58 +0300 Message-ID: <9fd8b3d5-2f1e-29c3-282a-d2276b5d0db9@paragon-software.com> Date: Mon, 13 Sep 2021 18:12:58 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: [PATCH 1/3] fs/ntfs3: Fix insertion of attr in ni_ins_attr_ext Content-Language: en-US From: Konstantin Komarov To: References: CC: , In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.211.103] X-ClientProxiedBy: vobn-exch-01.paragon-software.com (172.30.72.13) To vdlg-exch-02.paragon-software.com (172.30.1.105) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do not try to insert attribute if there is no room in record. Signed-off-by: Konstantin Komarov --- fs/ntfs3/frecord.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index 938b12d56ca6..834cb361f61f 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -956,6 +956,13 @@ static int ni_ins_attr_ext(struct ntfs_inode *ni, struct ATTR_LIST_ENTRY *le, continue; } + /* + * Do not try to insert this attribute + * if there is no room in record. + */ + if (le32_to_cpu(mi->mrec->used) + asize > sbi->record_size) + continue; + /* Try to insert attribute into this subrecord. */ attr = ni_ins_new_attr(ni, mi, le, type, name, name_len, asize, name_off, svcn, ins_le); -- 2.33.0