~ubuntu-branches/ubuntu/utopic/parted/utopic-proposed

« back to all changes in this revision

Viewing changes to debian/patches/fat-ntfs-large-sectors.patch

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-04-14 11:56:10 UTC
  • Revision ID: package-import@ubuntu.com-20140414115610-uqo3ngjcok5nsi4w
Tags: 2.3-19ubuntu1
* Upload from Debian git repository to fix a release-critical bug.
* Fix crash when opening FAT file systems (LP: #1306704).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 3d8df854148da2c5178f5a286bbef6db26c0a9d7 Mon Sep 17 00:00:00 2001
 
1
From ba9dd9e3bf56f3f6650f8dd45edc219ba666ef60 Mon Sep 17 00:00:00 2001
2
2
From: Phillip Susi <psusi@ubuntu.com>
3
3
Date: Sun, 6 Apr 2014 19:13:07 -0400
4
4
Subject: Fix fat and ntfs detection on non 512 byte sectors
7
7
code to differentiate between those filesystem boot sectors and an msdos
8
8
MBR, but the code crashed with non 512 byte sector sizes.
9
9
 
10
 
Last-Update: 2014-04-08
 
10
Last-Update: 2014-04-14
11
11
 
12
12
Patch-Name: fat-ntfs-large-sectors.patch
13
13
---
14
 
 libparted/fs/fat/bootsector.c | 23 ++++++-----------------
15
 
 libparted/fs/fat/bootsector.h |  2 +-
16
 
 libparted/fs/fat/fat.c        | 42 ++++++++++++++++++++++++------------------
 
14
 libparted/fs/fat/bootsector.c | 31 +++++++++++--------------------
 
15
 libparted/fs/fat/bootsector.h |  4 ++--
 
16
 libparted/fs/fat/fat.c        | 40 +++++++++++++++++++++++-----------------
17
17
 libparted/fs/fat/fat.h        |  4 ++--
18
18
 libparted/fs/fat/resize.c     |  8 ++++----
19
19
 libparted/fs/fat/table.c      |  4 ++--
20
20
 libparted/fs/ntfs/ntfs.c      | 10 +++++-----
21
 
 7 files changed, 44 insertions(+), 49 deletions(-)
 
21
 7 files changed, 49 insertions(+), 52 deletions(-)
22
22
 
23
23
diff --git a/libparted/fs/fat/bootsector.c b/libparted/fs/fat/bootsector.c
24
 
index b987918..5e75561 100644
 
24
index b987918..30891fa 100644
25
25
--- a/libparted/fs/fat/bootsector.c
26
26
+++ b/libparted/fs/fat/bootsector.c
27
27
@@ -36,13 +36,14 @@
74
74
                          * fs_info->logical_sector_size;
75
75
                fs_info->root_cluster
76
76
                        = PED_LE32_TO_CPU (bs->u.fat32.root_dir_cluster);
 
77
@@ -395,15 +384,17 @@ fat_boot_sector_write (const FatBootSector* bs, PedFileSystem* fs)
 
78
 }
 
79
 
 
80
 int
 
81
-fat_info_sector_read (FatInfoSector* is, const PedFileSystem* fs)
 
82
+fat_info_sector_read (FatInfoSector** isp, const PedFileSystem* fs)
 
83
 {
 
84
        FatSpecific*    fs_info = FAT_SPECIFIC (fs);
 
85
        int             status;
 
86
 
 
87
-       PED_ASSERT (is != NULL, return 0);
 
88
+       PED_ASSERT (isp != NULL, return 0);
 
89
 
 
90
-       if (!ped_geometry_read (fs->geom, is, fs_info->info_sector_offset, 1))
 
91
+       if (!ped_geometry_read_alloc (fs->geom, (void **)isp,
 
92
+                                     fs_info->info_sector_offset, 1))
 
93
                return 0;
 
94
+       FatInfoSector *is = *isp;
 
95
 
 
96
        if (PED_LE32_TO_CPU (is->signature_2) != FAT32_INFO_MAGIC2) {
 
97
                status = ped_exception_throw (PED_EXCEPTION_WARNING,
77
98
diff --git a/libparted/fs/fat/bootsector.h b/libparted/fs/fat/bootsector.h
78
 
index 5a12fdf..6f743f1 100644
 
99
index 5a12fdf..f063e94 100644
79
100
--- a/libparted/fs/fat/bootsector.h
80
101
+++ b/libparted/fs/fat/bootsector.h
81
102
@@ -117,7 +117,7 @@ struct __attribute__ ((packed)) _FatInfoSector {
83
104
 };
84
105
 
85
106
-int fat_boot_sector_read (FatBootSector* bs, const PedGeometry* geom);
86
 
+int fat_boot_sector_read (FatBootSector** bs, const PedGeometry* geom);
 
107
+int fat_boot_sector_read (FatBootSector** bsp, const PedGeometry* geom);
87
108
 FatType fat_boot_sector_probe_type (const FatBootSector* bs,
88
109
                                    const PedGeometry* geom);
89
110
 int fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs);
 
111
@@ -125,7 +125,7 @@ int fat_boot_sector_set_boot_code (FatBootSector* bs);
 
112
 int fat_boot_sector_generate (FatBootSector* bs, const PedFileSystem* fs);
 
113
 int fat_boot_sector_write (const FatBootSector* bs, PedFileSystem* fs);
 
114
 
 
115
-int fat_info_sector_read (FatInfoSector* is, const PedFileSystem* fs);
 
116
+int fat_info_sector_read (FatInfoSector** isp, const PedFileSystem* fs);
 
117
 int fat_info_sector_generate (FatInfoSector* is, const PedFileSystem* fs);
 
118
 int fat_info_sector_write (const FatInfoSector* is, PedFileSystem* fs);
 
119
 
90
120
diff --git a/libparted/fs/fat/fat.c b/libparted/fs/fat/fat.c
91
 
index efc8d79..53dd361 100644
 
121
index efc8d79..25083c0 100644
92
122
--- a/libparted/fs/fat/fat.c
93
123
+++ b/libparted/fs/fat/fat.c
94
124
@@ -35,7 +35,9 @@ fat_alloc (const PedGeometry* geom)
150
180
 }
151
181
 
152
182
 static int
153
 
@@ -222,13 +228,13 @@ fat_open (PedGeometry* geom)
 
183
@@ -222,7 +228,7 @@ fat_open (PedGeometry* geom)
154
184
 
155
185
        if (!fat_boot_sector_read (&fs_info->boot_sector, geom))
156
186
                goto error_free_fs;
159
189
                goto error_free_fs;
160
190
        fs->type = (fs_info->fat_type == FAT_TYPE_FAT16)
161
191
                                ? &fat16_type
162
 
                                : &fat32_type;
163
 
        if (fs_info->fat_type == FAT_TYPE_FAT32) {
164
 
-               if (!fat_info_sector_read (&fs_info->info_sector, fs))
165
 
+               if (!fat_info_sector_read (fs_info->info_sector, fs))
166
 
                        goto error_free_fs;
167
 
        }
168
 
 
169
192
@@ -377,16 +383,16 @@ fat_create (PedGeometry* geom, FatType fat_type, PedTimer* timer)
170
193
 
171
194
        fs_info->serial_number = _gen_new_serial_number ();