[PATCH 2/2] usb: fastboot: umount device before writing to it

Sascha Hauer s.hauer at pengutronix.de
Thu Mar 9 23:32:58 PST 2017


On Wed, Mar 08, 2017 at 10:24:02AM +0100, Oleksij Rempel wrote:
> From: Sascha Hauer <s.hauer at pengutronix.de>
> 
> When a fastboot target refers to a device and we are going to write
> to it, umount it beforehand, so that we do not end up with corrupt
> data after writing.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  drivers/usb/gadget/f_fastboot.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index a6192b9eb..8d69aea8b 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -754,6 +754,7 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd
>  		goto out;
>  	}
>  
> +	umount(filename);

I'm not sure about this one. We should probably rather bail out with an
error when it's mounted. When it's mounted then the result is undesired,
even when we unmount it before flashing.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list