Files
i2som-imx-linux/include/linux
Mikulas Patocka d8b8a43e0f dm: fix truncated status strings
commit fd7c092e71 upstream.

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.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 07:29:43 -08:00
..
2012-11-26 11:38:03 -08:00
2013-12-04 10:50:29 -08:00
2012-04-27 11:03:38 -06:00
2012-11-17 13:16:12 -08:00
2012-04-27 10:46:45 +08:00
2013-07-28 16:25:59 -07:00
2012-10-02 10:30:35 -07:00
2012-08-15 08:10:29 -07:00
2012-07-19 08:59:00 -07:00
2013-04-16 21:27:26 -07:00
2012-10-02 10:30:05 -07:00
2012-12-17 10:37:42 -08:00
2013-01-11 09:07:15 -08:00
2012-07-16 09:04:42 -07:00
2013-04-05 10:04:40 -07:00
2013-08-04 16:26:03 +08:00