17 Oct, 2017

1 commit

  • Fix problems noted in compilion with -Wformat=2 -Wformat-signedness.
    In particular, a mismatch between the signedness of a value and the
    signedness of its format specifier can result in unsigned values being
    printed as negative numbers, e.g.:

    Partition (0 type 1511) starts at physical 460, block length -1779968542

    ...which occurs when mounting a large (> 1 TiB) UDF partition.

    Changes since V1:
    * Fixed additional issues noted in udf_bitmap_free_blocks(),
    udf_get_fileident(), udf_show_options()

    Signed-off-by: Steven J. Magnani
    Signed-off-by: Jan Kara

    Steve Magnani
     

19 May, 2016

3 commits

  • UDF/OSTA terminology is confusing. Partition Numbers (PNs) are arbitrary
    16-bit values, one for each physical partition in the volume. Partition
    Reference Numbers (PRNs) are indices into the the Partition Map Table
    and do not necessarily equal the PN of the mapped partition.

    The current metadata code mistakenly uses the PN instead of the PRN when
    mapping metadata blocks to physical/sparable blocks. Windows-created
    UDF 2.5 discs for some reason use large, arbitrary PNs, resulting in
    mount failure and KASAN read warnings in udf_read_inode().

    For example, a NetBSD UDF 2.5 partition might look like this:

    PRN PN Type
    --- -- ----
    0 0 Sparable
    1 0 Metadata

    Since PRN == PN, we are fine.

    But Windows could gives us:

    PRN PN Type
    --- ---- ----
    0 8192 Sparable
    1 8192 Metadata

    So udf_read_inode() will start out by checking the partition length in
    sbi->s_partmaps[8192], which is obviously out of bounds.

    Fix this by creating a new field (s_phys_partition_ref) in struct
    udf_meta_data, referencing whatever physical or sparable map has the
    same partition number as the metadata partition.

    [JK: Add comment about s_phys_partition_ref, change its name]

    Signed-off-by: Alden Tondettar
    Signed-off-by: Jan Kara

    Alden Tondettar
     
  • Currently when udf_get_pblock_meta25() fails to map a block using the
    primary metadata file, it will attempt to load the mirror file entry by
    calling udf_find_metadata_inode_efe(). That function will return a ERR_PTR
    if it fails, but the return value is only checked against NULL. Test the
    return value using IS_ERR() and change it to NULL if needed.

    Signed-off-by: Alden Tondettar
    Signed-off-by: Jan Kara

    Alden Tondettar
     
  • Currently, if a metadata partition map is missing its partition descriptor,
    then udf_get_pblock_meta25() will BUG() out the first time it is called.
    This is rather drastic for a corrupted filesystem, so just treat this case
    as an invalid mapping instead.

    Signed-off-by: Alden Tondettar
    Signed-off-by: Jan Kara

    Alden Tondettar
     

14 Mar, 2015

1 commit


01 Nov, 2011

3 commits


11 Oct, 2011

1 commit

  • Rename udf_warning to udf_warn for consistency with normal logging
    uses of pr_warn.

    Rename function udf_warning to _udf_warn.
    Remove __func__ from uses and move __func__ to a new udf_warn
    macro that calls _udf_warn.
    Add \n's to uses of udf_warn, remove \n from _udf_warn.
    Coalesce formats.

    Reviewed-by: NamJae Jeon
    Signed-off-by: Joe Perches
    Signed-off-by: Jan Kara

    Joe Perches
     

07 Jan, 2011

1 commit