lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 16 Dec 2022 10:09:00 -0800
From:   Viacheslav Dubeyko <slava@...eyko.com>
To:     ChenXiaoSong <chenxiaosong2@...wei.com>
Cc:     Bart Van Assche <bvanassche@....org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Aditya Garg <gargaditya08@...e.com>,
        Jens Axboe <axboe@...nel.dk>,
        "Matthew Wilcox (Oracle)" <willy@...radead.org>,
        Damien Le Moal <damien.lemoal@...nsource.wdc.com>,
        Jeff Layton <jlayton@...nel.org>, hannes@...xchg.org,
        "Theodore Y . Ts'o" <tytso@....edu>, muchun.song@...ux.dev,
        Linux FS Devel <linux-fsdevel@...r.kernel.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] hfsplus: fix uninit-value in hfsplus_delete_cat()



> On Dec 15, 2022, at 5:16 PM, ChenXiaoSong <chenxiaosong2@...wei.com> wrote:
> 
> 在 2022/12/16 3:03, Viacheslav Dubeyko 写道:
>> Maybe, I am missing something. But where in the second version of the patch
>> initialization of subfolders?
> 
> The first patch of the patchset factor out hfsplus_init_inode() from hfsplus_new_inode():
> 
> void hfsplus_init_inode(struct hfsplus_inode_info *hip)
> {
>        INIT_LIST_HEAD(&hip->open_dir_list);
>        spin_lock_init(&hip->open_dir_lock);
>        mutex_init(&hip->extents_lock);
>        atomic_set(&hip->opencnt, 0);
>        hip->extent_state = 0;
>        hip->flags = 0;
>        hip->userflags = 0;
>        hip->subfolders = 0; /* I am here */
>        memset(hip->first_extents, 0, sizeof(hfsplus_extent_rec));
>        memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec));
>        hip->alloc_blocks = 0;
>        hip->first_blocks = 0;
>        hip->cached_start = 0;
>        hip->cached_blocks = 0;
>        hip->phys_size = 0;
>        hip->fs_blocks = 0;
>        hip->rsrc_inode = NULL;
> }

As far as I can see, you sent 0/2, 1/2, 2/2 patches in second version. And patch 1/2 contains
only this:

diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index 6aa919e59483..2aa719e00ae5 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -472,6 +472,7 @@ extern const struct dentry_operations hfsplus_dentry_operations;

int hfsplus_write_begin(struct file *file, struct address_space *mapping,
		loff_t pos, unsigned len, struct page **pagep, void **fsdata);
+void hfsplus_init_inode(struct hfsplus_inode_info *hip);
struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
				umode_t mode);
void hfsplus_delete_inode(struct inode *inode);
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 840577a0c1e7..d921b32d292e 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -379,22 +379,8 @@ static const struct file_operations hfsplus_file_operations = {
	.unlocked_ioctl = hfsplus_ioctl,
};

-struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
-				umode_t mode)
+void hfsplus_init_inode(struct hfsplus_inode_info *hip)
{
-	struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
-	struct inode *inode = new_inode(sb);
-	struct hfsplus_inode_info *hip;
-
-	if (!inode)
-		return NULL;
-
-	inode->i_ino = sbi->next_cnid++;
-	inode_init_owner(&init_user_ns, inode, dir, mode);
-	set_nlink(inode, 1);
-	inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
-
-	hip = HFSPLUS_I(inode);
	INIT_LIST_HEAD(&hip->open_dir_list);
	spin_lock_init(&hip->open_dir_lock);
	mutex_init(&hip->extents_lock);
@@ -412,6 +398,25 @@ struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
	hip->phys_size = 0;
	hip->fs_blocks = 0;
	hip->rsrc_inode = NULL;
+}
+
+struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
+				umode_t mode)
+{
+	struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
+	struct inode *inode = new_inode(sb);
+	struct hfsplus_inode_info *hip;
+
+	if (!inode)
+		return NULL;
+
+	inode->i_ino = sbi->next_cnid++;
+	inode_init_owner(&init_user_ns, inode, dir, mode);
+	set_nlink(inode, 1);
+	inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
+
+	hip = HFSPLUS_I(inode);
+	hfsplus_init_inode(hip);
	if (S_ISDIR(inode->i_mode)) {
		inode->i_size = 2;
		sbi->folder_count++;
-- 
2.31.1

So, where is here hip->subfolders = 0; /* I am here */? Sorry, maybe I missed some email.

Thanks,
Slava.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