Commit ccb5a461 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.6-rmk

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 1b6d94aa 01ef13d0
...@@ -160,7 +160,7 @@ pci_set_dma_mask(struct pci_device *dev, u64 mask) ...@@ -160,7 +160,7 @@ pci_set_dma_mask(struct pci_device *dev, u64 mask)
Checks to see if the mask is possible and updates the device Checks to see if the mask is possible and updates the device
parameters if it is. parameters if it is.
Returns: 1 if successful and 0 if not Returns: 0 if successful and a negative error if not.
u64 u64
dma_get_required_mask(struct device *dev) dma_get_required_mask(struct device *dev)
......
...@@ -289,6 +289,15 @@ early_console_setup (char *cmdline) ...@@ -289,6 +289,15 @@ early_console_setup (char *cmdline)
return -1; return -1;
} }
static inline void
mark_bsp_online (void)
{
#ifdef CONFIG_SMP
/* If we register an early console, allow CPU 0 to printk */
cpu_set(smp_processor_id(), cpu_online_map);
#endif
}
void __init void __init
setup_arch (char **cmdline_p) setup_arch (char **cmdline_p)
{ {
...@@ -306,11 +315,8 @@ setup_arch (char **cmdline_p) ...@@ -306,11 +315,8 @@ setup_arch (char **cmdline_p)
machvec_init(acpi_get_sysname()); machvec_init(acpi_get_sysname());
#endif #endif
#ifdef CONFIG_SMP if (early_console_setup(*cmdline_p) == 0)
/* If we register an early console, allow CPU 0 to printk */ mark_bsp_online();
if (!early_console_setup(*cmdline_p))
cpu_set(smp_processor_id(), cpu_online_map);
#endif
#ifdef CONFIG_ACPI_BOOT #ifdef CONFIG_ACPI_BOOT
/* Initialize the ACPI boot-time table parser */ /* Initialize the ACPI boot-time table parser */
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
.text .text
#ifdef CONFIG_6xx
.globl disable_6xx_mmu .globl disable_6xx_mmu
disable_6xx_mmu: disable_6xx_mmu:
/* Establish default MSR value, exception prefix 0xFFF. /* Establish default MSR value, exception prefix 0xFFF.
...@@ -94,6 +95,7 @@ disable_6xx_l1cache: ...@@ -94,6 +95,7 @@ disable_6xx_l1cache:
sync sync
isync isync
blr blr
#endif
.globl _setup_L2CR .globl _setup_L2CR
_setup_L2CR: _setup_L2CR:
......
...@@ -466,7 +466,7 @@ ppc4xx_init_dma_channel(unsigned int dmanr, ppc_dma_ch_t * p_init) ...@@ -466,7 +466,7 @@ ppc4xx_init_dma_channel(unsigned int dmanr, ppc_dma_ch_t * p_init)
/* clear all polarity signals and then "or" in new signal levels */ /* clear all polarity signals and then "or" in new signal levels */
polarity &= ~GET_DMA_POLARITY(dmanr); polarity &= ~GET_DMA_POLARITY(dmanr);
polarity |= p_dma_ch->polarity; polarity |= p_init->polarity;
#if DCRN_POL > 0 #if DCRN_POL > 0
mtdcr(DCRN_POL, polarity); mtdcr(DCRN_POL, polarity);
#endif #endif
......
...@@ -220,7 +220,7 @@ config VIDEO_ZR36120 ...@@ -220,7 +220,7 @@ config VIDEO_ZR36120
config VIDEO_MEYE config VIDEO_MEYE
tristate "Sony Vaio Picturebook Motion Eye Video For Linux" tristate "Sony Vaio Picturebook Motion Eye Video For Linux"
depends on VIDEO_DEV && PCI && SONYPI && !HIGHMEM64G depends on VIDEO_DEV && PCI && SONYPI
---help--- ---help---
This is the video4linux driver for the Motion Eye camera found This is the video4linux driver for the Motion Eye camera found
in the Vaio Picturebook laptops. Please read the material in in the Vaio Picturebook laptops. Please read the material in
......
...@@ -110,19 +110,20 @@ static void rvfree(void * mem, unsigned long size) ...@@ -110,19 +110,20 @@ static void rvfree(void * mem, unsigned long size)
/* /*
* return a page table pointing to N pages of locked memory * return a page table pointing to N pages of locked memory
* *
* NOTE: The meye device expects dma_addr_t size to be 32 bits * NOTE: The meye device expects DMA addresses on 32 bits, we build
* (the toc must be exactly 1024 entries each of them being 4 bytes * a table of 1024 entries = 4 bytes * 1024 = 4096 bytes.
* in size, the whole result being 4096 bytes). We're using here
* dma_addr_t for correctness but the compilation of this driver is
* disabled for HIGHMEM64G=y, where sizeof(dma_addr_t) != 4
*/ */
static int ptable_alloc(void) static int ptable_alloc(void)
{ {
dma_addr_t *pt; u32 *pt;
int i; int i;
memset(meye.mchip_ptable, 0, sizeof(meye.mchip_ptable)); memset(meye.mchip_ptable, 0, sizeof(meye.mchip_ptable));
/* give only 32 bit DMA addresses */
if (dma_set_mask(&meye.mchip_dev->dev, 0xffffffff))
return -1;
meye.mchip_ptable_toc = dma_alloc_coherent(&meye.mchip_dev->dev, meye.mchip_ptable_toc = dma_alloc_coherent(&meye.mchip_dev->dev,
PAGE_SIZE, PAGE_SIZE,
&meye.mchip_dmahandle, &meye.mchip_dmahandle,
...@@ -134,17 +135,19 @@ static int ptable_alloc(void) ...@@ -134,17 +135,19 @@ static int ptable_alloc(void)
pt = meye.mchip_ptable_toc; pt = meye.mchip_ptable_toc;
for (i = 0; i < MCHIP_NB_PAGES; i++) { for (i = 0; i < MCHIP_NB_PAGES; i++) {
dma_addr_t dma;
meye.mchip_ptable[i] = dma_alloc_coherent(&meye.mchip_dev->dev, meye.mchip_ptable[i] = dma_alloc_coherent(&meye.mchip_dev->dev,
PAGE_SIZE, PAGE_SIZE,
pt, &dma,
GFP_KERNEL); GFP_KERNEL);
if (!meye.mchip_ptable[i]) { if (!meye.mchip_ptable[i]) {
int j; int j;
pt = meye.mchip_ptable_toc; pt = meye.mchip_ptable_toc;
for (j = 0; j < i; ++j) { for (j = 0; j < i; ++j) {
dma = (dma_addr_t) *pt;
dma_free_coherent(&meye.mchip_dev->dev, dma_free_coherent(&meye.mchip_dev->dev,
PAGE_SIZE, PAGE_SIZE,
meye.mchip_ptable[j], *pt); meye.mchip_ptable[j], dma);
pt++; pt++;
} }
dma_free_coherent(&meye.mchip_dev->dev, dma_free_coherent(&meye.mchip_dev->dev,
...@@ -155,6 +158,7 @@ static int ptable_alloc(void) ...@@ -155,6 +158,7 @@ static int ptable_alloc(void)
meye.mchip_dmahandle = 0; meye.mchip_dmahandle = 0;
return -1; return -1;
} }
*pt = (u32) dma;
pt++; pt++;
} }
return 0; return 0;
...@@ -162,15 +166,16 @@ static int ptable_alloc(void) ...@@ -162,15 +166,16 @@ static int ptable_alloc(void)
static void ptable_free(void) static void ptable_free(void)
{ {
dma_addr_t *pt; u32 *pt;
int i; int i;
pt = meye.mchip_ptable_toc; pt = meye.mchip_ptable_toc;
for (i = 0; i < MCHIP_NB_PAGES; i++) { for (i = 0; i < MCHIP_NB_PAGES; i++) {
dma_addr_t dma = (dma_addr_t) *pt;
if (meye.mchip_ptable[i]) if (meye.mchip_ptable[i])
dma_free_coherent(&meye.mchip_dev->dev, dma_free_coherent(&meye.mchip_dev->dev,
PAGE_SIZE, PAGE_SIZE,
meye.mchip_ptable[i], *pt); meye.mchip_ptable[i], dma);
pt++; pt++;
} }
...@@ -520,11 +525,11 @@ static void mchip_vrj_setup(u8 mode) ...@@ -520,11 +525,11 @@ static void mchip_vrj_setup(u8 mode)
} }
/* sets the DMA parameters into the chip */ /* sets the DMA parameters into the chip */
static void mchip_dma_setup(u32 dma_addr) static void mchip_dma_setup(dma_addr_t dma_addr)
{ {
int i; int i;
mchip_set(MCHIP_MM_PT_ADDR, dma_addr); mchip_set(MCHIP_MM_PT_ADDR, (u32)dma_addr);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
mchip_set(MCHIP_MM_FIR(i), 0); mchip_set(MCHIP_MM_FIR(i), 0);
meye.mchip_fnum = 0; meye.mchip_fnum = 0;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#define _MEYE_PRIV_H_ #define _MEYE_PRIV_H_
#define MEYE_DRIVER_MAJORVERSION 1 #define MEYE_DRIVER_MAJORVERSION 1
#define MEYE_DRIVER_MINORVERSION 12 #define MEYE_DRIVER_MINORVERSION 13
#define MEYE_DRIVER_VERSION __stringify(MEYE_DRIVER_MAJORVERSION) "." \ #define MEYE_DRIVER_VERSION __stringify(MEYE_DRIVER_MAJORVERSION) "." \
__stringify(MEYE_DRIVER_MINORVERSION) __stringify(MEYE_DRIVER_MINORVERSION)
...@@ -294,7 +294,7 @@ struct meye { ...@@ -294,7 +294,7 @@ struct meye {
u8 mchip_fnum; /* current mchip frame number */ u8 mchip_fnum; /* current mchip frame number */
unsigned char __iomem *mchip_mmregs;/* mchip: memory mapped registers */ unsigned char __iomem *mchip_mmregs;/* mchip: memory mapped registers */
u8 *mchip_ptable[MCHIP_NB_PAGES];/* mchip: ptable */ u8 *mchip_ptable[MCHIP_NB_PAGES];/* mchip: ptable */
dma_addr_t *mchip_ptable_toc; /* mchip: ptable toc */ void *mchip_ptable_toc; /* mchip: ptable toc */
dma_addr_t mchip_dmahandle; /* mchip: dma handle to ptable toc */ dma_addr_t mchip_dmahandle; /* mchip: dma handle to ptable toc */
unsigned char *grab_fbuffer; /* capture framebuffer */ unsigned char *grab_fbuffer; /* capture framebuffer */
unsigned char *grab_temp; /* temporary buffer */ unsigned char *grab_temp; /* temporary buffer */
......
...@@ -2,7 +2,12 @@ Version 1.28 ...@@ -2,7 +2,12 @@ Version 1.28
------------ ------------
Add module init parm for large SMB buffer size (to allow it to be changed Add module init parm for large SMB buffer size (to allow it to be changed
from its default of 16K) which is especially useful for large file copy from its default of 16K) which is especially useful for large file copy
when mounting with the directio mount option. when mounting with the directio mount option. Fix oops after
returning from mount when experimental ExtendedSecurity enabled and
SpnegoNegotiated returning invalid error. Fix case to retry better when
peek returns from 1 to 3 bytes on socket which should have more data.
Fixed path based calls (such as cifs lookup) to handle path names
longer than 530 (now can handle PATH_MAX).
Version 1.27 Version 1.27
------------ ------------
......
...@@ -64,6 +64,13 @@ trivially built from Samba 3.0 or later source e.g. by executing: ...@@ -64,6 +64,13 @@ trivially built from Samba 3.0 or later source e.g. by executing:
gcc samba/source/client/mount.cifs.c -o mount.cifs gcc samba/source/client/mount.cifs.c -o mount.cifs
If cifs is built as a module, then the size and number of network buffers
and maximum number of simultaneous requests to one server can be configured.
Changing these from their defaults is not recommended. By executing modinfo
modinfo kernel/fs/cifs/cifs.ko
on kernel/fs/cifs/cifs.ko the list of configuration changes that can be made
at module initialization time (by running insmod cifs.ko) can be seen.
Allowing User Mounts Allowing User Mounts
==================== ====================
To permit users to mount and unmount over directories they own is possible To permit users to mount and unmount over directories they own is possible
......
...@@ -60,7 +60,7 @@ unsigned int sign_CIFS_PDUs = 1; ...@@ -60,7 +60,7 @@ unsigned int sign_CIFS_PDUs = 1;
struct task_struct * oplockThread = NULL; struct task_struct * oplockThread = NULL;
unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE; unsigned int CIFSMaxBufSize = CIFS_MAX_MSGSIZE;
module_param(CIFSMaxBufSize, int, CIFS_MAX_MSGSIZE); module_param(CIFSMaxBufSize, int, CIFS_MAX_MSGSIZE);
MODULE_PARM_DESC(CIFSMaxBufSize,"Network buffer size (not including header). Default: 16384 Range: 4096 to 130048"); MODULE_PARM_DESC(CIFSMaxBufSize,"Network buffer size (not including header). Default: 16384 Range: 8192 to 130048");
unsigned int cifs_min_rcv = CIFS_MIN_RCV_POOL; unsigned int cifs_min_rcv = CIFS_MIN_RCV_POOL;
module_param(cifs_min_rcv, int, CIFS_MIN_RCV_POOL); module_param(cifs_min_rcv, int, CIFS_MIN_RCV_POOL);
MODULE_PARM_DESC(cifs_min_rcv,"Network buffers in pool. Default: 4 Range: 1 to 64"); MODULE_PARM_DESC(cifs_min_rcv,"Network buffers in pool. Default: 4 Range: 1 to 64");
...@@ -632,8 +632,10 @@ cifs_destroy_inodecache(void) ...@@ -632,8 +632,10 @@ cifs_destroy_inodecache(void)
static int static int
cifs_init_request_bufs(void) cifs_init_request_bufs(void)
{ {
if(CIFSMaxBufSize < 4096) { if(CIFSMaxBufSize < 8192) {
CIFSMaxBufSize = 4096; /* Buffer size can not be smaller than 2 * PATH_MAX since maximum
Unicode path name has to fit in any SMB/CIFS path based frames */
CIFSMaxBufSize = 8192;
} else if (CIFSMaxBufSize > 1024*127) { } else if (CIFSMaxBufSize > 1024*127) {
CIFSMaxBufSize = 1024 * 127; CIFSMaxBufSize = 1024 * 127;
} else { } else {
......
...@@ -389,6 +389,12 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) ...@@ -389,6 +389,12 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
SecurityBlob, SecurityBlob,
count - 16, count - 16,
&server->secType); &server->secType);
if(rc == 1) {
/* BB Need to fill struct for sessetup here */
rc = -EOPNOTSUPP;
} else {
rc = -EINVAL;
}
} }
} else } else
server->capabilities &= ~CAP_EXTENDED_SECURITY; server->capabilities &= ~CAP_EXTENDED_SECURITY;
...@@ -547,13 +553,13 @@ CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon, ...@@ -547,13 +553,13 @@ CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->fileName, fileName, 530 cifs_strtoUCS((wchar_t *) pSMB->fileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fileName, 530); name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->fileName, fileName, name_len); strncpy(pSMB->fileName, fileName, name_len);
} }
...@@ -599,13 +605,13 @@ CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon, ...@@ -599,13 +605,13 @@ CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon,
return rc; return rc;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, dirName, 530 name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, dirName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(dirName, 530); name_len = strnlen(dirName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->DirName, dirName, name_len); strncpy(pSMB->DirName, dirName, name_len);
} }
...@@ -649,13 +655,13 @@ CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon, ...@@ -649,13 +655,13 @@ CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon,
return rc; return rc;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, name, 530 name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, name, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(name, 530); name_len = strnlen(name, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->DirName, name, name_len); strncpy(pSMB->DirName, name, name_len);
} }
...@@ -706,7 +712,7 @@ CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon, ...@@ -706,7 +712,7 @@ CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
count = 1; /* account for one byte pad to word boundary */ count = 1; /* account for one byte pad to word boundary */
name_len = name_len =
cifs_strtoUCS((wchar_t *) (pSMB->fileName + 1), cifs_strtoUCS((wchar_t *) (pSMB->fileName + 1),
fileName, 530 fileName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
...@@ -714,7 +720,7 @@ CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon, ...@@ -714,7 +720,7 @@ CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
pSMB->NameLength = cpu_to_le16(name_len); pSMB->NameLength = cpu_to_le16(name_len);
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
count = 0; /* no pad */ count = 0; /* no pad */
name_len = strnlen(fileName, 530); name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
pSMB->NameLength = cpu_to_le16(name_len); pSMB->NameLength = cpu_to_le16(name_len);
strncpy(pSMB->fileName, fileName, name_len); strncpy(pSMB->fileName, fileName, name_len);
...@@ -1113,7 +1119,7 @@ CIFSSMBRename(const int xid, struct cifsTconInfo *tcon, ...@@ -1113,7 +1119,7 @@ CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, 530 cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
...@@ -1123,15 +1129,15 @@ CIFSSMBRename(const int xid, struct cifsTconInfo *tcon, ...@@ -1123,15 +1129,15 @@ CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
pSMB->OldFileName[name_len + 1] = 0x00; pSMB->OldFileName[name_len + 1] = 0x00;
name_len2 = name_len2 =
cifs_strtoUCS((wchar_t *) & pSMB-> cifs_strtoUCS((wchar_t *) & pSMB->
OldFileName[name_len + 2], toName, 530, OldFileName[name_len + 2], toName, PATH_MAX,
nls_codepage); nls_codepage);
name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
name_len2 *= 2; /* convert to bytes */ name_len2 *= 2; /* convert to bytes */
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fromName, 530); name_len = strnlen(fromName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->OldFileName, fromName, name_len); strncpy(pSMB->OldFileName, fromName, name_len);
name_len2 = strnlen(toName, 530); name_len2 = strnlen(toName, PATH_MAX);
name_len2++; /* trailing null */ name_len2++; /* trailing null */
pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2); strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2);
...@@ -1212,7 +1218,7 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon, ...@@ -1212,7 +1218,7 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid); sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid);
len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, dummy_string, 24, nls_codepage); len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, dummy_string, 24, nls_codepage);
} else { } else {
len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, target_name, 530, nls_codepage); len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, target_name, PATH_MAX, nls_codepage);
} }
rename_info->target_name_len = cpu_to_le32(2 * len_of_str); rename_info->target_name_len = cpu_to_le32(2 * len_of_str);
count = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2; count = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2;
...@@ -1271,7 +1277,7 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName, ...@@ -1271,7 +1277,7 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName, name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName,
fromName, fromName,
530 /* find define for this maxpathcomponent */, PATH_MAX /* find define for this maxpathcomponent */,
nls_codepage); nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
...@@ -1279,15 +1285,15 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName, ...@@ -1279,15 +1285,15 @@ CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName,
/* protocol requires ASCII signature byte on Unicode string */ /* protocol requires ASCII signature byte on Unicode string */
pSMB->OldFileName[name_len + 1] = 0x00; pSMB->OldFileName[name_len + 1] = 0x00;
name_len2 = cifs_strtoUCS((wchar_t *) & pSMB-> name_len2 = cifs_strtoUCS((wchar_t *) & pSMB->
OldFileName[name_len + 2], toName, 530, OldFileName[name_len + 2], toName, PATH_MAX,
nls_codepage); nls_codepage);
name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
name_len2 *= 2; /* convert to bytes */ name_len2 *= 2; /* convert to bytes */
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fromName, 530); name_len = strnlen(fromName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->OldFileName, fromName, name_len); strncpy(pSMB->OldFileName, fromName, name_len);
name_len2 = strnlen(toName, 530); name_len2 = strnlen(toName, PATH_MAX);
name_len2++; /* trailing null */ name_len2++; /* trailing null */
pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2); strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2);
...@@ -1337,14 +1343,14 @@ CIFSUnixCreateSymLink(const int xid, struct cifsTconInfo *tcon, ...@@ -1337,14 +1343,14 @@ CIFSUnixCreateSymLink(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, fromName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, fromName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fromName, 530); name_len = strnlen(fromName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, fromName, name_len); strncpy(pSMB->FileName, fromName, name_len);
} }
...@@ -1361,13 +1367,13 @@ CIFSUnixCreateSymLink(const int xid, struct cifsTconInfo *tcon, ...@@ -1361,13 +1367,13 @@ CIFSUnixCreateSymLink(const int xid, struct cifsTconInfo *tcon,
data_offset = (char *) (&pSMB->hdr.Protocol) + offset; data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len_target = name_len_target =
cifs_strtoUCS((wchar_t *) data_offset, toName, 530 cifs_strtoUCS((wchar_t *) data_offset, toName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len_target++; /* trailing null */ name_len_target++; /* trailing null */
name_len_target *= 2; name_len_target *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len_target = strnlen(toName, 530); name_len_target = strnlen(toName, PATH_MAX);
name_len_target++; /* trailing null */ name_len_target++; /* trailing null */
strncpy(data_offset, toName, name_len_target); strncpy(data_offset, toName, name_len_target);
} }
...@@ -1428,14 +1434,14 @@ CIFSUnixCreateHardLink(const int xid, struct cifsTconInfo *tcon, ...@@ -1428,14 +1434,14 @@ CIFSUnixCreateHardLink(const int xid, struct cifsTconInfo *tcon,
return rc; return rc;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = cifs_strtoUCS((wchar_t *) pSMB->FileName, toName, 530 name_len = cifs_strtoUCS((wchar_t *) pSMB->FileName, toName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(toName, 530); name_len = strnlen(toName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, toName, name_len); strncpy(pSMB->FileName, toName, name_len);
} }
...@@ -1452,13 +1458,13 @@ CIFSUnixCreateHardLink(const int xid, struct cifsTconInfo *tcon, ...@@ -1452,13 +1458,13 @@ CIFSUnixCreateHardLink(const int xid, struct cifsTconInfo *tcon,
data_offset = (char *) (&pSMB->hdr.Protocol) + offset; data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len_target = name_len_target =
cifs_strtoUCS((wchar_t *) data_offset, fromName, 530 cifs_strtoUCS((wchar_t *) data_offset, fromName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len_target++; /* trailing null */ name_len_target++; /* trailing null */
name_len_target *= 2; name_len_target *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len_target = strnlen(fromName, 530); name_len_target = strnlen(fromName, PATH_MAX);
name_len_target++; /* trailing null */ name_len_target++; /* trailing null */
strncpy(data_offset, fromName, name_len_target); strncpy(data_offset, fromName, name_len_target);
} }
...@@ -1524,7 +1530,7 @@ CIFSCreateHardLink(const int xid, struct cifsTconInfo *tcon, ...@@ -1524,7 +1530,7 @@ CIFSCreateHardLink(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, 530 cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
...@@ -1533,15 +1539,15 @@ CIFSCreateHardLink(const int xid, struct cifsTconInfo *tcon, ...@@ -1533,15 +1539,15 @@ CIFSCreateHardLink(const int xid, struct cifsTconInfo *tcon,
pSMB->OldFileName[name_len + 1] = 0x04; pSMB->OldFileName[name_len + 1] = 0x04;
name_len2 = name_len2 =
cifs_strtoUCS((wchar_t *) & pSMB-> cifs_strtoUCS((wchar_t *) & pSMB->
OldFileName[name_len + 2], toName, 530, OldFileName[name_len + 2], toName, PATH_MAX,
nls_codepage); nls_codepage);
name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
name_len2 *= 2; /* convert to bytes */ name_len2 *= 2; /* convert to bytes */
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fromName, 530); name_len = strnlen(fromName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->OldFileName, fromName, name_len); strncpy(pSMB->OldFileName, fromName, name_len);
name_len2 = strnlen(toName, 530); name_len2 = strnlen(toName, PATH_MAX);
name_len2++; /* trailing null */ name_len2++; /* trailing null */
pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */ pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2); strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2);
...@@ -1590,13 +1596,13 @@ CIFSSMBUnixQuerySymLink(const int xid, struct cifsTconInfo *tcon, ...@@ -1590,13 +1596,13 @@ CIFSSMBUnixQuerySymLink(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(searchName, 530); name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len); strncpy(pSMB->FileName, searchName, name_len);
} }
...@@ -1906,7 +1912,7 @@ CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon, ...@@ -1906,7 +1912,7 @@ CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* BB fixme find define for this maxpathcomponent */ /* BB fixme find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
...@@ -1914,7 +1920,7 @@ CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon, ...@@ -1914,7 +1920,7 @@ CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon,
pSMB->FileName[name_len] = 0; pSMB->FileName[name_len] = 0;
pSMB->FileName[name_len+1] = 0; pSMB->FileName[name_len+1] = 0;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(searchName, 530 /* BB fixme */); name_len = strnlen(searchName, PATH_MAX /* BB fixme */);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len); strncpy(pSMB->FileName, searchName, name_len);
} }
...@@ -1992,13 +1998,13 @@ CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon, ...@@ -1992,13 +1998,13 @@ CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon,
return rc; return rc;
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* BB fixme find define for this maxpathcomponent */ /* BB fixme find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fileName, 530); name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len); strncpy(pSMB->FileName, fileName, name_len);
} }
...@@ -2075,13 +2081,13 @@ CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, ...@@ -2075,13 +2081,13 @@ CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(searchName, 530); name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len); strncpy(pSMB->FileName, searchName, name_len);
} }
...@@ -2158,13 +2164,13 @@ CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon, ...@@ -2158,13 +2164,13 @@ CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(searchName, 530); name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len); strncpy(pSMB->FileName, searchName, name_len);
} }
...@@ -2242,13 +2248,13 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon, ...@@ -2242,13 +2248,13 @@ CIFSFindSingle(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(searchName, 530); name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len); strncpy(pSMB->FileName, searchName, name_len);
} }
...@@ -2325,13 +2331,13 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, ...@@ -2325,13 +2331,13 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(searchName, 530); name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len); strncpy(pSMB->FileName, searchName, name_len);
} }
...@@ -2586,7 +2592,7 @@ int CIFSFindNext2(const int xid, struct cifsTconInfo *tcon, ...@@ -2586,7 +2592,7 @@ int CIFSFindNext2(const int xid, struct cifsTconInfo *tcon,
cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO); cpu_to_le16(SMB_FIND_FILE_DIRECTORY_INFO);
psrch_inf->info_level = SMB_FIND_FILE_DIRECTORY_INFO; psrch_inf->info_level = SMB_FIND_FILE_DIRECTORY_INFO;
} */ } */
pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level); pSMB->InformationLevel = cpu_to_le16(psrch_inf->info_level);
pSMB->ResumeKey = psrch_inf->resume_key; pSMB->ResumeKey = psrch_inf->resume_key;
pSMB->SearchFlags = pSMB->SearchFlags =
cpu_to_le16(CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME); cpu_to_le16(CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME);
...@@ -2876,13 +2882,13 @@ CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, ...@@ -2876,13 +2882,13 @@ CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->RequestFileName, cifs_strtoUCS((wchar_t *) pSMB->RequestFileName,
searchName, 530 searchName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(searchName, 530); name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->RequestFileName, searchName, name_len); strncpy(pSMB->RequestFileName, searchName, name_len);
} }
...@@ -3329,13 +3335,13 @@ CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName, ...@@ -3329,13 +3335,13 @@ CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fileName, 530); name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len); strncpy(pSMB->FileName, fileName, name_len);
} }
...@@ -3508,13 +3514,13 @@ CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, const char *fileName, ...@@ -3508,13 +3514,13 @@ CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, const char *fileName,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fileName, 530); name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len); strncpy(pSMB->FileName, fileName, name_len);
} }
...@@ -3588,13 +3594,13 @@ CIFSSMBSetTimesLegacy(int xid, struct cifsTconInfo *tcon, char *fileName, ...@@ -3588,13 +3594,13 @@ CIFSSMBSetTimesLegacy(int xid, struct cifsTconInfo *tcon, char *fileName,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fileName, 530); name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len); strncpy(pSMB->FileName, fileName, name_len);
} }
...@@ -3624,12 +3630,7 @@ CIFSSMBSetTimesLegacy(int xid, struct cifsTconInfo *tcon, char *fileName, ...@@ -3624,12 +3630,7 @@ CIFSSMBSetTimesLegacy(int xid, struct cifsTconInfo *tcon, char *fileName,
pSMB->ParameterCount = cpu_to_le16(params); pSMB->ParameterCount = cpu_to_le16(params);
pSMB->TotalDataCount = pSMB->DataCount; pSMB->TotalDataCount = pSMB->DataCount;
pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->TotalParameterCount = pSMB->ParameterCount;
/* I doubt that passthrough levels apply to this old pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD);
preNT info level */
/* if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU)
pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO2);
else*/
pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD);
pSMB->Reserved4 = 0; pSMB->Reserved4 = 0;
pSMB->hdr.smb_buf_length += byte_count; pSMB->hdr.smb_buf_length += byte_count;
memcpy(data_offset, data, sizeof (FILE_INFO_STANDARD)); memcpy(data_offset, data, sizeof (FILE_INFO_STANDARD));
...@@ -3671,13 +3672,13 @@ CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon, ...@@ -3671,13 +3672,13 @@ CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fileName, 530); name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len); strncpy(pSMB->FileName, fileName, name_len);
} }
...@@ -3820,13 +3821,13 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, ...@@ -3820,13 +3821,13 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(searchName, 530); name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len); strncpy(pSMB->FileName, searchName, name_len);
} }
...@@ -3964,13 +3965,13 @@ ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon, ...@@ -3964,13 +3965,13 @@ ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(searchName, 530); name_len = strnlen(searchName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, searchName, name_len); strncpy(pSMB->FileName, searchName, name_len);
} }
...@@ -4111,13 +4112,13 @@ CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, const char *fileName, ...@@ -4111,13 +4112,13 @@ CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, const char *fileName,
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len = name_len =
cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX
/* find define for this maxpathcomponent */ /* find define for this maxpathcomponent */
, nls_codepage); , nls_codepage);
name_len++; /* trailing null */ name_len++; /* trailing null */
name_len *= 2; name_len *= 2;
} else { /* BB improve the check for buffer overruns BB */ } else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fileName, 530); name_len = strnlen(fileName, PATH_MAX);
name_len++; /* trailing null */ name_len++; /* trailing null */
strncpy(pSMB->FileName, fileName, name_len); strncpy(pSMB->FileName, fileName, name_len);
} }
......
...@@ -254,7 +254,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -254,7 +254,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
cFYI(1,("call to reconnect done")); cFYI(1,("call to reconnect done"));
csocket = server->ssocket; csocket = server->ssocket;
continue; continue;
} else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) { } else if ((length == -ERESTARTSYS) || (length == -EAGAIN)
|| ((length > 0) && (length <= 3)) ) {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1); /* minimum sleep to prevent looping schedule_timeout(1); /* minimum sleep to prevent looping
allowing socket to clear and app threads to set allowing socket to clear and app threads to set
...@@ -280,7 +281,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -280,7 +281,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
} }
pdu_length = 4 + ntohl(smb_buffer->smb_buf_length); pdu_length = 4 + ntohl(smb_buffer->smb_buf_length);
/* Ony read pdu_length after below checks for too short (due /* Only read pdu_length after below checks for too short (due
to e.g. int overflow) and too long ie beyond end of buf */ to e.g. int overflow) and too long ie beyond end of buf */
cFYI(1, ("Peek length rcvd: 0x%x beginning 0x%x)", length, pdu_length)); cFYI(1, ("Peek length rcvd: 0x%x beginning 0x%x)", length, pdu_length));
...@@ -330,13 +331,19 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -330,13 +331,19 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
csocket = server->ssocket; csocket = server->ssocket;
continue; continue;
} else { } else {
if (/*(length != sizeof (struct smb_hdr) - 1) if (length < 16) {
||*/ (pdu_length > /* We can not validate the SMB unless
at least this much of SMB available
so give the socket time to copy
a few more bytes and retry */
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(10);
continue;
} else if( (pdu_length >
CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE)
|| (pdu_length < || (pdu_length <
sizeof (struct smb_hdr) - 1) sizeof (struct smb_hdr) - 1)
|| || (checkSMBhdr
(checkSMBhdr
(smb_buffer, smb_buffer->Mid))) { (smb_buffer, smb_buffer->Mid))) {
cERROR(1, cERROR(1,
("Invalid size or format for SMB found with length %d and pdu_length %d", ("Invalid size or format for SMB found with length %d and pdu_length %d",
......
...@@ -64,7 +64,7 @@ cifs_open(struct inode *inode, struct file *file) ...@@ -64,7 +64,7 @@ cifs_open(struct inode *inode, struct file *file)
read_lock(&GlobalSMBSeslock); read_lock(&GlobalSMBSeslock);
list_for_each(tmp, &pCifsInode->openFileList) { list_for_each(tmp, &pCifsInode->openFileList) {
pCifsFile = list_entry(tmp,struct cifsFileInfo, flist); pCifsFile = list_entry(tmp,struct cifsFileInfo, flist);
if((pCifsFile->pfile == NULL)&& (pCifsFile->pid = current->pid)){ if((pCifsFile->pfile == NULL)&& (pCifsFile->pid == current->tgid)){
/* mode set in cifs_create */ /* mode set in cifs_create */
pCifsFile->pfile = file; /* needed for writepage */ pCifsFile->pfile = file; /* needed for writepage */
file->private_data = pCifsFile; file->private_data = pCifsFile;
...@@ -168,7 +168,7 @@ cifs_open(struct inode *inode, struct file *file) ...@@ -168,7 +168,7 @@ cifs_open(struct inode *inode, struct file *file)
memset(file->private_data, 0, sizeof(struct cifsFileInfo)); memset(file->private_data, 0, sizeof(struct cifsFileInfo));
pCifsFile = (struct cifsFileInfo *) file->private_data; pCifsFile = (struct cifsFileInfo *) file->private_data;
pCifsFile->netfid = netfid; pCifsFile->netfid = netfid;
pCifsFile->pid = current->pid; pCifsFile->pid = current->tgid;
init_MUTEX(&pCifsFile->fh_sem); init_MUTEX(&pCifsFile->fh_sem);
pCifsFile->pfile = file; /* needed for writepage */ pCifsFile->pfile = file; /* needed for writepage */
pCifsFile->pInode = inode; pCifsFile->pInode = inode;
...@@ -598,7 +598,7 @@ cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) ...@@ -598,7 +598,7 @@ cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
pfLock->fl_start, numUnlock, numLock, lockType, pfLock->fl_start, numUnlock, numLock, lockType,
wait_flag); wait_flag);
if (rc == 0 && (pfLock->fl_flags & FL_POSIX)) if (rc == 0 && (pfLock->fl_flags & FL_POSIX))
posix_lock_file(file, pfLock); posix_lock_file_wait(file, pfLock);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
} }
......
...@@ -980,6 +980,16 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -980,6 +980,16 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs)
via Handle (SetFileInfo) instead of by path */ via Handle (SetFileInfo) instead of by path */
rc = CIFSSMBSetTimes(xid, pTcon, full_path, &time_buf, rc = CIFSSMBSetTimes(xid, pTcon, full_path, &time_buf,
cifs_sb->local_nls); cifs_sb->local_nls);
if(rc == -EOPNOTSUPP) {
cFYI(1,("OS2 level of SetPathInfo not implemented"));
/* Need to convert time_buf into old format,
but probably better to do that inside the function
below rather than here */
/* Better to return EOPNOTSUPP until function
below is ready */
/* CIFSSMBSetTimesLegacy(xid, pTcon, full_path,
FILE_INFO_STANDARD * data, cifs_sb->local_nls); */
}
} }
/* do not need local check to inode_check_ok since the server does that */ /* do not need local check to inode_check_ok since the server does that */
......
...@@ -754,7 +754,8 @@ static const struct { ...@@ -754,7 +754,8 @@ static const struct {
ERRDOS, ERRnoaccess, 0xc000028e}, { ERRDOS, ERRnoaccess, 0xc000028e}, {
ERRDOS, ERRnoaccess, 0xc000028f}, { ERRDOS, ERRnoaccess, 0xc000028f}, {
ERRDOS, ERRnoaccess, 0xc0000290}, { ERRDOS, ERRnoaccess, 0xc0000290}, {
ERRDOS, ERRbadfunc, 0xc000029c},}; ERRDOS, ERRbadfunc, 0xc000029c}, {
ERRDOS, ERRinvlevel, 0x007c0001}, };
/***************************************************************************** /*****************************************************************************
Print an error message from the status code Print an error message from the status code
......
...@@ -91,7 +91,7 @@ udelay (unsigned long usecs) ...@@ -91,7 +91,7 @@ udelay (unsigned long usecs)
unsigned long cycles = usecs*local_cpu_data->cyc_per_usec; unsigned long cycles = usecs*local_cpu_data->cyc_per_usec;
while (ia64_get_itc() - start < cycles) while (ia64_get_itc() - start < cycles)
/* skip */; cpu_relax();
} }
#endif /* _ASM_IA64_DELAY_H */ #endif /* _ASM_IA64_DELAY_H */
...@@ -65,8 +65,8 @@ struct module *ip_conntrack_irc = THIS_MODULE; ...@@ -65,8 +65,8 @@ struct module *ip_conntrack_irc = THIS_MODULE;
#define DEBUGP(format, args...) #define DEBUGP(format, args...)
#endif #endif
int parse_dcc(char *data, char *data_end, u_int32_t * ip, u_int16_t * port, static int parse_dcc(char *data, char *data_end, u_int32_t *ip,
char **ad_beg_p, char **ad_end_p) u_int16_t *port, char **ad_beg_p, char **ad_end_p)
/* tries to get the ip_addr and port out of a dcc command /* tries to get the ip_addr and port out of a dcc command
return value: -1 on failure, 0 on success return value: -1 on failure, 0 on success
data pointer to first byte of DCC command data data pointer to first byte of DCC command data
......
...@@ -741,6 +741,7 @@ static int init_or_cleanup(int init) ...@@ -741,6 +741,7 @@ static int init_or_cleanup(int init)
goto cleanup_nothing; goto cleanup_nothing;
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
ret = -ENOMEM;
proc = proc_net_fops_create("ip_conntrack", 0440, &ct_file_ops); proc = proc_net_fops_create("ip_conntrack", 0440, &ct_file_ops);
if (!proc) goto cleanup_init; if (!proc) goto cleanup_init;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment