FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Sat May 15, 2021 05:07



Post new topic Reply to topic  [ 5 posts ] 
a bug of "ntfs-3g-2010.5.22.tgz" 
Author Message

Joined: Wed Jun 02, 2010 08:37
Posts: 3
Post a bug of "ntfs-3g-2010.5.22.tgz"
I am using the "ntfs-3g-2010.5.22.tgz", and I found a bug in it, but I don't know how to report this.

At line 1930 of "dir.c":

if (ntfs_mft_record_free(ni->vol, ni)) {
err = errno;
ntfs_log_error("Failed to free base MFT record. "
"Leaving inconsistent metadata.\n");
}
ni = NULL;

But I think it should be like this:
if (ntfs_mft_record_free(ni->vol, ni)) {
err = errno;
ntfs_log_error("Failed to free base MFT record. "
"Leaving inconsistent metadata.\n");
}
else
ni = NULL;

ni will be freed if ntfs_mft_record_free() return succsee, but not if ntfs_mft_record_free() return -1 and ni should be freed later.


Wed Jun 02, 2010 16:28
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: a bug of "ntfs-3g-2010.5.22.tgz"
Hi,

Quote:
I am using the "ntfs-3g-2010.5.22.tgz", and I found a bug in it, but I don't know how to report this.

Well, you have used a correct way.
Quote:
ni will be freed if ntfs_mft_record_free() return succsee, but not if ntfs_mft_record_free() return -1 and ni should be freed later.

Actually ni is expected to be freed in ntfs_mft_record_free() when successful, and clearing it in the caller prevents it to be closed and (possibly) freed again.
Now, if there was an error, ni is not freed. This could be intentional to prevent storing inconsistent data after the detection of a severe error and an unsuccessful try to rollback (at the expense of some memory leak).

Did you identify a circumstance where this code leads to an undesirable behavior ?

Regards

Jean-Pierre


Wed Jun 02, 2010 19:29
Profile

Joined: Wed Jun 02, 2010 08:37
Posts: 3
Post Re: a bug of "ntfs-3g-2010.5.22.tgz"
Hi,

ntfs_mft_record_free() always returns success in my test.

But In my opinion, ntfs_mft_record_free() could "prevent storing inconsistent data after the detection of a severe error and an unsuccessful try to rollback", even it returns -1. Why not free ni after ntfs_mft_record_free() return -1? Does it intent to cause memory leakage and detect it?


Sat Jun 05, 2010 03:01
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1286
Post Re: a bug of "ntfs-3g-2010.5.22.tgz"
Hi,

Quote:
Why not free ni after ntfs_mft_record_free() return -1? Does it intent to cause memory leakage and detect it?

Well, it is not easy to define a correct way to recover from an error which is supposed to never happen. Normal closing of ni is dangerous, it could create more pollution. Just a plain free() could create problems if ni was damaged by another record which overflowed.

This is the kind of things to not change unless an error scenario is identified, and the fix would be to prevent the scenario from occurring.

Regards

Jean-Pierre


Sat Jun 05, 2010 09:18
Profile

Joined: Wed Jun 02, 2010 08:37
Posts: 3
Post Re: a bug of "ntfs-3g-2010.5.22.tgz"
I got it, thanks for your reply! :)


Sun Jun 06, 2010 16:39
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.