]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
dm ioctl: fix alignment of event number in the device list
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 20 Sep 2017 11:29:49 +0000 (07:29 -0400)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 19 Oct 2017 14:49:13 +0000 (09:49 -0500)
commit1a778b5750cd0768cdebd23f2a7426c92a6099cc
tree37832c1741f6f763ba5af06f1157e894d1d8cdb0
parent307502e8d69977824c452c8df1768ac93e703181
dm ioctl: fix alignment of event number in the device list

BugLink: http://bugs.launchpad.net/bugs/1723145
commit 62e082430ea4bb5b28909ca4375bb683931e22aa upstream.

The size of struct dm_name_list is different on 32-bit and 64-bit
kernels (so "(nl + 1)" differs between 32-bit and 64-bit kernels).

This mismatch caused some harmless difference in padding when using 32-bit
or 64-bit kernel. Commit 23d70c5e52dd ("dm ioctl: report event number in
DM_LIST_DEVICES") added reporting event number in the output of
DM_LIST_DEVICES_CMD. This difference in padding makes it impossible for
userspace to determine the location of the event number (the location
would be different when running on 32-bit and 64-bit kernels).

Fix the padding by using offsetof(struct dm_name_list, name) instead of
sizeof(struct dm_name_list) to determine the location of entries.

Also, the ioctl version number is incremented to 37 so that userspace
can use the version number to determine that the event number is present
and correctly located.

In addition, a global event is now raised when a DM device is created,
removed, renamed or when table is swapped, so that the user can monitor
for device changes.

Reported-by: Eugene Syromiatnikov <esyr@redhat.com>
Fixes: 23d70c5e52dd ("dm ioctl: report event number in DM_LIST_DEVICES")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/md/dm-core.h
drivers/md/dm-ioctl.c
drivers/md/dm.c
include/uapi/linux/dm-ioctl.h