git: sys/dev/disk/dm: Always initialize target's status string

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Sun Oct 25 07:57:23 PDT 2015


commit a6cf54187fd7c3e994c573215806ec03572c038e
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Sun Oct 25 21:33:42 2015 +0900

    sys/dev/disk/dm: Always initialize target's status string
    
    Ioctl by dmsetup(8)'s "status" subcommand doesn't necessary
    have a handler function from the way it's implemented.
    
    In such a case, it seems prop_dictionary_t object of libprop
    (in-kernel library) isn't properly initialized. This results
    in dmsetup(8)'s "status" subcommand showing a binary junk.
    This commit explicitly initializes it with C string "" to
    fix this in above case where char *params remains == NULL.
    
    This issue existed before f134a703 (touched related code).
    
    Below can reproduce this issue. Using a kernel prior to this
    commit will show some junk after each line of dmsetup status
    output except for the last line. Target type and definition
    of table can be anything, but the target needs to have more
    than 1 entries for the table to reproduce this.
    
    =====(A) using the existing code
      # kldload dm
      # echo "0 117218241 linear /dev/daX 0" > ./table.txt
      # echo "117218241 117218241 linear /dev/daY 0" >> ./table.txt
      # dmsetup create linear1 ./table.txt
      # dmsetup status /dev/mapper/linear1
      0 117218241 linear ݟ
      117218241 117218241 linear
    
    =====(B) using this commit
      # kldload dm
      # echo "0 117218241 linear /dev/daX 0" > ./table.txt
      # echo "117218241 117218241 linear /dev/daY 0" >> ./table.txt
      # dmsetup create linear1 ./table.txt
      # dmsetup status /dev/mapper/linear1
      0 117218241 linear
      117218241 117218241 linear

Summary of changes:
 sys/dev/disk/dm/dm_ioctl.c | 4 ++++
 1 file changed, 4 insertions(+)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/a6cf54187fd7c3e994c573215806ec03572c038e


-- 
DragonFly BSD source repository



More information about the Commits mailing list