diff options
author | Pavitra Kumar <pavitrak@nvidia.com> | 2014-10-10 11:19:46 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2014-10-10 22:05:18 -0400 |
commit | a3f2af2547884e02f7e43f995a6c442a4e54f1ea (patch) | |
tree | 30a5927b0819c371f70f2116ead52ba142ce573a /drivers/md | |
parent | 56ec16cb1e1ce46354de8511eef962a417c32c92 (diff) |
dm stripe: fix potential for leak in stripe_ctr error path
Fix a potential struct stripe_c leak that would occur if the
chunk_size exceeded the maximum allowed by dm_set_target_max_io_len
(UINT_MAX). However, in practice there is no possibility of this
occuring given that chunk_size is of type uint32_t. But it is good to
fix this to future-proof in case dm_set_target_max_io_len's
implementation were to change.
Signed-off-by: Pavitra Kumar <pavitrak@nvidia.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-stripe.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index d1600d2aa2e2..f8b37d4c05d8 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
@@ -159,8 +159,10 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
159 | sc->stripes_shift = __ffs(stripes); | 159 | sc->stripes_shift = __ffs(stripes); |
160 | 160 | ||
161 | r = dm_set_target_max_io_len(ti, chunk_size); | 161 | r = dm_set_target_max_io_len(ti, chunk_size); |
162 | if (r) | 162 | if (r) { |
163 | kfree(sc); | ||
163 | return r; | 164 | return r; |
165 | } | ||
164 | 166 | ||
165 | ti->num_flush_bios = stripes; | 167 | ti->num_flush_bios = stripes; |
166 | ti->num_discard_bios = stripes; | 168 | ti->num_discard_bios = stripes; |