Skip to contentSkip to conversation

ocfs2: Fix panic on kfree(xattr->name)

PATCH In review Tetsuo Handa 3 participants 6 messages Mar 19, 2014 – Mar 28, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 ocfs2: Fix panic on kfree(xattr->name)

Quoted 4 lines · Tariq Saeed

This commit did not take into account the callers of this function who assume they need to kfree() the name. It causes panic in ocfs2 on create file. I am puzzled how did this commit got into the tree without changing the callsites to NOT call kfree anymore. Am I missing something?

You are right. It is my mistake. I didn't realize that ocfs2 is calling kfree() on the name field. Would you please test below patch?

Regards.
----------

Quoted 1 line

From 3940749700148f58265407987f813b773515661a Mon Sep 17 00:00:00 2001

From: Tetsuo Handa <[email protected]>
Date: Wed, 19 Mar 2014 21:49:21 +0900
Subject: [PATCH] ocfs2: Fix panic on kfree(xattr->name)

Commit 9548906b 'xattr: Constify ->name member of "struct xattr".' missed that ocfs2 is calling kfree(xattr->name). As a result, kernel panic occurs upon calling kfree(xattr->name) because xattr->name refers static constant names. This patch removes kfree(xattr->name) from ocfs2_mknod() and ocfs2_symlink().

---
 fs/ocfs2/namei.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
fs/ocfs2/namei.c +0 -2
index 3683643..feed025 100644
@@ -450,7 +450,6 @@ leave:
 
 	brelse(new_fe_bh);
 	brelse(parent_fe_bh);
-	kfree(si.name);
 	kfree(si.value);
 
 	ocfs2_free_dir_lookup_result(&lookup);
@@ -1855,7 +1854,6 @@ bail:
 
 	brelse(new_fe_bh);
 	brelse(parent_fe_bh);
-	kfree(si.name);
 	kfree(si.value);
 	ocfs2_free_dir_lookup_result(&lookup);
 	if (inode_ac)
Signature · 1 line
1.7.1
#2 lore raw

The patch works. What is the plan for submitting to mainline? Thanks,
-Tariq

Quoted 49 lines · Tetsuo Handa
Quoted 4 lines · Tariq Saeed

This commit did not take into account the callers of this function who assume they need to kfree() the name. It causes panic in ocfs2 on create file. I am puzzled how did this commit got into the tree without changing the callsites to NOT call kfree anymore. Am I missing something?

You are right. It is my mistake. I didn't realize that ocfs2 is calling kfree() on the name field. Would you please test below patch?

Regards.
----------

Quoted 1 line

From 3940749700148f58265407987f813b773515661a Mon Sep 17 00:00:00 2001

From: Tetsuo Handa <[email protected]>
Date: Wed, 19 Mar 2014 21:49:21 +0900
Subject: [PATCH] ocfs2: Fix panic on kfree(xattr->name)

Commit 9548906b 'xattr: Constify ->name member of "struct xattr".' missed that ocfs2 is calling kfree(xattr->name). As a result, kernel panic occurs upon calling kfree(xattr->name) because xattr->name refers static constant names. This patch removes kfree(xattr->name) from ocfs2_mknod() and ocfs2_symlink().

---
  fs/ocfs2/namei.c |    2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
fs/ocfs2/namei.c +0 -2
index 3683643..feed025 100644
@@ -450,7 +450,6 @@ leave:
 
  	brelse(new_fe_bh);
  	brelse(parent_fe_bh);
-	kfree(si.name);
  	kfree(si.value);
 
  	ocfs2_free_dir_lookup_result(&lookup);
@@ -1855,7 +1854,6 @@ bail:
 
  	brelse(new_fe_bh);
  	brelse(parent_fe_bh);
-	kfree(si.name);
  	kfree(si.value);
  	ocfs2_free_dir_lookup_result(&lookup);
  	if (inode_ac)
#3 lore raw

Thank you for testing.

