Commit 70ca734a authored by Steve French's avatar Steve French
Browse files

[CIFS] Various minor bigendian fixes and sparse level 2 warning message fixes


Most important of these fixes mapchars on bigendian and a few statfs fields

Signed-off-by: default avatarShaggy <(shaggy@austin.ibm.com)>
Signed-off-by: default avatarSteve French <(sfrench@us.ibm.com)>
parent 20962438
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4,7 +4,8 @@ Fix readdir caching when unlink removes file in current search buffer,
and this is followed by a rewind search to just before the deleted entry.
Do not attempt to set ctime unless atime and/or mtime change requested
(most servers throw it away anyway). Fix length check of received smbs
to be more accurate.
to be more accurate. Fix big endian problem with mapchars mount option,
and with a field returned by statfs.

Version 1.36
------------
+1 −1
Original line number Diff line number Diff line
@@ -697,7 +697,7 @@ typedef struct smb_com_openx_req {
	__le32 EndOfFile;
	__le32 Timeout;
	__le32 Reserved;
	__u16  ByteCount;  /* file name follows */
	__le16  ByteCount;  /* file name follows */
	char   fileName[1];
} OPENX_REQ;

+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ extern int checkSMB(struct smb_hdr *smb, __u16 mid, int length);
extern int is_valid_oplock_break(struct smb_hdr *smb);
extern int is_size_safe_to_change(struct cifsInodeInfo *);
extern unsigned int smbCalcSize(struct smb_hdr *ptr);
extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr);
extern int decode_negTokenInit(unsigned char *security_blob, int length,
			enum securityEnum *secType);
extern int cifs_inet_pton(int, char * source, void *dst);
+14 −10
Original line number Diff line number Diff line
@@ -779,7 +779,7 @@ OldOpenRetry:
	/* BB FIXME END BB */

	pSMB->Sattr = cpu_to_le16(ATTR_HIDDEN | ATTR_SYSTEM | ATTR_DIRECTORY);
	pSMB->OpenFunction = convert_disposition(openDisposition);
	pSMB->OpenFunction = cpu_to_le16(convert_disposition(openDisposition));
	count += name_len;
	pSMB->hdr.smb_buf_length += count;

@@ -808,10 +808,12 @@ OldOpenRetry:
			pfile_info->LastAccessTime = 0; /* BB fixme */
			pfile_info->LastWriteTime = 0; /* BB fixme */
			pfile_info->ChangeTime = 0;  /* BB fixme */
			pfile_info->Attributes = pSMBr->FileAttributes; 
			pfile_info->Attributes =
				cpu_to_le32(le16_to_cpu(pSMBr->FileAttributes)); 
			/* the file_info buf is endian converted by caller */
			pfile_info->AllocationSize = pSMBr->EndOfFile;
			pfile_info->EndOfFile = pSMBr->EndOfFile;
			pfile_info->AllocationSize =
				cpu_to_le64(le32_to_cpu(pSMBr->EndOfFile));
			pfile_info->EndOfFile = pfile_info->AllocationSize;
			pfile_info->NumberOfLinks = cpu_to_le32(1);
		}
	}
@@ -2390,9 +2392,11 @@ QInfRetry:
		cFYI(1, ("Send error in QueryInfo = %d", rc));
	} else if (pFinfo) {            /* decode response */
		memset(pFinfo, 0, sizeof(FILE_ALL_INFO));
		pFinfo->AllocationSize = (__le64) pSMBr->size;
		pFinfo->EndOfFile = (__le64) pSMBr->size;
		pFinfo->Attributes = (__le32) pSMBr->attr;
		pFinfo->AllocationSize =
			cpu_to_le64(le32_to_cpu(pSMBr->size));
		pFinfo->EndOfFile = pFinfo->AllocationSize;
		pFinfo->Attributes =
			cpu_to_le32(le16_to_cpu(pSMBr->attr));
	} else
		rc = -EIO; /* bad buffer passed in */

