Re: cifs: don't always drop malformed replies on the floor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 3 Feb 2011 23:01:45 -0600
Steve French <smfrench@xxxxxxxxx> wrote:

> Looking at this comment in the patch:
> 
> +		 * FIXME: why 48 bytes?
> +		 */
> +		length = checkSMB(smb_buffer, smb_buffer->Mid, total_read);
> +		if (length != 0)
>  			cifs_dump_mem("Bad SMB: ", smb_buffer,
>  					total_read < 48 ? total_read : 48);
> 
> 
> got me thinking, if you prefer a longer length that is fine.   To
> avoid huge log entries, while still dumping the most useful info, the
> original length dumped was limited.  48 bytes was chosen because it
> printed 3 lines of 16 to log and thus would include the most important
> parts of the SMB (past wct).  It is large enough to fit a close
> request and response, although about 10 bytes to small for getting all
> of a SMB ReadX request.   It would probably be fine to make that 64
> bytes if you prefer.   If we made it smaller (e.g. 32 instead of 48)
> IIRC we wouldn't get wct.

The length doesn't much matter to me. What does matter is that this
would do a cifs_dump_mem for 48 bytes even when the client received
less than 48 bytes. Granted, the buffers are larger than that so I
don't think there's any danger of a buffer overrun or anything, but the
stuff at the end could just be garbage or zeroed out.

-- 
Jeff Layton <jlayton@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux