Skip to contentSkip to conversation

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

PATCH Pavitra Kumar 2 participants 2 messages Oct 10, 2014 – Oct 11, 2014 Device mapper

lore
Share & tools
lore
#0 lore raw

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

---
drivers/md/dm-stripe.c | 4 +++-

1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/dm-stripe.c +3 -2
index d1600d2..f8b37d4 100644
@@ -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.
-----------------------------------------------------------------------------------

#1 lore raw
Quoted 4 lines · Pavitra Kumar

Fixed the resource leak of sc in case the chunk size

exceeds the limit at dm_set_target_max_io_len.

I've staged this in linux-next, see:
https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=a3f2af2547884e02f7e43f995a6c442a4e54f1ea

But I changed the header to reflect that this leak isn't possible at this point. BTW, your patch had mangled whitespace, so I applied the change by hand.

<snip>

Quoted 8 lines

________________________________
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.
________________________________

Please try to get rid of boilerplate corporate footers like this in your mails if you're posting to a public mailing list with the intent of allowing _everyone_ to consume your change.