lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1503081125390.3638-100000@netrider.rowland.org>
Date:	Sun, 8 Mar 2015 11:29:58 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Dave Young <dyoung@...hat.com>
cc:	balbi@...com, <gregkh@...uxfoundation.org>,
	<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb gadget: remove size limitation for storage cdrom

On Sun, 8 Mar 2015, Dave Young wrote:

> I used usb cdrom emulation to play video dvd for my daughter, but I got below
> error:
> 
> [dave@...kstar tmp]$ cat /mnt/sr1/VIDEO_TS/VTS_01_5.VOB >/dev/null
> cat: /mnt/sr1/VIDEO_TS/VTS_01_5.VOB: Input/output error
> [dave@...kstar tmp]$ dmesg|tail -1
> [ 3349.371857] sr1: rw=0, want=8028824, limit=4607996
> 
> The assumption of cdrom size is not right, we can create data dvd large then
> 4G, also mkisofs can create an iso with only one blank directory, the size is
> less than 300 sectors. The size limit does not make sense, thus remove them. 
> 
> Signed-off-by: Dave Young <dyoung@...hat.com>
> ---
>  drivers/usb/gadget/function/storage_common.c |    9 ---------
>  1 file changed, 9 deletions(-)
> 
> --- linux.orig/drivers/usb/gadget/function/storage_common.c
> +++ linux/drivers/usb/gadget/function/storage_common.c
> @@ -247,15 +247,6 @@ int fsg_lun_open(struct fsg_lun *curlun,
>  
>  	num_sectors = size >> blkbits; /* File size in logic-block-size blocks */
>  	min_sectors = 1;
> -	if (curlun->cdrom) {
> -		min_sectors = 300;	/* Smallest track is 300 frames */
> -		if (num_sectors >= 256*60*75) {
> -			num_sectors = 256*60*75 - 1;
> -			LINFO(curlun, "file too big: %s\n", filename);
> -			LINFO(curlun, "using only first %d blocks\n",
> -					(int) num_sectors);
> -		}
> -	}
>  	if (num_sectors < min_sectors) {
>  		LINFO(curlun, "file too small: %s\n", filename);
>  		rc = -ETOOSMALL;

NAK.  This patch is wrong, for a very simple reason.  You wrote:

> I used usb cdrom emulation to play video dvd for my daughter

and this demonstrates the error quite plainly.  You can't use _CD_ 
emulation to imitate a _DVD_ -- they are different sorts of media.  
Just think of what happens when you try playing a DVD on a CD player.

A more suitable approach would be to add DVD emulation to the driver.

Alan Stern

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