Re: pagevec: Fix array-index-out-of-bounds error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Matthew,

Thank you for your reply, agree with you its seems wrong fix,
will take a look at it.

-Atul
On Fri, Aug 25, 2023 at 02:56:28AM +0100, Matthew Wilcox wrote:
On Thu, Aug 24, 2023 at 05:17:21PM -0700, Atul Raut wrote:
 ntfs_evict_inode+0x20/0x48 fs/ntfs3/inode.c:1790

No.  This is your clue.  ntfs corrupts memory.  You can't take bug
reports involving ntfs seriously.  Ignore everything tagged with ntfs.

In folio_batch_add, which contains folios rather
than fixed-size pages, there is a chance that the
array index will fall outside of bounds.
Before adding folios, examine the available space to fix.

This is definitely the wrong fix.

 static inline unsigned folio_batch_add(struct folio_batch *fbatch,
 		struct folio *folio)
 {
-	fbatch->folios[fbatch->nr++] = folio;
+	if (folio_batch_space(fbatch))
+		fbatch->folios[fbatch->nr++] = folio;

Did you look at what folio_batch_space() actually does?

static inline unsigned int folio_batch_space(struct folio_batch *fbatch)
{
       return PAGEVEC_SIZE - fbatch->nr;
}

So if fbatch->nr is 255, what will it return?  How will
folio_batch_add() behave?

The right way to fix this problem is to find the data corrupter in NTFS.
You can't "fix" it anywhere else.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux