public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Fix possible UDF data corruption
@ 2007-05-24 16:59 Jan Kara
  2007-05-24 17:05 ` [PATCH 2/2] Fix possible leakage of blocks in UDF Jan Kara
  2007-05-24 17:20 ` [PATCH 1/2] Fix possible UDF data corruption Cyrill Gorcunov
  0 siblings, 2 replies; 41+ messages in thread
From: Jan Kara @ 2007-05-24 16:59 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Cyrill Gorcunov

[-- Attachment #1: Type: text/plain, Size: 338 bytes --]

  Hi Andrew,

  attached patch fixes possible data corruption in UDF - this bug was actually
introduced by one of my fixes :-( and should (if possible) go to Linus before
2.6.22 is out (that's why I'm diffing against Linus's tree and not the
latest changes in -mm tree)... Thanks.

								Honza

-- 
Jan Kara <jack@suse.cz>
SuSE CR Labs

[-- Attachment #2: udf-2.6.22-rc2-1-udf_data_corruption.diff --]
[-- Type: text/x-patch, Size: 1559 bytes --]

update_next_aext() could possibly rewrite values in elen and eloc, possibly
leading to data corruption when rewriting a file. Use temporary variables
instead. Also advance cur_epos as it can also point to an indirect extent
pointer.

Signed-off-by: Jan Kara <jack@suse.cz>

diff -rupX /home/jack/.kerndiffexclude linux-2.6.22-rc2/fs/udf/inode.c linux-2.6.22-rc2-1-udf_data_corruption/fs/udf/inode.c
--- linux-2.6.22-rc2/fs/udf/inode.c	2007-05-24 18:00:05.000000000 +0200
+++ linux-2.6.22-rc2-1-udf_data_corruption/fs/udf/inode.c	2007-05-24 18:16:36.000000000 +0200
@@ -460,8 +460,8 @@ static struct buffer_head * inode_getblk
 	kernel_long_ad laarr[EXTENT_MERGE_SIZE];
 	struct extent_position prev_epos, cur_epos, next_epos;
 	int count = 0, startnum = 0, endnum = 0;
-	uint32_t elen = 0;
-	kernel_lb_addr eloc;
+	uint32_t elen = 0, tmpelen;
+	kernel_lb_addr eloc, tmpeloc;
 	int c = 1;
 	loff_t lbcount = 0, b_off = 0;
 	uint32_t newblocknum, newblock;
@@ -520,8 +520,12 @@ static struct buffer_head * inode_getblk
 
 	b_off -= lbcount;
 	offset = b_off >> inode->i_sb->s_blocksize_bits;
-	/* Move into indirect extent if we are at a pointer to it */
-	udf_next_aext(inode, &prev_epos, &eloc, &elen, 0);
+	/*
+	 * Move prev_epos and cur_epos into indirect extent if we are at
+	 * the pointer to it
+	 */
+	udf_next_aext(inode, &prev_epos, &tmpeloc, &tmpelen, 0);
+	udf_next_aext(inode, &cur_epos, &tmpeloc, &tmpelen, 0);
 
 	/* if the extent is allocated and recorded, return the block
        if the extent is not a multiple of the blocksize, round up */

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2007-06-04 15:54 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-24 16:59 [PATCH 1/2] Fix possible UDF data corruption Jan Kara
2007-05-24 17:05 ` [PATCH 2/2] Fix possible leakage of blocks in UDF Jan Kara
2007-05-24 20:36   ` Jan Kara
2007-05-30 21:46     ` Eric Sandeen
2007-05-30 22:22       ` Eric Sandeen
2007-05-31 16:48         ` Cyrill Gorcunov
2007-05-31 17:42         ` Cyrill Gorcunov
2007-05-31 17:46           ` Eric Sandeen
2007-06-01 16:49             ` Cyrill Gorcunov
2007-06-01 17:04               ` Andrew Morton
2007-06-01 17:15                 ` Cyrill Gorcunov
2007-06-01 17:17                 ` Eric Sandeen
2007-06-01 17:48                   ` Cyrill Gorcunov
2007-06-01 17:51                     ` Eric Sandeen
2007-06-01 17:52                       ` Cyrill Gorcunov
2007-06-01 18:20                       ` Cyrill Gorcunov
2007-06-01 21:10       ` Jan Kara
2007-06-01 21:05         ` Eric Sandeen
2007-06-01 22:37         ` Eric Sandeen
2007-06-01 22:48           ` Andrew Morton
2007-06-02  5:17             ` Eric Sandeen
2007-06-02  5:43               ` Andrew Morton
2007-06-02  6:34                 ` Cyrill Gorcunov
2007-06-02  6:54                   ` Andrew Morton
2007-06-02  6:59                     ` Cyrill Gorcunov
2007-06-02  7:06                       ` Andrew Morton
2007-06-02 14:06                         ` Cyrill Gorcunov
2007-06-02 17:32                           ` Andrew Morton
2007-06-02 18:57                             ` Cyrill Gorcunov
2007-06-02 19:16                               ` Andrew Morton
2007-06-02 20:01                                 ` Cyrill Gorcunov
2007-06-02 22:49                                   ` Andrew Morton
2007-06-03  6:28                                     ` Cyrill Gorcunov
2007-06-03  7:22                                       ` Cyrill Gorcunov
2007-06-04 15:53         ` Cyrill Gorcunov
2007-05-24 17:20 ` [PATCH 1/2] Fix possible UDF data corruption Cyrill Gorcunov
2007-05-24 18:35   ` Andrew Morton
2007-05-24 18:53     ` Cyrill Gorcunov
2007-05-24 19:23     ` Cyrill Gorcunov
2007-05-24 19:36       ` Andrew Morton
2007-05-24 19:49         ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox