Skip to content

Commit

Permalink
zipl: fix reading 4k disk's geometry
Browse files Browse the repository at this point in the history
On 4k SCSI disks zipl stores wrong values to 'scsi_mbr.program_table_pointer',
which makes system unbootable.
This happens in 'zipl/src/disk.c:656':

```
/* Convert file system block to physical */
*physical = mapped * phy_per_fs + subblock;
/* Add partition start */
*physical += info->geo.start;

```

So 'hd_geometry.start' should be adjusted before being used.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1918723
Closes: #107
Signed-off-by: Nikita Dubrovskii <nikita@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
  • Loading branch information
nikita-dubrovskii authored and hoeppnerj committed Feb 19, 2021
1 parent e506c94 commit 4a3957f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions zipl/src/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ disk_get_info(const char* device, struct job_target_data* target,
}
/* Convert device size to size in physical blocks */
data->phy_blocks = devsize / (data->phy_block_size / 512);
/* Adjust start on SCSI according to block_size. device-mapper devices are skipped */
if (data->type == disk_type_scsi && target->targetbase == NULL)
data->geo.start = data->geo.start / (data->phy_block_size / 512);
if (data->partnum != 0)
data->partition = stats.st_rdev;
/* Try to get device name */
Expand Down

0 comments on commit 4a3957f

Please sign in to comment.