LoadPin: Report friendly block device name
authorKees Cook <keescook@chromium.org>
Thu, 4 Oct 2018 00:38:37 +0000 (17:38 -0700)
committerKees Cook <keescook@chromium.org>
Thu, 18 Oct 2018 22:29:44 +0000 (15:29 -0700)
Instead of only reporting major/minor, include the actual block device
name, at least as seen by the kernel.

Signed-off-by: Kees Cook <keescook@chromium.org>
security/loadpin/loadpin.c

index 0716af28808a5b8891c80b458acf109dad87fa9a..f062672d6b35f8b3c9dfd0e7295e2ce0e25921d0 100644 (file)
@@ -84,8 +84,11 @@ static void check_pinning_enforcement(struct super_block *mnt_sb)
         * device, allow sysctl to change modes for testing.
         */
        if (mnt_sb->s_bdev) {
+               char bdev[BDEVNAME_SIZE];
+
                ro = bdev_read_only(mnt_sb->s_bdev);
-               pr_info("dev(%u,%u): %s\n",
+               bdevname(mnt_sb->s_bdev, bdev);
+               pr_info("%s (%u:%u): %s\n", bdev,
                        MAJOR(mnt_sb->s_bdev->bd_dev),
                        MINOR(mnt_sb->s_bdev->bd_dev),
                        ro ? "read-only" : "writable");