Mikulas Patocka
fd7c092e71
dm: fix truncated status strings
...
Avoid returning a truncated table or status string instead of setting
the DM_BUFFER_FULL_FLAG when the last target of a table fills the
buffer.
When processing a table or status request, the function retrieve_status
calls ti->type->status. If ti->type->status returns non-zero,
retrieve_status assumes that the buffer overflowed and sets
DM_BUFFER_FULL_FLAG.
However, targets don't return non-zero values from their status method
on overflow. Most targets returns always zero.
If a buffer overflow happens in a target that is not the last in the
table, it gets noticed during the next iteration of the loop in
retrieve_status; but if a buffer overflow happens in the last target, it
goes unnoticed and erroneously truncated data is returned.
In the current code, the targets behave in the following way:
* dm-crypt returns -ENOMEM if there is not enough space to store the
key, but it returns 0 on all other overflows.
* dm-thin returns errors from the status method if a disk error happened.
This is incorrect because retrieve_status doesn't check the error
code, it assumes that all non-zero values mean buffer overflow.
* all the other targets always return 0.
This patch changes the ti->type->status function to return void (because
most targets don't use the return code). Overflow is detected in
retrieve_status: if the status method fills up the remaining space
completely, it is assumed that buffer overflow happened.
Cc: stable@vger.kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com >
Signed-off-by: Alasdair G Kergon <agk@redhat.com >
2013-03-01 22:45:44 +00:00
..
2013-02-26 09:24:48 -08:00
2013-02-08 13:16:17 -05:00
2013-01-28 18:17:25 -05:00
2013-02-26 15:03:06 -08:00
2013-02-21 15:27:22 -08:00
2013-01-30 07:54:34 -06:00
2013-02-13 08:35:43 -08:00
2013-02-14 00:22:52 +01:00
2013-02-09 15:22:14 +00:00
2013-02-20 11:00:43 -08:00
2013-02-11 18:58:34 +00:00
2013-02-28 18:02:55 -08:00
2013-02-27 19:10:09 -08:00
2013-02-26 11:41:08 -08:00
2013-02-24 14:37:22 -05:00
2013-02-05 04:07:35 +01:00
2013-02-13 06:16:08 -08:00
2013-02-15 09:52:29 +01:00
2013-02-26 11:09:17 -08:00
2013-02-16 13:34:10 -08:00
2013-02-22 09:20:11 -08:00
2013-02-21 12:11:44 -08:00
2013-02-08 13:16:17 -05:00
2013-02-28 18:02:55 -08:00
2013-02-21 15:27:22 -08:00
2013-01-29 11:47:06 +01:00
2013-02-23 17:50:14 -08:00
2013-01-23 09:32:30 -08:00
2013-02-21 17:22:19 -08:00
2013-02-26 02:46:13 -05:00
2013-02-15 18:52:45 -08:00
2013-02-23 17:50:12 -08:00
2013-02-21 17:22:16 -08:00
2013-01-24 12:05:18 -08:00
2013-01-24 11:09:28 -08:00
2013-01-31 22:15:36 +01:00
2013-01-31 19:57:30 -08:00
2013-02-13 06:00:53 -08:00
2013-02-23 17:50:10 -08:00
2013-02-14 09:21:15 -05:00
2013-02-21 17:22:15 -08:00
2013-02-21 17:22:15 -08:00
2013-02-21 17:22:15 -08:00
2013-02-21 17:22:16 -08:00
2013-02-15 16:45:06 +01:00
2013-02-25 16:46:44 -08:00
2013-01-26 17:37:17 +01:00
2013-02-02 01:29:32 +01:00
2013-02-11 18:49:51 -05:00
2013-02-26 02:46:09 -05:00
2013-02-27 19:10:11 -08:00
2013-01-18 15:25:53 -08:00
2013-03-01 22:45:44 +00:00
2013-02-21 12:05:51 -08:00
2013-01-29 10:48:30 +01:00
2013-02-14 20:00:53 +05:30
2013-01-17 12:19:09 -08:00
2013-02-21 09:38:18 -08:00
2013-02-28 12:52:24 -08:00
2013-02-26 02:46:08 -05:00
2013-01-21 14:07:44 -05:00
2013-02-27 19:10:23 -08:00
2013-01-24 09:04:04 +01:00
2013-02-23 17:50:12 -08:00
2013-02-27 19:10:11 -08:00
2013-02-26 20:16:07 -08:00
2013-02-22 23:31:31 -05:00
2013-01-30 11:02:06 -05:00
2013-01-21 13:22:35 -05:00
2013-02-26 03:10:52 +11:00
2013-01-22 10:23:35 +01:00
2013-02-19 18:19:48 -08:00
2013-02-27 19:10:24 -08:00
2013-02-22 08:20:05 +01:00
2013-02-21 10:45:01 +01:00
2013-02-23 17:50:16 -08:00
2013-02-23 17:50:17 -08:00
2013-02-26 20:16:07 -08:00
2013-01-25 21:03:54 -08:00
2013-01-25 11:17:31 -08:00
2013-02-27 19:10:21 -08:00
2013-02-15 09:41:42 +01:00
2013-02-06 15:59:47 -05:00
2013-02-27 19:10:24 -08:00
2013-02-23 21:00:06 -05:00
2013-02-11 14:16:26 -05:00
2013-01-29 13:59:57 -05:00
2013-02-19 08:06:01 +01:00
2013-01-23 09:31:01 -08:00
2013-02-06 10:47:28 +01:00
2013-02-27 19:10:21 -08:00
2013-01-30 22:41:13 -05:00
2013-02-05 00:48:46 +01:00
2013-01-28 12:17:25 +01:00
2013-02-09 16:29:20 -05:00
2013-01-27 19:23:27 +01:00
2013-01-21 17:17:57 +10:30
2013-01-29 19:32:58 -08:00
2013-02-04 15:35:26 -08:00
2013-01-21 13:22:36 -05:00
2013-02-23 17:50:19 -08:00
2013-02-24 13:07:18 -08:00
2013-02-01 17:47:04 -08:00
2013-01-25 15:30:23 -05:00
2013-02-27 19:10:24 -08:00
2013-02-19 15:17:08 -05:00
2013-02-22 19:25:09 -08:00
2013-02-02 00:01:15 +01:00
2013-02-23 17:50:14 -08:00
2013-02-23 17:50:20 -08:00
2013-02-23 17:50:13 -08:00
2013-01-28 18:42:10 -05:00
2013-02-23 17:50:19 -08:00
2013-02-23 17:50:17 -08:00
2013-02-23 17:50:23 -08:00
2013-02-23 17:50:11 -08:00
2013-02-05 20:38:48 +11:00
2013-02-23 17:50:20 -08:00
2013-01-24 22:48:04 +01:00
2013-01-21 17:18:20 +10:30
2013-01-21 13:55:14 -05:00
2013-01-21 13:55:14 -05:00
2013-02-15 15:17:11 -05:00
2013-02-19 13:18:13 -05:00
2013-02-11 19:19:33 -05:00
2013-02-13 06:16:06 -08:00
2013-02-13 06:15:29 -08:00
2013-02-13 06:15:28 -08:00
2013-01-17 19:11:14 -08:00
2013-02-13 10:11:53 +00:00
2013-02-13 10:09:31 +00:00
2013-02-23 00:30:08 +01:00
2013-02-23 17:50:17 -08:00
2013-02-14 15:55:23 +01:00
2013-02-23 17:50:15 -08:00
2013-02-21 17:22:19 -08:00
2013-02-21 13:41:04 -08:00
2013-02-25 21:18:18 -08:00
2013-02-05 11:54:06 +01:00
2013-02-08 18:28:02 +01:00
2013-02-27 19:10:24 -08:00
2013-01-17 17:39:33 -08:00
2013-01-23 14:39:19 +00:00
2013-02-23 17:50:16 -08:00
2013-02-23 17:50:16 -08:00
2013-02-21 12:05:51 -08:00
2013-02-13 09:40:35 -08:00
2013-02-21 17:38:49 -08:00
2013-02-21 13:41:04 -08:00
2013-01-24 15:37:26 +01:00
2013-01-20 12:26:05 -08:00
2013-02-26 09:34:29 -08:00
2013-02-08 13:14:40 +00:00
2013-01-24 23:24:56 -05:00
2013-01-23 13:44:00 -05:00
2013-02-27 19:10:24 -08:00
2013-01-28 22:25:21 -08:00
2013-02-14 17:11:09 +00:00
2013-01-30 11:01:53 -05:00
2013-02-23 17:50:17 -08:00
2013-02-21 12:05:51 -08:00
2013-01-16 12:13:20 -08:00
2013-02-27 19:10:10 -08:00
2013-02-27 19:10:11 -08:00
2013-02-19 08:43:34 +01:00
2013-01-15 23:03:00 -08:00
2013-02-13 10:13:58 -08:00
2013-02-03 15:09:26 -05:00
2013-02-15 15:17:11 -05:00
2013-02-21 17:22:20 -08:00
2013-02-14 15:29:37 +01:00
2013-02-10 19:41:08 -05:00
2013-02-07 15:15:00 -08:00
2013-02-13 12:15:50 -08:00
2013-02-09 22:30:44 +01:00
2013-02-23 17:50:22 -08:00
2013-01-29 19:36:53 -08:00
2013-02-14 09:21:15 -05:00
2013-01-25 21:51:13 +01:00
2013-02-13 13:22:15 -05:00
2013-01-28 11:19:06 -07:00
2013-02-05 00:48:46 +01:00
2013-02-21 14:58:40 -08:00
2013-01-27 19:23:31 +01:00
2013-02-04 15:40:28 -08:00
2013-01-15 22:43:15 -08:00
2013-02-13 10:13:58 -08:00
2013-01-18 16:15:27 -08:00
2013-02-08 18:28:04 +01:00
2013-01-25 15:06:01 -08:00
2013-01-26 22:11:41 -08:00
2013-02-14 00:22:58 +01:00
2013-02-13 17:00:32 +10:30
2013-02-23 17:50:15 -08:00
2013-02-23 17:50:16 -08:00
2013-02-08 12:13:43 +10:00
2013-01-27 20:35:47 +01:00
2013-01-31 19:56:35 -05:00
2013-02-08 10:05:02 +02:00
2013-02-13 19:29:12 -08:00