On Mon, Nov 22, 2010 at 12:02:26PM -0800, Luben Tuikov wrote: > --- On Mon, 11/22/10, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> > wrote: > > So I don't mind the patch per se, but I think it's potentially way more > > dangerous than it looks. > > This patch does not ask for pages that Windows doesn't ask for. The sd > driver already asks for all pages (page code 0x3F) and then checks if the > device is write protected. Here is the present code: > > 2217 sd_read_write_protect_flag(sdkp, buffer); 2218 > sd_read_cache_type(sdkp, buffer); 2219 > sd_read_app_tag_own(sdkp, buffer); > > Line 2217 asks for page code 0x3F, meaning all mode pages. Line 2218 > asks for the Caching mode page or not at all if the device flags forbid > it (all USB storage devices in the Linux kernel). > > This patch adds processing of the data returned when all mode pages are > asked for (0x3F) in the function on line 2218. It then parses the data to > find out if the Caching mode page is present. As long as you are not changing the command stream that the devices see, I think this is a reasonable risk to take. What are the consequences if the device returns what appear to be a Caching Mode Page, but it is actually filled with garbage or otherwise inaccurate data? Matt -- Matthew Dharm Home: mdharm-usb@xxxxxxxxxxxxxxxxxx Maintainer, Linux USB Mass Storage Driver You suck Stef. -- Greg User Friendly, 11/29/97
Attachment:
pgpjSFR3yMBSZ.pgp
Description: PGP signature