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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 24 Jun 2008 14:34:17 +0100
From:	"Duane Griffin" <duaneg@...da.com>
To:	akpm@...ux-foundation.org
Cc:	duaneg@...da.com, linux-ext4@...r.kernel.org
Subject: Re: + ext3-handle-corrupted-orphan-list-at-mount-cleanup.patch
	added to -mm tree

On Mon, Jun 23, 2008 at 04:43:13PM -0700, akpm@...ux-foundation.org wrote:
> Subject: ext3-handle-corrupted-orphan-list-at-mount-cleanup
> From: Andrew Morton <akpm@...ux-foundation.org>
> 
> Try to make that expression less mind-boggling.
> 
> Cc: <linux-ext4@...r.kernel.org>
> Cc: Duane Griffin <duaneg@...da.com>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
> ---
> 
>  fs/ext3/inode.c |   14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff -puN fs/ext3/inode.c~ext3-handle-corrupted-orphan-list-at-mount-cleanup fs/ext3/inode.c
> --- a/fs/ext3/inode.c~ext3-handle-corrupted-orphan-list-at-mount-cleanup
> +++ a/fs/ext3/inode.c
> @@ -2258,10 +2258,16 @@ static void ext3_free_branches(handle_t 
>  
>  int ext3_can_truncate(struct inode *inode)
>  {
> -	return (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
> -		S_ISLNK(inode->i_mode)) &&
> -		!ext3_inode_is_fast_symlink(inode) &&
> -		!(IS_APPEND(inode) || IS_IMMUTABLE(inode));
> +	if (S_ISREG(inode->i_mode))
> +		return 1;
> +	if (S_ISDIR(inode->i_mode))
> +		return 1;
> +	if (S_ISLNK(inode->i_mode)) {
> +		if (!ext3_inode_is_fast_symlink(inode) &&
> +				!(IS_APPEND(inode) || IS_IMMUTABLE(inode)))
> +			return 1;
> +	}
> +	return 0;
>  }
>  
>  /*

Proving your point, the cleanup above is wrong. It should be:

--- fs/ext3/inode.c.orig	2008-06-24 14:19:06.000000000 +0100
+++ fs/ext3/inode.c	2008-06-24 14:19:19.000000000 +0100
@@ -2255,10 +2255,15 @@ static void ext3_free_branches(handle_t 
 
 int ext3_can_truncate(struct inode *inode)
 {
-	return (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
-		S_ISLNK(inode->i_mode)) &&
-		!ext3_inode_is_fast_symlink(inode) &&
-		!(IS_APPEND(inode) || IS_IMMUTABLE(inode));
+        if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
+                return 0;
+        if (S_ISREG(inode->i_mode))
+                return 1;
+        if (S_ISDIR(inode->i_mode))
+                return 1;
+        if (S_ISLNK(inode->i_mode))
+                return !ext3_inode_is_fast_symlink(inode);
+        return 0;
 }
 
 /*

-- 
"I never could learn to drink that blood and call it wine" - Bob Dylan
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists