RE: [PATCH] USB: gadget: f_mass_storage: fix in fsg_common_init()error recovery

From: Viral Mehta
Date: Wed May 12 2010 - 04:31:33 EST


Hi,
________________________________________
>From: linux-usb-owner@xxxxxxxxxxxxxxx [linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of Michal Nazarewicz [m.nazarewicz@xxxxxxxxxxx]
>Sent: Wednesday, May 12, 2010 1:46 PM
>To: linux-usb@xxxxxxxxxxxxxxx
>Cc: Kyungmin Park; Marek Szyprowski; linux-kernel@xxxxxxxxxxxxxxx
>Subject: [PATCH] USB: gadget: f_mass_storage: fix in fsg_common_init() error recovery

>In to places in fsg_common_init() an unconditional call to kfree()
>on common was performed in error recovery which is not a valid

If I am not wrong, common can not be NULL since it was already checked above.

2685 if (!common) {
2686 common = kzalloc(sizeof *common, GFP_KERNEL);
2687 if (!common)
2688 return ERR_PTR(-ENOMEM);
2689 common->free_storage_on_release = 1;


>behaviour since fsg_common structure is not always allocated by
>fsg_common_init().

>To fix, the calls has been replaced with a goto to a proper error
>recovery which does the correct thing.
---

This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.

______________________________________________________________________
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/