]>
Commit | Line | Data |
---|---|---|
13e8e92f GKH |
1 | From foo@baz Mon Sep 17 12:22:41 CEST 2018 |
2 | From: Mauricio Faria de Oliveira <mfo@canonical.com> | |
3 | Date: Wed, 25 Jul 2018 22:46:29 -0300 | |
4 | Subject: partitions/aix: append null character to print data from disk | |
5 | ||
6 | From: Mauricio Faria de Oliveira <mfo@canonical.com> | |
7 | ||
8 | [ Upstream commit d43fdae7bac2def8c4314b5a49822cb7f08a45f1 ] | |
9 | ||
10 | Even if properly initialized, the lvname array (i.e., strings) | |
11 | is read from disk, and might contain corrupt data (e.g., lack | |
12 | the null terminating character for strings). | |
13 | ||
14 | So, make sure the partition name string used in pr_warn() has | |
15 | the null terminating character. | |
16 | ||
17 | Fixes: 6ceea22bbbc8 ("partitions: add aix lvm partition support files") | |
18 | Suggested-by: Daniel J. Axtens <daniel.axtens@canonical.com> | |
19 | Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com> | |
20 | Signed-off-by: Jens Axboe <axboe@kernel.dk> | |
21 | Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> | |
22 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
23 | --- | |
24 | block/partitions/aix.c | 8 ++++++-- | |
25 | 1 file changed, 6 insertions(+), 2 deletions(-) | |
26 | ||
27 | --- a/block/partitions/aix.c | |
28 | +++ b/block/partitions/aix.c | |
29 | @@ -281,10 +281,14 @@ int aix_partition(struct parsed_partitio | |
30 | next_lp_ix += 1; | |
31 | } | |
32 | for (i = 0; i < state->limit; i += 1) | |
33 | - if (lvip[i].pps_found && !lvip[i].lv_is_contiguous) | |
34 | + if (lvip[i].pps_found && !lvip[i].lv_is_contiguous) { | |
35 | + char tmp[sizeof(n[i].name) + 1]; // null char | |
36 | + | |
37 | + snprintf(tmp, sizeof(tmp), "%s", n[i].name); | |
38 | pr_warn("partition %s (%u pp's found) is " | |
39 | "not contiguous\n", | |
40 | - n[i].name, lvip[i].pps_found); | |
41 | + tmp, lvip[i].pps_found); | |
42 | + } | |
43 | kfree(pvd); | |
44 | } | |
45 | kfree(n); |