Re: [PATCH][resend] fix resource leak in pnp card_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Keith Owens <[email protected]> wrote:
>
> >+	clink = pnp_alloc(sizeof(*clink));
>  >+	if (!clink)
>  >+		return 0;
>  >+	clink->card = card;
>  >+	clink->driver = drv;
>  >+	clink->pm_state = PMSG_ON;
> 
>  Memory leak of clink on next test.
> 
>  >+
>  >+	if (drv->probe(clink, id) >= 0)
>  >+		return 1;
>  >+
>  >+	/* Recovery */
>  >+	card_for_each_dev(card, dev) {
>  >+		if (dev->card_link == clink)
>  >+			pnp_release_card_device(dev);
>  > 	}
>  >+	kfree(clink);
>  > 	return 0;
>  > }

No, if ->probe succeeded, it took over control of the memory at *clink.

It's all rather twisty and quite undocumented.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux