SMB security fixes for 2.6.9
PATCH 1/1 SMB security fixes for 2.6.9
The SMB patch in 2.6.9-ac10 is broken. When a reply is received and it
contains no data (only parms), the data_offset is zero. Since no data will be copied, zero offset is perfectly valid. This patch, based on the one in -ac, works for me. I also cleaned up the message printing (%u vs. %d for unsigned), added unlikely() where appropriate, and removed some extra code.
Comments welcome. Like I said, at least I can use SMB servers now. With the original patch very bad things happened, like trying to save files from a text editor truncated them to 0 bytes, followed by editor freezing for many seconds then asking for a new name to save the file as.
fs/smbfs/proc.c +3 -3
@@ -1427,9 +1427,9 @@ smb_proc_readX_data(struct smb_request ** So we must first calculate the amount of padding used by the server. */ data_off -= hdrlen; -if (data_off >SMB_READX_MAX_PAD ) { -PARANOIA ("offset is larger than max pad!\n" ); -PARANOIA ("%d > %d\n" , data_off,SMB_READX_MAX_PAD ); +if (data_off >SMB_READX_MAX_PAD || data_off <0 ) { +PARANOIA ("offset is larger than SMB_READX_MAX_PAD or negative!\n" ); +PARANOIA ("%d > %d || %d < 0\n" , data_off,SMB_READX_MAX_PAD , data_off); req->rq_rlen = req->rq_bufsize +1 ;return ; }
fs/smbfs/request.c +39 -20
112 lines not on this page · raw message
_
--Chuck Ebbert 22-Nov-04 19:18:11