Mark and Joel, would you pick up this patch via your tree?

Quoted 55 lines · Tariq Saeed

The patch works. What is the plan for submitting to mainline? Thanks,
-Tariq

Quoted 49 lines · Tetsuo Handa
Quoted 4 lines · Tariq Saeed

This commit did not take into account the callers of this function who assume they need to kfree() the name. It causes panic in ocfs2 on create file. I am puzzled how did this commit got into the tree without changing the callsites to NOT call kfree anymore. Am I missing something?

You are right. It is my mistake. I didn't realize that ocfs2 is calling kfree() on the name field. Would you please test below patch?

Regards.
----------

Quoted 1 line

From 3940749700148f58265407987f813b773515661a Mon Sep 17 00:00:00 2001

From: Tetsuo Handa <[email protected]>
Date: Wed, 19 Mar 2014 21:49:21 +0900
Subject: [PATCH] ocfs2: Fix panic on kfree(xattr->name)

Commit 9548906b 'xattr: Constify ->name member of "struct xattr".' missed that ocfs2 is calling kfree(xattr->name). As a result, kernel panic occurs upon calling kfree(xattr->name) because xattr->name refers static constant names. This patch removes kfree(xattr->name) from ocfs2_mknod() and ocfs2_symlink().

---
  fs/ocfs2/namei.c |    2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
fs/ocfs2/namei.c +0 -2
index 3683643..feed025 100644
@@ -450,7 +450,6 @@ leave:
 
  	brelse(new_fe_bh);
  	brelse(parent_fe_bh);
-	kfree(si.name);
  	kfree(si.value);
 
  	ocfs2_free_dir_lookup_result(&lookup);
@@ -1855,7 +1854,6 @@ bail:
 
  	brelse(new_fe_bh);
  	brelse(parent_fe_bh);
-	kfree(si.name);
  	kfree(si.value);
  	ocfs2_free_dir_lookup_result(&lookup);
  	if (inode_ac)
#5 lore raw
Quoted 3 lines · Tariq Saeed
Quoted 1 line · Tariq Saeed

The patch works. What is the plan for submitting to mainline

can you please submit this patch to mainline.

No response from ocfs2 folks.
James, Al, can you pick up this patch?

----------

Quoted 1 line

From 3940749700148f58265407987f813b773515661a Mon Sep 17 00:00:00 2001

From: Tetsuo Handa <[email protected]>
Date: Wed, 19 Mar 2014 21:49:21 +0900
Subject: [PATCH] ocfs2: Fix panic on kfree(xattr->name)

Commit 9548906b 'xattr: Constify ->name member of "struct xattr".' missed that ocfs2 is calling kfree(xattr->name). As a result, kernel panic occurs upon calling kfree(xattr->name) because xattr->name refers static constant names. This patch removes kfree(xattr->name) from ocfs2_mknod() and ocfs2_symlink().

---
 fs/ocfs2/namei.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
fs/ocfs2/namei.c +0 -2
index 3683643..feed025 100644
@@ -450,7 +450,6 @@ leave:
 
 	brelse(new_fe_bh);
 	brelse(parent_fe_bh);
-	kfree(si.name);
 	kfree(si.value);
 
 	ocfs2_free_dir_lookup_result(&lookup);
@@ -1855,7 +1854,6 @@ bail:
 
 	brelse(new_fe_bh);
 	brelse(parent_fe_bh);
-	kfree(si.name);
 	kfree(si.value);
 	ocfs2_free_dir_lookup_result(&lookup);
 	if (inode_ac)
Signature · 1 line
1.7.1
#6 lore raw
Quoted 7 lines · Tetsuo Handa
Quoted 3 lines · Tariq Saeed
Quoted 1 line · Tariq Saeed

The patch works. What is the plan for submitting to mainline

can you please submit this patch to mainline.

No response from ocfs2 folks.
James, Al, can you pick up this patch?

This needs to go in via Al or akpm.