* [PATCH 0/3] UDF overflow fix and cleanups
@ 2013-02-05 14:40 Jan Kara
2013-02-05 14:40 ` [PATCH 1/3] udf: Fix bitmap overflow on large filesystems with small block size Jan Kara
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jan Kara @ 2013-02-05 14:40 UTC (permalink / raw)
To: linux-fsdevel
Hi,
I've added the three patches in this series to my tree and plan to
merge them in the next merge window. The first patch fixes an overflow
in handling large filesystems with small block size, the other two
patches are just cleanups.
Honza
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] udf: Fix bitmap overflow on large filesystems with small block size
2013-02-05 14:40 [PATCH 0/3] UDF overflow fix and cleanups Jan Kara
@ 2013-02-05 14:40 ` Jan Kara
2013-02-05 14:40 ` [PATCH 2/3] udf: Make s_block_bitmap standard array Jan Kara
2013-02-05 14:40 ` [PATCH 3/3] udf: Remove unused s_extLength from udf_bitmap Jan Kara
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2013-02-05 14:40 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Jan Kara
For large UDF filesystems with 512-byte blocks the number of necessary
bitmap blocks is larger than 2^16 so s_nr_groups in udf_bitmap overflows
(the number will overflow for filesystems larger than 128 GB with
512-byte blocks). That results in ENOSPC errors despite the filesystem
has plenty of free space.
Fix the problem by changing s_nr_groups' type to 'int'. That is enough
even for filesystems 2^32 blocks (UDF maximum) and 512-byte blocksize.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/udf/udf_sb.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
index 5f02722..8d1c9d4 100644
--- a/fs/udf/udf_sb.h
+++ b/fs/udf/udf_sb.h
@@ -82,7 +82,7 @@ struct udf_virtual_data {
struct udf_bitmap {
__u32 s_extLength;
__u32 s_extPosition;
- __u16 s_nr_groups;
+ int s_nr_groups;
struct buffer_head **s_block_bitmap;
};
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] udf: Make s_block_bitmap standard array
2013-02-05 14:40 [PATCH 0/3] UDF overflow fix and cleanups Jan Kara
2013-02-05 14:40 ` [PATCH 1/3] udf: Fix bitmap overflow on large filesystems with small block size Jan Kara
@ 2013-02-05 14:40 ` Jan Kara
2013-02-05 14:40 ` [PATCH 3/3] udf: Remove unused s_extLength from udf_bitmap Jan Kara
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2013-02-05 14:40 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Jan Kara
struct udf_bitmap has array of buffer pointers attached to it. The code
unnecessarily used s_block_bitmap as a pointer to the array instead of
the standard trick of using 0 length array in the declaration. Change
that to make code more readable and actually shrink the structure by one
pointer.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/udf/super.c | 1 -
fs/udf/udf_sb.h | 2 +-
2 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index da8ce9f..f883080 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1023,7 +1023,6 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index)
if (bitmap == NULL)
return NULL;
- bitmap->s_block_bitmap = (struct buffer_head **)(bitmap + 1);
bitmap->s_nr_groups = nr_groups;
return bitmap;
}
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
index 8d1c9d4..4f7ddb7 100644
--- a/fs/udf/udf_sb.h
+++ b/fs/udf/udf_sb.h
@@ -83,7 +83,7 @@ struct udf_bitmap {
__u32 s_extLength;
__u32 s_extPosition;
int s_nr_groups;
- struct buffer_head **s_block_bitmap;
+ struct buffer_head *s_block_bitmap[0];
};
struct udf_part_map {
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] udf: Remove unused s_extLength from udf_bitmap
2013-02-05 14:40 [PATCH 0/3] UDF overflow fix and cleanups Jan Kara
2013-02-05 14:40 ` [PATCH 1/3] udf: Fix bitmap overflow on large filesystems with small block size Jan Kara
2013-02-05 14:40 ` [PATCH 2/3] udf: Make s_block_bitmap standard array Jan Kara
@ 2013-02-05 14:40 ` Jan Kara
2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2013-02-05 14:40 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Jan Kara
s_extLength was assigned to but the value was never really used. So
just remove the field.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/udf/super.c | 4 ----
fs/udf/udf_sb.h | 1 -
2 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index f883080..bc5b30a 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1080,8 +1080,6 @@ static int udf_fill_partdesc_info(struct super_block *sb,
if (!bitmap)
return 1;
map->s_uspace.s_bitmap = bitmap;
- bitmap->s_extLength = le32_to_cpu(
- phd->unallocSpaceBitmap.extLength);
bitmap->s_extPosition = le32_to_cpu(
phd->unallocSpaceBitmap.extPosition);
map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP;
@@ -1116,8 +1114,6 @@ static int udf_fill_partdesc_info(struct super_block *sb,
if (!bitmap)
return 1;
map->s_fspace.s_bitmap = bitmap;
- bitmap->s_extLength = le32_to_cpu(
- phd->freedSpaceBitmap.extLength);
bitmap->s_extPosition = le32_to_cpu(
phd->freedSpaceBitmap.extPosition);
map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP;
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
index 4f7ddb7..ed401e9 100644
--- a/fs/udf/udf_sb.h
+++ b/fs/udf/udf_sb.h
@@ -80,7 +80,6 @@ struct udf_virtual_data {
};
struct udf_bitmap {
- __u32 s_extLength;
__u32 s_extPosition;
int s_nr_groups;
struct buffer_head *s_block_bitmap[0];
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-05 14:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-05 14:40 [PATCH 0/3] UDF overflow fix and cleanups Jan Kara
2013-02-05 14:40 ` [PATCH 1/3] udf: Fix bitmap overflow on large filesystems with small block size Jan Kara
2013-02-05 14:40 ` [PATCH 2/3] udf: Make s_block_bitmap standard array Jan Kara
2013-02-05 14:40 ` [PATCH 3/3] udf: Remove unused s_extLength from udf_bitmap Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).