From: Oliver Neukum on 28 May 2010 01:50 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Axel Lin on 29 May 2010 05:20 2010/5/28 Oliver Neukum <oneukum(a)suse.de>: > 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. OK. I will send a revised version for bug fixes only. Thanks for the review. Axel > > � � � �Regards > � � � � � � � �Oliver > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Oliver Neukum on 31 May 2010 04:00 Am Montag, 31. Mai 2010 02:04:47 schrieb Axel Lin: > This patch fixes resource reclaim in error path of acm_probe: > 1. In the case of "out of memory (read urbs usb_alloc_urb)\n")", > there is no need to call acm_read_buffers_free(acm) here. > Fix it by goto alloc_fail6 instead of alloc_fail7. > 2. 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. > Fix it by goto alloc_fail8 instead of alloc_fail7. > 3. 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. > Fix it by calling device_remove_file for dev_attr_wCountryCodes before goto > skip_countries. > > Signed-off-by: Axel Lin <axel.lin(a)gmail.com> Acked-by: Oliver Neukum <oneukum(a)suse.de> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: linux-next: Tree for May 28 Next: udevd high cpu hogging in kernel-2.6.34 git8 to git-13 |