linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: Axel Lin <axel.lin@gmail.com>
Cc: "linux-kernel" <linux-kernel@vger.kernel.org>,
	Oliver Neukum <oliver@neukum.name>,
	"Greg Kroah-Hartman" <gregkh@suse.de>,
	Alan Cox <alan@linux.intel.com>,
	Francesco Lavra <francescolavra@interfree.it>,
	Julian Calaby <julian.calaby@gmail.com>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH] cdc-acm: fix resource reclaim in error path of acm_probe
Date: Fri, 28 May 2010 07:45:06 +0200	[thread overview]
Message-ID: <201005280745.06299.oneukum@suse.de> (raw)
In-Reply-To: <1275017311.11371.2.camel@mola>

Am Freitag, 28. Mai 2010 05:28:31 schrieb Axel Lin:
> This patch fixes resource reclaim in error path of acm_probe:
> 1. In the case of "out of memory (write urbs usb_alloc_urb)",
> usb_alloc_urb may fail in any iteration of the for loop.
> Current implementation does not properly free allocated snd->urb.

Yes.

> 2. In the case of device_create_file(&intf->dev,&dev_attr_iCountryCodeRelDate)
> fail, acm->country_codes is kfreed. As a result, device_remove_file for
> dev_attr_wCountryCodes will not be executed in acm_disconnect.

Yes.

> 3. This patch also improves the error handling by only reclaim successfully
> allocated resources instead of iterate over all entries in the for loop.

Please don't do that. Simplicity and correctness are the only goals designing
error handling.

	Regards
		Oliver

  reply	other threads:[~2010-05-28  5:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-28  3:28 [PATCH] cdc-acm: fix resource reclaim in error path of acm_probe Axel Lin
2010-05-28  5:45 ` Oliver Neukum [this message]
2010-05-29  9:15   ` Axel Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201005280745.06299.oneukum@suse.de \
    --to=oneukum@suse.de \
    --cc=alan@linux.intel.com \
    --cc=axel.lin@gmail.com \
    --cc=francescolavra@interfree.it \
    --cc=gregkh@suse.de \
    --cc=julian.calaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=oliver@neukum.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).