From: Pavitra Kumar Subject: Subject: [PATCH] dm stripe: fixed resource leak of sc Date: Fri, 10 Oct 2014 15:19:46 +0000 Message-ID: <157461d0595944edb529638bf9ea3ec2@bgmail102.nvidia.com> Reply-To: device-mapper development Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7869201095600970316==" Return-path: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: "agk@redhat.com" , "dm-devel@redhat.com" , "snitzer@redhat.com" List-Id: dm-devel.ids --===============7869201095600970316== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_157461d0595944edb529638bf9ea3ec2bgmail102nvidiacom_" --_000_157461d0595944edb529638bf9ea3ec2bgmail102nvidiacom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 --- 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= =20int argc, char **argv) =20 sc->stripes_shift =3D __ffs(stripes); =20 r =3D dm_set_target_max_io_len(ti, chunk_size); - if (r) + if (r) { + kfree(sc); =20 return r; + } =20 ti->num_flush_bios =3D stripes; =20 ti->num_discard_bios =3D stripes; -- 1.8.1.5 -------------------------------------------------------------------------= ---------- This email message is for the sole use of the intended recipient(s) and m= ay contain confidential information. Any unauthorized review, use, disclosure or di= stribution is prohibited. If you are not the intended recipient, please contact the= =20sender by reply email and destroy all copies of the original message. -------------------------------------------------------------------------= ---------- --_000_157461d0595944edb529638bf9ea3ec2bgmail102nvidiacom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable =

Fixed the resource leak of sc in case the chunk si= ze

exceeds the limit at dm_set_target_max_io_len.

 

Signed-off-by: Pavitrakumar <pavitrak@nvidia.co= m>

---

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

1 file changed, 3 insertions(+), 1 deletion(-)=

 

diff --git a/drivers/md/dm-stripe.c b/drivers/md/d= m-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(str= uct dm_target *ti, unsigned int argc, char **argv)

        &n= bsp;           &nb= sp;          sc->stripes_= shift =3D __ffs(stripes);

        &n= bsp;       r =3D dm_set_target_max_io_len(t= i, chunk_size);

-        &= nbsp;     if (r)

+       &nb= sp;     if (r) {

+       &nb= sp;           &nbs= p;         kfree(sc);<= /p>

        &n= bsp;           &nb= sp;          return r;<= /o:p>

+       &nb= sp;     }

        &n= bsp;       ti->num_flush_bios =3D stripe= s;

        &n= bsp;      ti->num_discard_bios =3D stripes;

--

1.8.1.5


This email message is for the sole use of the intended recipient(s) = and may=20 contain confidential information.  Any unauthorized review, use, dis= closure=20 or distribution is prohibited.  If you are not the intended recipien= t,=20 please contact the sender by reply email and destroy all copies of the or= iginal=20 message.

--_000_157461d0595944edb529638bf9ea3ec2bgmail102nvidiacom_-- --===============7869201095600970316== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============7869201095600970316==--