[dm-devel] Subject: [PATCH] dm stripe: fixed resource leak of sc

Pavitra Kumar pavitrak at nvidia.com
Fri Oct 10 15:19:46 UTC 2014


Fixed the resource leak of sc in case the chunk size
exceeds the limit at dm_set_target_max_io_len.

Signed-off-by: Pavitrakumar <pavitrak at nvidia.com>
---
drivers/md/dm-stripe.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
index d1600d2..f8b37d4 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)
                               sc->stripes_shift = __ffs(stripes);
                r = dm_set_target_max_io_len(ti, chunk_size);
-              if (r)
+             if (r) {
+                             kfree(sc);
                               return r;
+             }
                ti->num_flush_bios = stripes;
               ti->num_discard_bios = stripes;
--
1.8.1.5

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20141010/309c69e5/attachment.htm>


More information about the dm-devel mailing list