@@ -3722,16 +3726,16 @@ QFSPosixRetry:
					le64_to_cpu(response_data->TotalBlocks);
			FSData->f_bfree =
			    le64_to_cpu(response_data->BlocksAvail);
			if(response_data->UserBlocksAvail == -1) {
			if(response_data->UserBlocksAvail == cpu_to_le64(-1)) {
				FSData->f_bavail = FSData->f_bfree;
			} else {
				FSData->f_bavail =
					le64_to_cpu(response_data->UserBlocksAvail);
			}
			if(response_data->TotalFileNodes != -1)
			if(response_data->TotalFileNodes != cpu_to_le64(-1))
				FSData->f_files =
					le64_to_cpu(response_data->TotalFileNodes);
			if(response_data->FreeFileNodes != -1)
			if(response_data->FreeFileNodes != cpu_to_le64(-1))
				FSData->f_ffree =
					le64_to_cpu(response_data->FreeFileNodes);
		}
+25 −13
Original line number Diff line number Diff line
@@ -303,12 +303,12 @@ static int coalesce_t2(struct smb_hdr * psecond, struct smb_hdr *pTargetSMB)
	byte_count += total_in_buf2;
	BCC_LE(pTargetSMB) = cpu_to_le16(byte_count);

	byte_count = be32_to_cpu(pTargetSMB->smb_buf_length);
	byte_count = pTargetSMB->smb_buf_length;
	byte_count += total_in_buf2;

	/* BB also add check that we are not beyond maximum buffer size */
		
	pTargetSMB->smb_buf_length = cpu_to_be32(byte_count);
	pTargetSMB->smb_buf_length = byte_count;

	if(remaining == total_in_buf2) {
		cFYI(1,("found the last secondary response"));
@@ -333,7 +333,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
	struct cifsSesInfo *ses;
	struct task_struct *task_to_wake = NULL;
	struct mid_q_entry *mid_entry;
	char *temp;
	char temp;
	int isLargeBuf = FALSE;
	int isMultiRsp;
	int reconnect;
@@ -435,22 +435,32 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
			continue;
		}

		/* the right amount was read from socket - 4 bytes */
		/* The right amount was read from socket - 4 bytes */
		/* so we can now interpret the length field */

		/* the first byte big endian of the length field,
		is actually not part of the length but the type
		with the most common, zero, as regular data */
		temp = *((char *) smb_buffer);

		/* Note that FC 1001 length is big endian on the wire, 
		but we convert it here so it is always manipulated
		as host byte order */
		pdu_length = ntohl(smb_buffer->smb_buf_length);
		cFYI(1,("rfc1002 length(big endian)0x%x)", pdu_length+4));
		smb_buffer->smb_buf_length = pdu_length;

		cFYI(1,("rfc1002 length 0x%x)", pdu_length+4));

		temp = (char *) smb_buffer;
		if (temp[0] == (char) RFC1002_SESSION_KEEP_ALIVE) {
		if (temp == (char) RFC1002_SESSION_KEEP_ALIVE) {
			continue; 
		} else if (temp[0] == (char)RFC1002_POSITIVE_SESSION_RESPONSE) {
		} else if (temp == (char)RFC1002_POSITIVE_SESSION_RESPONSE) {
			cFYI(1,("Good RFC 1002 session rsp"));
			continue;
		} else if (temp[0] == (char)RFC1002_NEGATIVE_SESSION_RESPONSE) {
		} else if (temp == (char)RFC1002_NEGATIVE_SESSION_RESPONSE) {
			/* we get this from Windows 98 instead of 
			   an error on SMB negprot response */
			cFYI(1,("Negative RFC1002 Session Response Error 0x%x)",
				temp[4]));
				pdu_length));
			if(server->tcpStatus == CifsNew) {
				/* if nack on negprot (rather than 
				ret of smb negprot error) reconnecting
@@ -472,9 +482,10 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
				wake_up(&server->response_q);
				continue;
			}
		} else if (temp[0] != (char) 0) {
		} else if (temp != (char) 0) {
			cERROR(1,("Unknown RFC 1002 frame"));
			cifs_dump_mem(" Received Data: ", temp, length);
			cifs_dump_mem(" Received Data: ", (char *)smb_buffer,
				      length);
			cifs_reconnect(server);
			csocket = server->ssocket;
			continue;
@@ -609,7 +620,8 @@ multi_t2_fnd:
		} else if ((is_valid_oplock_break(smb_buffer) == FALSE)
		    && (isMultiRsp == FALSE)) {                          
			cERROR(1, ("No task to wake, unknown frame rcvd!"));
			cifs_dump_mem("Received Data is: ",temp,sizeof(struct smb_hdr));
			cifs_dump_mem("Received Data is: ",(char *)smb_buffer,
				      sizeof(struct smb_hdr));
		}
	} /* end while !EXITING */

Loading