diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2017-09-20 07:29:49 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2017-09-25 11:18:29 -0400 |
commit | 62e082430ea4bb5b28909ca4375bb683931e22aa (patch) | |
tree | 787739b2ad3f67766f42c4ecb98e20c6c2f624e0 /drivers/md/dm-core.h | |
parent | e19b205be43d11bff638cad4487008c48d21c103 (diff) | |
download | linux-62e082430ea4bb5b28909ca4375bb683931e22aa.tar.gz linux-62e082430ea4bb5b28909ca4375bb683931e22aa.tar.bz2 linux-62e082430ea4bb5b28909ca4375bb683931e22aa.zip |
dm ioctl: fix alignment of event number in the device list
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")
Cc: stable@vger.kernel.org # 4.13
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-core.h')
-rw-r--r-- | drivers/md/dm-core.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/dm-core.h b/drivers/md/dm-core.h index 24eddbdf2ab4..203144762f36 100644 --- a/drivers/md/dm-core.h +++ b/drivers/md/dm-core.h @@ -149,5 +149,6 @@ static inline bool dm_message_test_buffer_overflow(char *result, unsigned maxlen extern atomic_t dm_global_event_nr; extern wait_queue_head_t dm_global_eventq; +void dm_issue_global_event(void); #endif |