From 2cb8a2a3756c6b282b1bea6a27afc04c8cc4eb51 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 23 Nov 2007 15:22:44 -0500 Subject: [PATCH] 2.2.18pre20 o Fix ide-probe SMP build error (Ian Morgan) o Fix appletalk physical layer ioctl handling (Andi Kleen) o Sparc update (Dave Miller) o Update Stephen Tweedie's contact info (Stephen Tweedie) o Fix typo in esp and scsi_obsolete code (Dave Miller) o Bonding ioctl check fix (Willy Tarreau) o Fix ipv6 procfs bug (Al Viro) o Report PIV in proc as family 15 and uname as (Alan Cox) model 6 as discussed o Redo Intel cache decodes as code not tables (Alan Cox) and add new ones (based on updates by Asit Mallick & Andrew Ip) o Fix CMOS locking in machine_power_off paths (Alan Cox) o Create build tree symlinks only if insmod is new enough not to be confused by it (Keith Owens) o Fix cmsg handling (Philippe Troin) o Tiny xpds driver changes (Dan Hollis) o Fix vmalloc sign bug (Ben LaHaise) o SMBFS fixes/changes for find_next problems and (Urban Widmark) to avoid truncate bug in netapps o Fix ntfs translation bug (Anton Altaparmakov) o Fix sparc problem with some soundcards and the (Jeff Garzik) _IOC magic o Update ppa driver to v2.05 (Tim Waugh) --- CREDITS | 11 +-- Makefile | 3 +- arch/i386/kernel/process.c | 10 ++- arch/i386/kernel/setup.c | 120 +++++++++++++++++++--------- arch/sparc/config.in | 5 +- arch/sparc64/config.in | 18 +++-- arch/sparc64/defconfig | 30 +++---- arch/sparc64/kernel/psycho.c | 16 ++-- arch/sparc64/kernel/sparc64_ksyms.c | 6 +- drivers/block/ide-probe.c | 1 + drivers/char/rio/riotty.c | 2 +- drivers/net/bonding.c | 3 + drivers/net/xpds/xpds-encap-fr.c | 2 +- drivers/net/xpds/xpds.c | 2 +- drivers/sbus/audio/Config.in | 6 +- drivers/scsi/esp.c | 4 +- drivers/scsi/ppa.c | 17 ++-- drivers/scsi/ppa.h | 10 ++- drivers/scsi/scsi_obsolete.c | 2 +- drivers/sound/ac97.c | 6 +- drivers/sound/ac97_codec.c | 6 +- drivers/sound/ad1816.c | 2 +- drivers/sound/cmpci.c | 6 +- drivers/sound/cs4281.c | 6 +- drivers/sound/es1370.c | 6 +- drivers/sound/es1371.c | 6 +- drivers/sound/esssolo1.c | 6 +- drivers/sound/maestro.c | 6 +- drivers/sound/sonicvibes.c | 6 +- drivers/video/atyfb.c | 2 +- fs/ntfs/super.c | 2 +- fs/smbfs/ChangeLog | 6 ++ fs/smbfs/proc.c | 76 +++++++++++------- fs/smbfs/sock.c | 57 +++++++------ include/asm-i386/bugs.h | 10 ++- include/asm-i386/spinlock.h | 5 ++ include/asm-sparc/asm_offsets.h | 32 ++++---- include/asm-sparc64/io.h | 23 +++++- include/linux/smb.h | 10 ++- kernel/ksyms.c | 1 + mm/vmalloc.c | 7 +- net/appletalk/ddp.c | 18 +---- net/core/scm.c | 8 +- net/ipv4/proc.c | 2 +- net/ipv6/route.c | 12 +-- 45 files changed, 359 insertions(+), 236 deletions(-) diff --git a/CREDITS b/CREDITS index 87c7253d18b4..285986308b3c 100644 --- a/CREDITS +++ b/CREDITS @@ -2177,17 +2177,14 @@ S: Rockville, Maryland 20853 S: USA N: Stephen Tweedie -E: sct@dcs.ed.ac.uk +E: sct@redhat.com P: 1024/E7A417AD E2 FE A4 20 34 EC ED FC 7D 7E 67 8D E0 31 D1 69 +P: 1024D/43BE7544 D2A4 8556 08E6 90E7 076C BA3F 243F 20A4 43BE 7544 D: Second extended file system developer D: General filesystem hacker D: kswap vm management code -S: Dept. of Computer Science -S: University of Edinburgh -S: JCMB, The King's Buildings -S: Mayfield Road -S: Edinburgh -S: EH9 3JZ +S: 44 Campbell Park Crescent +S: Edinburgh EH13 0HT S: United Kingdom N: Thomas Uhl diff --git a/Makefile b/Makefile index 1e210bbb96d6..b84d817a1492 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 2 SUBLEVEL = 18 -EXTRAVERSION = pre19 +EXTRAVERSION = pre20 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) @@ -335,6 +335,7 @@ modules_install: MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE); \ mkdir -p $$MODLIB; \ rm -f $$MODLIB/build; \ + [ `/sbin/insmod -V 2>&1 | head -1 | awk '/^insmod version /{split("$3", a, /\./); printf "%d%03d%03d\n", a[1], a[2], a[3];}'`0 -ge 20030140 ] && \ ln -s `pwd` $$MODLIB/build; \ cd modules; \ MODULES=""; \ diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 0267180290d7..096226ab1f5c 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -253,8 +254,10 @@ static inline void kb_wait(void) */ void machine_real_restart(unsigned char *code, int length) { + unsigned long flags; + cli(); - + /* Write zero to CMOS register number 0x0f, which the BIOS POST routine will recognize as telling it to do a proper reboot. (Well that's what this book in front of me says -- it may only apply to @@ -264,8 +267,9 @@ void machine_real_restart(unsigned char *code, int length) `outb_p' is needed instead of just `outb'. Use it to be on the safe side. */ - outb_p (0x8f, 0x70); - outb_p (0x00, 0x71); + spin_lock_irqsave(&rtc_lock, flags); + CMOS_WRITE(0x00, 0x8f); + spin_unlock_irqrestore(&rtc_lock, flags); /* Remap the kernel at virtual address zero, as well as offset zero from the kernel segment. This assumes the kernel segment starts at diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index 17fc5a7ec925..f8177585136c 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -35,6 +35,10 @@ * * Added Cyrix III initial detection code * Alan Cox , Septembr 2000 + * + * Improve cache size calculation + * Asit Mallick , October 2000 + * Andrew Ip , October 2000 */ /* @@ -914,7 +918,7 @@ __initfunc(void identify_cpu(struct cpuinfo_x86 *c)) int i; char *p = NULL; extern void mcheck_init(void); - + c->loops_per_jiffy = loops_per_jiffy; c->x86_cache_size = -1; @@ -961,55 +965,97 @@ __initfunc(void identify_cpu(struct cpuinfo_x86 *c)) if (c->cpuid_level > 1) { /* supports eax=2 call */ - int edx, dummy; - - cpuid(2, &dummy, &dummy, &dummy, &edx); - - /* We need only the LSB */ - edx &= 0xff; + int regs[4]; + int l1c=0, l1d=0, l2=0, l3=0; /* Cache sizes */ - switch (edx) { - case 0x40: - c->x86_cache_size = 0; - break; + cpuid(2, ®s[0], ®s[1], ®s[2], ®s[3]); + /* Least significant byte of eax says how many times + * to call cpuid with value 2 to get cache and TLB + * info. + */ + if ((regs[0] & 0xFF) != 1 ) + printk(KERN_WARNING "Multiple cache reports are not supported yet\n"); - case 0x41: /* 4-way 128 */ - c->x86_cache_size = 128; - break; + c->x86_cache_size = 0; - case 0x42: /* 4-way 256 */ - case 0x82: /* 8-way 256 */ - c->x86_cache_size = 256; - break; - - case 0x43: /* 4-way 512 */ - c->x86_cache_size = 512; - break; + for ( i = 0 ; i < 4 ; i++ ) + { + int j; - case 0x44: /* 4-way 1024 */ - case 0x84: /* 8-way 1024 */ - c->x86_cache_size = 1024; - break; + if ( regs[i] < 0 ) + continue; /* no useful data */ - case 0x45: /* 4-way 2048 */ - case 0x85: /* 8-way 2048 */ - c->x86_cache_size = 2048; - break; + /* look at all the bytes returned */ - default: - c->x86_cache_size = 0; - break; + for ( j = ( i == 0 ? 8:0 ) ; j < 25 ; j+=8 ) + { + unsigned char rh = regs[i]>>j; + unsigned char rl; + + rl = rh & 0x0F; + rh >>=4; + + switch(rh) + { + case 2: + if(rl) + { + printk("%dK L3 cache\n", (rl-1)*512); + l3 += (rl-1)*512; + } + break; + case 4: + case 8: + if(rl) + { + printk("%dK L2 cache (%d way)\n",128<<(rl-1), rh); + l2 += 128<<(rl-1); + } + break; + + /* + * L1 caches do not count for SMP switching weights, + * they are shadowed by L2. + */ + + case 6: + if(rh==6 && rl > 5) + { + printk("%dK L1 data cache\n", 8<<(rl - 6)); + l1d+=8<<(rl-6); + } + break; + case 7: + printk("%dK L1 instruction cache\n", + rl?(16<<(rl-1)):12); + l1c+=rl?(16<<(rl-1)):12; + break; + } + } } + if(l1c && l1d) + printk("CPU: L1 I Cache: %dK L1 D Cache: %dK\n", + l1c, l1d); + if(l2) + printk("CPU: L2 Cache: %dK\n", l2); + if(l3) + printk("CPU: L3 Cache: %dK\n", l3); + + /* + * Assuming L3 is shared. The L1 cache is shadowed by L2 + * so doesn't need to be included. + */ + + c->x86_cache_size += l2; } /* * Intel finally adopted the AMD/Cyrix extended id naming - * stuff + * stuff for the 'Pentium IV' */ if(c->x86_vendor ==X86_VENDOR_INTEL && c->x86 == 15) { - c->x86 = 6; intel_model(c); return; } @@ -1158,12 +1204,12 @@ int get_cpuinfo(char * buffer) #endif p += sprintf(p,"processor\t: %d\n" "vendor_id\t: %s\n" - "cpu family\t: %c\n" + "cpu family\t: %d\n" "model\t\t: %d\n" "model name\t: %s\n", n, c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown", - c->x86 + '0', + c->x86, c->x86_model, c->x86_model_id[0] ? c->x86_model_id : "unknown"); diff --git a/arch/sparc/config.in b/arch/sparc/config.in index f58277be09e1..71ba40454c35 100644 --- a/arch/sparc/config.in +++ b/arch/sparc/config.in @@ -1,4 +1,4 @@ -# $Id: config.in,v 1.68.2.1 1999/09/22 11:37:34 jj Exp $ +# $Id: config.in,v 1.68.2.7 2000/10/24 21:00:53 davem Exp $ # For a description of the syntax of this configuration file, # see Documentation/kbuild/config-language.txt. # @@ -24,6 +24,9 @@ comment 'General setup' define_bool CONFIG_VT y define_bool CONFIG_VT_CONSOLE y +# Identify this as a Sparc32 build +define_bool CONFIG_SPARC32 y + bool 'Support for AP1000 multicomputer' CONFIG_AP1000 bool 'Symmetric multi-processing support (does not work on sun4/sun4c)' CONFIG_SMP diff --git a/arch/sparc64/config.in b/arch/sparc64/config.in index a6d8b70464d7..30794bd95fcc 100644 --- a/arch/sparc64/config.in +++ b/arch/sparc64/config.in @@ -1,4 +1,4 @@ -# $Id: config.in,v 1.67.2.11 2000/07/27 01:50:59 davem Exp $ +# $Id: config.in,v 1.67.2.13 2000/10/24 21:00:53 davem Exp $ # For a description of the syntax of this configuration file, # see Documentation/kbuild/config-language.txt. # @@ -26,12 +26,8 @@ define_bool CONFIG_VT_CONSOLE y bool 'Symmetric multi-processing support' CONFIG_SMP -mainmenu_option next_comment -comment 'Console drivers' -bool 'PROM console' CONFIG_PROM_CONSOLE -bool 'Support Frame buffer devices' CONFIG_FB -source drivers/video/Config.in -endmenu +# Identify this as a Sparc64 build +define_bool CONFIG_SPARC64 y # Global things across all Sun machines. define_bool CONFIG_SBUS y @@ -45,6 +41,14 @@ define_bool CONFIG_SUN_CONSOLE y define_bool CONFIG_SUN_AUXIO y define_bool CONFIG_SUN_IO y bool 'PCI support' CONFIG_PCI + +mainmenu_option next_comment +comment 'Console drivers' +bool 'PROM console' CONFIG_PROM_CONSOLE +bool 'Support Frame buffer devices' CONFIG_FB +source drivers/video/Config.in +endmenu + source drivers/sbus/char/Config.in source drivers/sbus/audio/Config.in diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index 2763aa73fbbe..b6e91bcfdeba 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig @@ -20,6 +20,18 @@ CONFIG_KMOD=y CONFIG_VT=y CONFIG_VT_CONSOLE=y # CONFIG_SMP is not set +CONFIG_SPARC64=y +CONFIG_SBUS=y +CONFIG_SBUSCHAR=y +CONFIG_SUN_MOUSE=y +CONFIG_SERIAL=y +CONFIG_SUN_SERIAL=y +CONFIG_SERIAL_CONSOLE=y +CONFIG_SUN_KEYBOARD=y +CONFIG_SUN_CONSOLE=y +CONFIG_SUN_AUXIO=y +CONFIG_SUN_IO=y +CONFIG_PCI=y # # Console drivers @@ -48,17 +60,6 @@ CONFIG_FBCON_CFB32=y CONFIG_FBCON_FONTWIDTH8_ONLY=y CONFIG_FONT_SUN8x16=y # CONFIG_FBCON_FONTS is not set -CONFIG_SBUS=y -CONFIG_SBUSCHAR=y -CONFIG_SUN_MOUSE=y -CONFIG_SERIAL=y -CONFIG_SUN_SERIAL=y -CONFIG_SERIAL_CONSOLE=y -CONFIG_SUN_KEYBOARD=y -CONFIG_SUN_CONSOLE=y -CONFIG_SUN_AUXIO=y -CONFIG_SUN_IO=y -CONFIG_PCI=y # # Misc Linux/SPARC drivers @@ -75,9 +76,7 @@ CONFIG_SUN_AURORA=m # Linux/SPARC audio subsystem (EXPERIMENTAL) # CONFIG_SPARCAUDIO=y -# CONFIG_SPARCAUDIO_AMD7930 is not set CONFIG_SPARCAUDIO_CS4231=y -# CONFIG_SPARCAUDIO_DBRI is not set # CONFIG_SPARCAUDIO_DUMMY is not set CONFIG_SUN_OPENPROMFS=m CONFIG_PCI_OLD_PROC=y @@ -164,6 +163,7 @@ CONFIG_ATALK=m # CONFIG_X25 is not set # CONFIG_LAPB is not set # CONFIG_BRIDGE is not set +# CONFIG_NET_DIVERT is not set # CONFIG_LLC is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set @@ -316,11 +316,11 @@ CONFIG_SGI_PARTITION=y # CONFIG_CODA_FS=m CONFIG_NFS_FS=y +CONFIG_NFS_V3=y CONFIG_NFSD=m -# CONFIG_NFSD_SUN is not set +CONFIG_NFSD_V3=y CONFIG_SUNRPC=y CONFIG_LOCKD=y -CONFIG_NFS_V3=y CONFIG_SMB_FS=m # CONFIG_SMB_NLS_DEFAULT is not set CONFIG_NCP_FS=m diff --git a/arch/sparc64/kernel/psycho.c b/arch/sparc64/kernel/psycho.c index 21acaf186579..c64797d180cf 100644 --- a/arch/sparc64/kernel/psycho.c +++ b/arch/sparc64/kernel/psycho.c @@ -1,4 +1,4 @@ -/* $Id: psycho.c,v 1.85.2.10 2000/06/14 07:41:19 davem Exp $ +/* $Id: psycho.c,v 1.85.2.11 2000/10/24 21:00:53 davem Exp $ * psycho.c: Ultra/AX U2P PCI controller support. * * Copyright (C) 1997 David S. Miller (davem@caipfs.rutgers.edu) @@ -30,13 +30,6 @@ #define dprintf printk #endif -unsigned long pci_dvma_offset = 0x00000000UL; -unsigned long pci_dvma_mask = 0xffffffffUL; - -#define PCI_DVMA_HASH_NONE 0xffffffffffffffffUL -unsigned long pci_dvma_v2p_hash[PCI_DVMA_HASHSZ]; -unsigned long pci_dvma_p2v_hash[PCI_DVMA_HASHSZ]; - /* If this is non-NULL it points to Sabre's DMA write-sync register * which is used by drivers of devices behind bridges other than APB * to synchronize DMA write streams with interrupt delivery. @@ -70,6 +63,13 @@ asmlinkage int sys_pciconfig_write(unsigned long bus, #else +unsigned long pci_dvma_offset = 0x00000000UL; +unsigned long pci_dvma_mask = 0xffffffffUL; + +#define PCI_DVMA_HASH_NONE 0xffffffffffffffffUL +unsigned long pci_dvma_v2p_hash[PCI_DVMA_HASHSZ]; +unsigned long pci_dvma_p2v_hash[PCI_DVMA_HASHSZ]; + #include #include #include diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index 1b8b83a2c00d..934ec309b5c7 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c @@ -1,4 +1,4 @@ -/* $Id: sparc64_ksyms.c,v 1.58.2.9 2000/09/05 00:10:54 davem Exp $ +/* $Id: sparc64_ksyms.c,v 1.58.2.11 2000/10/25 21:17:44 davem Exp $ * arch/sparc64/kernel/sparc64_ksyms.c: Sparc64 specific ksyms support. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -47,6 +47,7 @@ #endif #include #include +#include struct poll { int fd; @@ -89,6 +90,7 @@ extern void bcopy (const char *, char *, int); extern int __ashrdi3(int, int); extern void dump_thread(struct pt_regs *, struct user *); +extern int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs); #ifdef __SMP__ extern spinlock_t kernel_flag; @@ -206,6 +208,7 @@ EXPORT_SYMBOL(_sigpause_common); /* Should really be in linux/kernel/ksyms.c */ EXPORT_SYMBOL(dump_thread); +EXPORT_SYMBOL(dump_fpu); /* math-emu wants this */ EXPORT_SYMBOL(die_if_kernel); @@ -244,6 +247,7 @@ EXPORT_SYMBOL(__strlen); #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 91) EXPORT_SYMBOL(strlen); #endif +EXPORT_SYMBOL(__strlen_user); EXPORT_SYMBOL(strnlen); EXPORT_SYMBOL(strcpy); EXPORT_SYMBOL(strncpy); diff --git a/drivers/block/ide-probe.c b/drivers/block/ide-probe.c index 2f3876b30c95..6643df20bb4f 100644 --- a/drivers/block/ide-probe.c +++ b/drivers/block/ide-probe.c @@ -37,6 +37,7 @@ #include #include #include +#include /* CMOS defines */ #include #include diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c index 087b1b8a91a9..2ff09394d89f 100644 --- a/drivers/char/rio/riotty.c +++ b/drivers/char/rio/riotty.c @@ -452,7 +452,7 @@ bombout: */ PortP->State |= RIO_WOPEN; rio_spin_unlock_irqrestore(&PortP->portSem, flags); - if (RIODelay (&PortP, HUNDRED_MS) == RIO_FAIL) + if (RIODelay (PortP, HUNDRED_MS) == RIO_FAIL) #if 0 if ( sleep((caddr_t)&tp->tm.c_canqo, TTIPRI|PCATCH)) #endif diff --git a/drivers/net/bonding.c b/drivers/net/bonding.c index 48917a65fc5e..3ba5e600f6b1 100644 --- a/drivers/net/bonding.c +++ b/drivers/net/bonding.c @@ -176,6 +176,9 @@ static int bond_ioctl(struct device *master, struct ifreq *ifr, int cmd) { struct device *slave = dev_get(ifr->ifr_slave); + if (!capable(CAP_NET_ADMIN)) + return -EPERM; + #ifdef BONDING_DEBUG printk("master=%s, slave=%s\n", master->name, slave->name); #endif diff --git a/drivers/net/xpds/xpds-encap-fr.c b/drivers/net/xpds/xpds-encap-fr.c index 3306134f7c62..7a9779f3b22d 100644 --- a/drivers/net/xpds/xpds-encap-fr.c +++ b/drivers/net/xpds/xpds-encap-fr.c @@ -740,7 +740,7 @@ xpds_dlci_transmit(struct sk_buff *skb, struct net_device *dev) kfree (buffer); if (rc) { - xpds_data[card_num].stats.tx_errors++; + if (rc != -EBUSY) xpds_data[card_num].stats.tx_errors++; } else { xpds_data[card_num].stats.tx_packets++; dev_kfree_skb(skb); diff --git a/drivers/net/xpds/xpds.c b/drivers/net/xpds/xpds.c index 503264463b09..aeb6b8cbcf05 100644 --- a/drivers/net/xpds/xpds.c +++ b/drivers/net/xpds/xpds.c @@ -4,7 +4,7 @@ * License to copy and distribute is GNU General Public License, version 2. */ #ifndef VERSION_STRING -#define VERSION_STRING "$Revision: 1.33 $" +#define VERSION_STRING "release-20001009k" #endif #define LT_IND_AI 0xc diff --git a/drivers/sbus/audio/Config.in b/drivers/sbus/audio/Config.in index 34f8124cd77a..cc7b4a30649f 100644 --- a/drivers/sbus/audio/Config.in +++ b/drivers/sbus/audio/Config.in @@ -7,8 +7,10 @@ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then comment 'Linux/SPARC audio subsystem (EXPERIMENTAL)' tristate 'Audio support (EXPERIMENTAL)' CONFIG_SPARCAUDIO - dep_tristate ' AMD7930 Lowlevel Driver' CONFIG_SPARCAUDIO_AMD7930 $CONFIG_SPARCAUDIO + if [ "$CONFIG_SPARC64" != "y" ]; then + dep_tristate ' AMD7930 Lowlevel Driver' CONFIG_SPARCAUDIO_AMD7930 $CONFIG_SPARCAUDIO + dep_tristate ' DBRI Lowlevel Driver' CONFIG_SPARCAUDIO_DBRI $CONFIG_SPARCAUDIO + fi dep_tristate ' CS4231 Lowlevel Driver' CONFIG_SPARCAUDIO_CS4231 $CONFIG_SPARCAUDIO - dep_tristate ' DBRI Lowlevel Driver' CONFIG_SPARCAUDIO_DBRI $CONFIG_SPARCAUDIO dep_tristate ' Dummy Lowlevel Driver' CONFIG_SPARCAUDIO_DUMMY $CONFIG_SPARCAUDIO fi diff --git a/drivers/scsi/esp.c b/drivers/scsi/esp.c index fadf90d2ae16..27eda75ed6de 100644 --- a/drivers/scsi/esp.c +++ b/drivers/scsi/esp.c @@ -396,7 +396,7 @@ extern inline void esp_cmd(struct Sparc_ESP *esp, struct Sparc_ESP_regs *eregs, * * struct scsi_cmnd: * - * We keep track of the syncronous capabilities of a target + * We keep track of the synchronous capabilities of a target * in the device member, using sync_min_period and * sync_max_offset. These are the values we directly write * into the ESP registers while running a command. If offset @@ -2521,7 +2521,7 @@ static int esp_do_data_finale(struct Sparc_ESP *esp, * on HME broken adapters because we skip the HME fifo * workaround code in esp_handle() if we are doing data * phase things. We don't want to fuck directly with - * the fifo like that, especially if doing syncronous + * the fifo like that, especially if doing synchronous * transfers! Also, will need to double the count on * HME if we are doing wide transfers, as the HME fifo * will move and count 16-bit quantities during wide data. diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index 8eb8d489e328..62dad99ad885 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c @@ -299,12 +299,11 @@ static unsigned char ppa_wait(int host_no) unsigned char r; k = PPA_SPIN_TMO; - do { - r = r_str(ppb); - k--; - udelay(1); + /* Wait for bit 6 and 7 - PJC */ + for (r = r_str (ppb); ((r & 0xc0)!=0xc0) && (k); k--) { + udelay (1); + r = r_str (ppb); } - while (!(r & 0x80) && (k)); /* * return some status information. @@ -653,11 +652,7 @@ static int ppa_completion(Scsi_Cmnd * cmd) (v == WRITE_6) || (v == WRITE_10)); - /* - * We only get here if the drive is ready to comunicate, - * hence no need for a full ppa_wait. - */ - r = (r_str(ppb) & 0xf0); + r = ppa_wait(host_no); /* Need a ppa_wait() - PJC */ while (r != (unsigned char) 0xf0) { /* @@ -695,7 +690,7 @@ static int ppa_completion(Scsi_Cmnd * cmd) } } /* Now check to see if the drive is ready to comunicate */ - r = (r_str(ppb) & 0xf0); + r = ppa_wait(host_no); /* need ppa_wait() - PJC */ /* If not, drop back down to the scheduler and wait a timer tick */ if (!(r & 0x80)) return 0; diff --git a/drivers/scsi/ppa.h b/drivers/scsi/ppa.h index 618cf518a3e3..fb2997df6ac9 100644 --- a/drivers/scsi/ppa.h +++ b/drivers/scsi/ppa.h @@ -10,7 +10,7 @@ #ifndef _PPA_H #define _PPA_H -#define PPA_VERSION "2.03 (for Linux 2.2.x)" +#define PPA_VERSION "2.05 (for Linux 2.2.x)" /* * this driver has been hacked by Matteo Frigo (athena@theory.lcs.mit.edu) @@ -51,6 +51,13 @@ * CONFIG_SCSI_PPA_HAVE_PEDANTIC => CONFIG_SCSI_IZIP_EPP16 * added CONFIG_SCSI_IZIP_SLOW_CTR option * [2.03] + * + * Use ppa_wait() to check for ready AND connected status bits + * Add ppa_wait() calls to ppa_completion() + * by Peter Cherriman and + * Tim Waugh + * [2.04] + * Fix kernel panic on scsi timeout, 2000-08-18 [2.05] */ /* ------ END OF USER CONFIGURABLE PARAMETERS ----- */ @@ -166,6 +173,7 @@ int ppa_biosparam(Disk *, kdev_t, int *); eh_device_reset_handler: NULL, \ eh_bus_reset_handler: ppa_reset, \ eh_host_reset_handler: ppa_reset, \ + use_new_eh_code: 1, \ bios_param: ppa_biosparam, \ this_id: -1, \ sg_tablesize: SG_ALL, \ diff --git a/drivers/scsi/scsi_obsolete.c b/drivers/scsi/scsi_obsolete.c index 2ca49f71cc4a..f15bb2dd76c0 100644 --- a/drivers/scsi/scsi_obsolete.c +++ b/drivers/scsi/scsi_obsolete.c @@ -366,7 +366,7 @@ void scsi_old_done (Scsi_Cmnd * SCpnt) * crashing, all scsi_done() calls during sync resets are ignored. */ printk("scsi%d: device driver called scsi_done() " - "for a syncronous reset.\n", SCpnt->host->host_no); + "for a synchronous reset.\n", SCpnt->host->host_no); return; } if(SCpnt->flags & WAS_SENSE) diff --git a/drivers/sound/ac97.c b/drivers/sound/ac97.c index b54e62f76954..0bfb34889a80 100644 --- a/drivers/sound/ac97.c +++ b/drivers/sound/ac97.c @@ -404,19 +404,19 @@ ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd, caddr_t arg) /* Read or write request. */ ret = -EINVAL; if (_IOC_TYPE (cmd) == 'M') { - int dir = _IOC_DIR (cmd); + int dir = _SIOC_DIR (cmd); int channel = _IOC_NR (cmd); if (channel >= 0 && channel < SOUND_MIXER_NRDEVICES) { ret = 0; - if (dir & _IOC_WRITE) { + if (dir & _SIOC_WRITE) { int val; if (get_user (val, (int *) arg) == 0) ret = ac97_set_mixer (dev, channel, val); else ret = -EFAULT; } - if (ret >= 0 && (dir & _IOC_READ)) { + if (ret >= 0 && (dir & _SIOC_READ)) { if (dev->last_written_OSS_values[channel] == AC97_REGVAL_UNKNOWN) dev->last_written_OSS_values[channel] diff --git a/drivers/sound/ac97_codec.c b/drivers/sound/ac97_codec.c index a9b36e2321f8..0a41f59705f3 100644 --- a/drivers/sound/ac97_codec.c +++ b/drivers/sound/ac97_codec.c @@ -402,13 +402,13 @@ static int ac97_mixer_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned return 0; } - if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int)) + if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; if (cmd == OSS_GETVERSION) return put_user(SOUND_VERSION, (int *)arg); - if (_IOC_DIR(cmd) == _IOC_READ) { + if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* give them the current record source */ if (!codec->recmask_io) { @@ -448,7 +448,7 @@ static int ac97_mixer_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned return put_user(val, (int *)arg); } - if (_IOC_DIR(cmd) == (_IOC_WRITE|_IOC_READ)) { + if (_SIOC_DIR(cmd) == (_SIOC_WRITE|_SIOC_READ)) { codec->modcnt++; if (get_user(val, (int *)arg)) return -EFAULT; diff --git a/drivers/sound/ad1816.c b/drivers/sound/ad1816.c index c944815247a0..e787f2176a1b 100644 --- a/drivers/sound/ad1816.c +++ b/drivers/sound/ad1816.c @@ -1010,7 +1010,7 @@ ad1816_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) if (((cmd >> 8) & 0xff) == 'M') { /* set ioctl */ - if (_IOC_DIR (cmd) & _IOC_WRITE) { + if (_SIOC_DIR (cmd) & _SIOC_WRITE) { switch (cmd & 0xff){ case SOUND_MIXER_RECSRC: diff --git a/drivers/sound/cmpci.c b/drivers/sound/cmpci.c index 5f8822e88a62..b7495655e977 100644 --- a/drivers/sound/cmpci.c +++ b/drivers/sound/cmpci.c @@ -1044,9 +1044,9 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) } if (cmd == OSS_GETVERSION) return put_user(SOUND_VERSION, (int *)arg); - if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int)) + if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; - if (_IOC_DIR(cmd) == _IOC_READ) { + if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ return put_user(mixer_recmask(s), (int *)arg); @@ -1094,7 +1094,7 @@ static int mixer_ioctl(struct cm_state *s, unsigned int cmd, unsigned long arg) #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */ } } - if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) + if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) return -EINVAL; s->mix.modcnt++; switch (_IOC_NR(cmd)) { diff --git a/drivers/sound/cs4281.c b/drivers/sound/cs4281.c index e275bb590740..190abff629f3 100644 --- a/drivers/sound/cs4281.c +++ b/drivers/sound/cs4281.c @@ -1064,12 +1064,12 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, unsigned long a if (cmd == OSS_GETVERSION) return put_user(SOUND_VERSION, (int *)arg); - if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int)) + if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; // If ioctl has only the IOC_READ bit(bit 31) // on, process the only-read commands. - if (_IOC_DIR(cmd) == _IOC_READ) { + if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: // Arg contains a bit for each recording source cs4281_read_ac97(s, BA0_AC97_RECORD_SELECT, &temp1); @@ -1103,7 +1103,7 @@ static int mixer_ioctl(struct cs4281_state *s, unsigned int cmd, unsigned long a // If ioctl doesn't have both the IOC_READ and // the IOC_WRITE bit set, return invalid. - if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) + if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) return -EINVAL; // Increment the count of volume writes. diff --git a/drivers/sound/es1370.c b/drivers/sound/es1370.c index 01e5c924f191..43bea56d3ee3 100644 --- a/drivers/sound/es1370.c +++ b/drivers/sound/es1370.c @@ -912,9 +912,9 @@ static int mixer_ioctl(struct es1370_state *s, unsigned int cmd, unsigned long a } if (cmd == OSS_GETVERSION) return put_user(SOUND_VERSION, (int *)arg); - if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int)) + if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; - if (_IOC_DIR(cmd) == _IOC_READ) { + if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ return put_user(s->mix.recsrc, (int *)arg); @@ -951,7 +951,7 @@ static int mixer_ioctl(struct es1370_state *s, unsigned int cmd, unsigned long a return put_user(s->mix.vol[mixtable[i].volidx], (int *)arg); } } - if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) + if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) return -EINVAL; s->mix.modcnt++; switch (_IOC_NR(cmd)) { diff --git a/drivers/sound/es1371.c b/drivers/sound/es1371.c index 75a2f4b7d561..edc376a0df72 100644 --- a/drivers/sound/es1371.c +++ b/drivers/sound/es1371.c @@ -1528,9 +1528,9 @@ static int mixer_ioctl(struct es1371_state *s, unsigned int cmd, unsigned long a } if (cmd == OSS_GETVERSION) return put_user(SOUND_VERSION, (int *)arg); - if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int)) + if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; - if (_IOC_DIR(cmd) == _IOC_READ) { + if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ return put_user(recsrc[rdcodec(s, AC97_RECORD_SELECT) & 7], (int *)arg); @@ -1570,7 +1570,7 @@ static int mixer_ioctl(struct es1371_state *s, unsigned int cmd, unsigned long a #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */ } } - if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) + if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) return -EINVAL; s->mix.modcnt++; switch (_IOC_NR(cmd)) { diff --git a/drivers/sound/esssolo1.c b/drivers/sound/esssolo1.c index 01ed8fb53394..1493738cad80 100644 --- a/drivers/sound/esssolo1.c +++ b/drivers/sound/esssolo1.c @@ -730,9 +730,9 @@ static int mixer_ioctl(struct solo1_state *s, unsigned int cmd, unsigned long ar } if (cmd == OSS_GETVERSION) return put_user(SOUND_VERSION, (int *)arg); - if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int)) + if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; - if (_IOC_DIR(cmd) == _IOC_READ) { + if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ return put_user(mixer_src[read_mixer(s, 0x1c) & 7], (int *)arg); @@ -761,7 +761,7 @@ static int mixer_ioctl(struct solo1_state *s, unsigned int cmd, unsigned long ar return put_user(s->mix.vol[vidx-1], (int *)arg); } } - if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) + if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) return -EINVAL; s->mix.modcnt++; switch (_IOC_NR(cmd)) { diff --git a/drivers/sound/maestro.c b/drivers/sound/maestro.c index e35e64319abf..958aa9f2aee5 100644 --- a/drivers/sound/maestro.c +++ b/drivers/sound/maestro.c @@ -1984,10 +1984,10 @@ static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long ar if (cmd == OSS_GETVERSION) return put_user(SOUND_VERSION, (int *)arg); - if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int)) + if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; - if (_IOC_DIR(cmd) == _IOC_READ) { + if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* give them the current record source */ @@ -2035,7 +2035,7 @@ static int mixer_ioctl(struct ess_card *card, unsigned int cmd, unsigned long ar return put_user(val,(int *)arg); } - if (_IOC_DIR(cmd) != (_IOC_WRITE|_IOC_READ)) + if (_SIOC_DIR(cmd) != (_SIOC_WRITE|_SIOC_READ)) return -EINVAL; card->mix.modcnt++; diff --git a/drivers/sound/sonicvibes.c b/drivers/sound/sonicvibes.c index 7ff22383144a..03ad29b94885 100644 --- a/drivers/sound/sonicvibes.c +++ b/drivers/sound/sonicvibes.c @@ -1071,9 +1071,9 @@ static int mixer_ioctl(struct sv_state *s, unsigned int cmd, unsigned long arg) return put_user(0, (int *)arg); return put_user(((4 - (l & 7)) << 2) | ((4 - (r & 7)) << 5) | 2, (int *)arg); } - if (_IOC_TYPE(cmd) != 'M' || _IOC_SIZE(cmd) != sizeof(int)) + if (_IOC_TYPE(cmd) != 'M' || _SIOC_SIZE(cmd) != sizeof(int)) return -EINVAL; - if (_IOC_DIR(cmd) == _IOC_READ) { + if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: /* Arg contains a bit for each recording source */ return put_user(mixer_recmask(s), (int *)arg); @@ -1112,7 +1112,7 @@ static int mixer_ioctl(struct sv_state *s, unsigned int cmd, unsigned long arg) #endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */ } } - if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) + if (_SIOC_DIR(cmd) != (_SIOC_READ|_SIOC_WRITE)) return -EINVAL; s->mix.modcnt++; switch (_IOC_NR(cmd)) { diff --git a/drivers/video/atyfb.c b/drivers/video/atyfb.c index 60ed9e12d5c8..26910e67e24a 100644 --- a/drivers/video/atyfb.c +++ b/drivers/video/atyfb.c @@ -1,4 +1,4 @@ -/* $Id: atyfb.c,v 1.106.2.9 2000/06/23 12:06:38 davem Exp $ +/* $Id: atyfb.c,v 1.106.2.12 2000/09/05 00:10:55 davem Exp $ * linux/drivers/video/atyfb.c -- Frame buffer device for ATI Mach64 * * Copyright (C) 1997-1998 Geert Uytterhoeven diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 1b6fc7ebdd4e..71757d943c5a 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -125,7 +125,7 @@ ntfs_init_upcase(ntfs_inode *upcase) io.param=(char*)upcase->vol->upcase; io.size=2*UPCASE_LENGTH; ntfs_read_attr(upcase,upcase->vol->at_data,0,0,&io); - upcase->vol->upcase_length = io.size; + upcase->vol->upcase_length = io.size / 2; } static int diff --git a/fs/smbfs/ChangeLog b/fs/smbfs/ChangeLog index 3a48f4f9eaad..da221ab2e977 100644 --- a/fs/smbfs/ChangeLog +++ b/fs/smbfs/ChangeLog @@ -1,5 +1,11 @@ ChangeLog for smbfs. +2000-11-04 Urban Widmark + + * proc.c, sock.c: adjust max parameters & max data to follow max_xmit + lots of servers were having find_next trouble with this. + * proc.c: use documented write method of truncating (NetApp fix) + 2000-09-01 Urban Widmark * proc.c: add back lanman2 support (OS/2 and others) diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c index e47be5a85d2e..c3e8f19d1b1c 100644 --- a/fs/smbfs/proc.c +++ b/fs/smbfs/proc.c @@ -385,22 +385,16 @@ fail: } /* - * Returns the maximum read or write size for the current packet size - * and max_xmit value. + * Returns the maximum read or write size for the "payload". Making all of the + * packet fit within the negotiated max_xmit size. + * * N.B. Since this value is usually computed before locking the server, * the server's packet size must never be decreased! */ -static int +static inline int smb_get_xmitsize(struct smb_sb_info *server, int overhead) { - int size = server->packet_size; - - /* - * Start with the smaller of packet size and max_xmit ... - */ - if (size > server->opt.max_xmit) - size = server->opt.max_xmit; - return size - overhead; + return server->opt.max_xmit - overhead; } /* @@ -751,6 +745,23 @@ smb_newconn(struct smb_sb_info *server, struct smb_conn_opt *opt) server->opt.protocol, server->opt.max_xmit, server->conn_pid, server->opt.capabilities); + /* Make sure we can fit a message of the negotiated size in our + packet buffer. */ + if (server->opt.max_xmit > server->packet_size) { + int len = smb_round_length(server->opt.max_xmit); + char *buf = smb_vmalloc(len); + if (buf) { + server->packet = buf; + server->packet_size = len; + } else { + /* else continue with the too small buffer? */ + PARANOIA("Failed to allocate new packet buffer: " + "max_xmit=%d, packet_size=%d\n", + server->opt.max_xmit, server->packet_size); + server->opt.max_xmit = server->packet_size; + } + } + out: #ifdef SMB_RETRY_INTR wake_up_interruptible(&server->wait); @@ -1348,17 +1359,16 @@ smb_proc_trunc(struct smb_sb_info *server, __u16 fid, __u32 length) smb_lock_server(server); retry: - p = smb_setup_header(server, SMBwrite, 5, 0); + p = smb_setup_header(server, SMBwrite, 5, 3); WSET(server->packet, smb_vwv0, fid); WSET(server->packet, smb_vwv1, 0); DSET(server->packet, smb_vwv2, length); WSET(server->packet, smb_vwv4, 0); - *p++ = 4; - *p++ = 0; - smb_setup_bcc(server, p); - if ((result = smb_request_ok(server, SMBwrite, 1, 0)) < 0) - { + *p++ = 1; + WSET(p, 0, 0); + + if ((result = smb_request_ok(server, SMBwrite, 1, 0)) < 0) { if (smb_retry(server)) goto retry; goto out; @@ -1487,8 +1497,8 @@ static int smb_proc_readdir_long(struct smb_sb_info *server, struct dentry *dir, int fpos, void *cachep) { - unsigned char *p; - char *mask, *lastname, *param = server->temp_buf; + unsigned char *p, *lastname; + char *mask, *param = server->temp_buf; __u16 command; int first, entries, entries_seen; @@ -1521,7 +1531,7 @@ retry: * Encode the initial path */ mask = param + 12; - mask_len = smb_encode_path(server, mask, dir, &star); + mask_len = smb_encode_path(server, mask, dir, &star) - 1; if (mask_len < 0) { entries = mask_len; goto unlock_return; @@ -1613,31 +1623,41 @@ retry: if (ff_searchcount == 0) break; - /* we might need the lastname for continuations */ + /* + * We might need the lastname for continuations. + * + * Note that some servers (win95) point to the filename and + * others (NT4, Samba using NT1) to the dir entry. We assume + * here that those who do not point to a filename do not need + * this info to continue the listing. + */ mask_len = 0; - if (ff_lastname > 0) { + if (ff_lastname > 0 && ff_lastname < resp_data_len) { lastname = resp_data + ff_lastname; switch (info_level) { case 260: - if (ff_lastname < resp_data_len) - mask_len = resp_data_len - ff_lastname; + mask_len = resp_data_len - ff_lastname; break; case 1: - /* Win NT 4.0 doesn't set the length byte */ - lastname++; - if (ff_lastname + 2 < resp_data_len) - mask_len = strlen(lastname); + /* lastname points to a length byte */ + mask_len = *lastname++; + if (ff_lastname + 1 + mask_len > resp_data_len) + mask_len = resp_data_len - ff_lastname - 1; break; } /* * Update the mask string for the next message. */ + if (mask_len < 0) + mask_len = 0; if (mask_len > 255) mask_len = 255; if (mask_len) strncpy(mask, lastname, mask_len); } mask[mask_len] = 0; + mask_len = strlen(mask); /* find the actual string len */ + /* Now we are ready to parse smb directory entries. */ diff --git a/fs/smbfs/sock.c b/fs/smbfs/sock.c index 4a4f8077559f..566990a2cf09 100644 --- a/fs/smbfs/sock.c +++ b/fs/smbfs/sock.c @@ -473,14 +473,12 @@ smb_receive_trans2(struct smb_sb_info *server, unsigned int total_p = 0, total_d = 0, buf_len = 0; int result; - while (1) - { + while (1) { result = smb_receive(server); if (result < 0) goto out; inbuf = server->packet; - if (server->rcls != 0) - { + if (server->rcls != 0) { *parm = *data = inbuf; *ldata = *lparm = 0; goto out; @@ -504,13 +502,11 @@ smb_receive_trans2(struct smb_sb_info *server, parm_len += parm_count; data_len += data_count; - if (!rcv_buf) - { + if (!rcv_buf) { /* * Check for fast track processing ... just this packet. */ - if (parm_count == parm_tot && data_count == data_tot) - { + if (parm_count == parm_tot && data_count == data_tot) { VERBOSE("fast track, parm=%u %u %u, data=%u %u %u\n", parm_disp, parm_offset, parm_count, data_disp, data_offset, data_count); @@ -520,12 +516,10 @@ smb_receive_trans2(struct smb_sb_info *server, goto success; } - if (parm_tot > TRANS2_MAX_TRANSFER || - data_tot > TRANS2_MAX_TRANSFER) - goto out_too_long; - /* - * Save the total parameter and data length. + * Allocate a new buffer for receiving multiple packets + * into. If we stick to the negotiated max_xmit this + * shouldn't have to happen. */ total_d = data_tot; total_p = parm_tot; @@ -534,14 +528,15 @@ smb_receive_trans2(struct smb_sb_info *server, if (server->packet_size > buf_len) buf_len = server->packet_size; buf_len = smb_round_length(buf_len); + if (buf_len > SMB_MAX_PACKET_SIZE) + goto out_no_mem; rcv_buf = smb_vmalloc(buf_len); if (!rcv_buf) goto out_no_mem; *parm = rcv_buf; *data = rcv_buf + total_p; - } - else if (data_tot > total_d || parm_tot > total_p) + } else if (data_tot > total_d || parm_tot > total_p) goto out_data_grew; if (parm_disp + parm_count > total_p) @@ -568,8 +563,7 @@ smb_receive_trans2(struct smb_sb_info *server, * old one, in which case we just copy the data. */ inbuf = server->packet; - if (buf_len >= server->packet_size) - { + if (buf_len >= server->packet_size) { server->packet_size = buf_len; server->packet = rcv_buf; rcv_buf = inbuf; @@ -713,6 +707,7 @@ smb_send_trans2(struct smb_sb_info *server, __u16 trans2_command, struct socket *sock = server_sock(server); struct scm_cookie scm; int err; + int mparam, mdata; /* I know the following is very ugly, but I want to build the smb packet as efficiently as possible. */ @@ -733,19 +728,30 @@ smb_send_trans2(struct smb_sb_info *server, __u16 trans2_command, struct iovec iov[4]; struct msghdr msg; - /* N.B. This test isn't valid! packet_size may be < max_xmit */ + /* FIXME! this test needs to include SMB overhead too, I think ... */ if ((bcc + oparam) > server->opt.max_xmit) - { return -ENOMEM; - } p = smb_setup_header(server, SMBtrans2, smb_parameters, bcc); + /* + * max parameters + max data + max setup == max_xmit to make NT4 happy + * and not abort the transfer or split into multiple packets. + * + * -100 is to make room for headers, which OS/2 seems to include in the + * size calculation NT4 does not? + */ + mparam = SMB_TRANS2_MAX_PARAM; + mdata = server->opt.max_xmit - mparam - 100; + if (mdata < 1024) { + mdata = 1024; + mparam = 20; + } + WSET(server->packet, smb_tpscnt, lparam); WSET(server->packet, smb_tdscnt, ldata); - /* N.B. these values should reflect out current packet size */ - WSET(server->packet, smb_mprcnt, TRANS2_MAX_TRANSFER); - WSET(server->packet, smb_mdrcnt, TRANS2_MAX_TRANSFER); - WSET(server->packet, smb_msrcnt, 0); + WSET(server->packet, smb_mprcnt, mparam); + WSET(server->packet, smb_mdrcnt, mdata); + WSET(server->packet, smb_msrcnt, 0); /* max setup always 0 ? */ WSET(server->packet, smb_flags, 0); DSET(server->packet, smb_timeout, 0); WSET(server->packet, smb_pscnt, lparam); @@ -777,8 +783,7 @@ smb_send_trans2(struct smb_sb_info *server, __u16 trans2_command, iov[3].iov_len = ldata; err = scm_send(sock, &msg, &scm); - if (err >= 0) - { + if (err >= 0) { err = sock->ops->sendmsg(sock, &msg, packet_length, &scm); scm_destroy(&scm); } diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h index cc1cc3313f8f..8ed3a93423c8 100644 --- a/include/asm-i386/bugs.h +++ b/include/asm-i386/bugs.h @@ -419,5 +419,13 @@ __initfunc(static void check_bugs(void)) check_amd_k6(); check_pentium_f00f(); check_cyrix_coma(); - system_utsname.machine[1] = '0' + boot_cpu_data.x86; + /* + * Catch people using stupid model number data + * (Pentium IV) and report 686 still. The /proc data + * however does not lie and reports 15 as will cpuid. + */ + if(boot_cpu_data.x86 > 9) + system_utsname.machine[1] = '6'; + else + system_utsname.machine[1] = '0' + boot_cpu_data.x86; } diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h index e09ee5b2839d..745f2715a456 100644 --- a/include/asm-i386/spinlock.h +++ b/include/asm-i386/spinlock.h @@ -142,6 +142,11 @@ typedef struct { typedef struct { unsigned long a[100]; } __dummy_lock_t; #define __dummy_lock(lock) (*(__dummy_lock_t *)(lock)) +/* + * Intel PIV would benefit from using 'rep nop' here but on older + * processors and non intel it is listed as 'undefined' so cannot be + * blindly used. On 2.4 we should add a PIV CPU type for this one. + */ #define spin_lock_string \ "\n1:\t" \ "lock ; btsl $0,%0\n\t" \ diff --git a/include/asm-sparc/asm_offsets.h b/include/asm-sparc/asm_offsets.h index 96344af3e04c..c8e5e25c736d 100644 --- a/include/asm-sparc/asm_offsets.h +++ b/include/asm-sparc/asm_offsets.h @@ -142,21 +142,21 @@ #define ASIZ_task_cap_inheritable 0x00000004 #define AOFF_task_cap_permitted 0x00000160 #define ASIZ_task_cap_permitted 0x00000004 -#define AOFF_task_user 0x00000164 +#define AOFF_task_user 0x00000168 #define ASIZ_task_user 0x00000004 -#define AOFF_task_rlim 0x00000168 +#define AOFF_task_rlim 0x0000016c #define ASIZ_task_rlim 0x00000050 -#define AOFF_task_used_math 0x000001b8 +#define AOFF_task_used_math 0x000001bc #define ASIZ_task_used_math 0x00000002 -#define AOFF_task_comm 0x000001ba +#define AOFF_task_comm 0x000001be #define ASIZ_task_comm 0x00000010 -#define AOFF_task_link_count 0x000001cc +#define AOFF_task_link_count 0x000001d0 #define ASIZ_task_link_count 0x00000004 -#define AOFF_task_tty 0x000001d0 +#define AOFF_task_tty 0x000001d4 #define ASIZ_task_tty 0x00000004 -#define AOFF_task_semundo 0x000001d4 +#define AOFF_task_semundo 0x000001d8 #define ASIZ_task_semundo 0x00000004 -#define AOFF_task_semsleeping 0x000001d8 +#define AOFF_task_semsleeping 0x000001dc #define ASIZ_task_semsleeping 0x00000004 #define AOFF_task_tss 0x000001e0 #define ASIZ_task_tss 0x00000388 @@ -423,21 +423,21 @@ #define ASIZ_task_cap_inheritable 0x00000004 #define AOFF_task_cap_permitted 0x00000258 #define ASIZ_task_cap_permitted 0x00000004 -#define AOFF_task_user 0x0000025c +#define AOFF_task_user 0x00000260 #define ASIZ_task_user 0x00000004 -#define AOFF_task_rlim 0x00000260 +#define AOFF_task_rlim 0x00000264 #define ASIZ_task_rlim 0x00000050 -#define AOFF_task_used_math 0x000002b0 +#define AOFF_task_used_math 0x000002b4 #define ASIZ_task_used_math 0x00000002 -#define AOFF_task_comm 0x000002b2 +#define AOFF_task_comm 0x000002b6 #define ASIZ_task_comm 0x00000010 -#define AOFF_task_link_count 0x000002c4 +#define AOFF_task_link_count 0x000002c8 #define ASIZ_task_link_count 0x00000004 -#define AOFF_task_tty 0x000002c8 +#define AOFF_task_tty 0x000002cc #define ASIZ_task_tty 0x00000004 -#define AOFF_task_semundo 0x000002cc +#define AOFF_task_semundo 0x000002d0 #define ASIZ_task_semundo 0x00000004 -#define AOFF_task_semsleeping 0x000002d0 +#define AOFF_task_semsleeping 0x000002d4 #define ASIZ_task_semsleeping 0x00000004 #define AOFF_task_tss 0x000002d8 #define ASIZ_task_tss 0x00000388 diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h index 591199fa8c67..05ceb77af509 100644 --- a/include/asm-sparc64/io.h +++ b/include/asm-sparc64/io.h @@ -1,4 +1,4 @@ -/* $Id: io.h,v 1.19.2.2 2000/09/17 05:11:47 davem Exp $ */ +/* $Id: io.h,v 1.19.2.5 2000/10/25 18:14:47 davem Exp $ */ #ifndef __SPARC64_IO_H #define __SPARC64_IO_H @@ -14,6 +14,20 @@ #define SLOW_DOWN_IO do { } while (0) +#ifndef CONFIG_PCI + +/* In builds without PCI these should not be called. + * + * XXX Unfortunately they are, this is how the scsi + * XXX disk driver determines whether kernel buffers + * XXX are physically contiguous :-( + */ +#define virt_to_phys(addr) __pa(addr) +#define phys_to_virt(addr) __va(addr) +#define bus_dvma_to_mem(vaddr) (__builtin_trap(), 0) + +#else + #define PCI_DVMA_HASHSZ 256 extern unsigned long pci_dvma_offset; @@ -46,14 +60,15 @@ extern __inline__ void *phys_to_virt(unsigned long addr) return (void *)(paddr + off); } -#define virt_to_bus virt_to_phys -#define bus_to_virt phys_to_virt - extern __inline__ unsigned long bus_dvma_to_mem(unsigned long vaddr) { return vaddr & pci_dvma_mask; } +#endif /* CONFIG_PCI */ + +#define virt_to_bus virt_to_phys +#define bus_to_virt phys_to_virt extern __inline__ unsigned int inb(unsigned long addr) { diff --git a/include/linux/smb.h b/include/linux/smb.h index 1e4caaae9aa9..ab0733c212b5 100644 --- a/include/linux/smb.h +++ b/include/linux/smb.h @@ -119,11 +119,13 @@ enum smb_conn_state { #define SMB_HEADER_LEN 37 /* includes everything up to, but not * including smb_bcc */ -#define SMB_DEF_MAX_XMIT 32768 -#define SMB_INITIAL_PACKET_SIZE 4000 -/* Allocate max. 1 page */ -#define TRANS2_MAX_TRANSFER (4096-17) +#define SMB_INITIAL_PACKET_SIZE 4000 +#define SMB_MAX_PACKET_SIZE 32768 + +/* reserve this much space for trans2 parameters. Shouldn't have to be more + than 10 or so, but OS/2 seems happier like this. */ +#define SMB_TRANS2_MAX_PARAM 64 #endif #endif diff --git a/kernel/ksyms.c b/kernel/ksyms.c index 0a3bfacb89ec..00453f3d6627 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -284,6 +284,7 @@ EXPORT_SYMBOL(unregister_exec_domain); EXPORT_SYMBOL(register_sysctl_table); EXPORT_SYMBOL(unregister_sysctl_table); EXPORT_SYMBOL(sysctl_string); +EXPORT_SYMBOL(sysctl_jiffies); EXPORT_SYMBOL(sysctl_intvec); EXPORT_SYMBOL(proc_dostring); EXPORT_SYMBOL(proc_dointvec); diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 3c04ab020494..bb66494e6fa3 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -157,8 +157,13 @@ struct vm_struct * get_vm_area(unsigned long size) area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL); if (!area) return NULL; + size += PAGE_SIZE; addr = VMALLOC_START; for (p = &vmlist; (tmp = *p) ; p = &tmp->next) { + if ((size + addr) < addr) { + kfree(area); + return NULL; + } if (size + addr < (unsigned long) tmp->addr) break; addr = tmp->size + (unsigned long) tmp->addr; @@ -168,7 +173,7 @@ struct vm_struct * get_vm_area(unsigned long size) } } area->addr = (void *)addr; - area->size = size + PAGE_SIZE; + area->size = size; area->next = *p; *p = area; return area; diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index e83bbeb58510..c86e4176fe5c 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -2083,22 +2083,6 @@ static int atalk_ioctl(struct socket *sock,unsigned int cmd, unsigned long arg) case SIOCDARP: /* proxy AARP */ return (atif_ioctl(cmd,(void *)arg)); - /* - * Physical layer ioctl calls - */ - case SIOCSIFLINK: - case SIOCGIFHWADDR: - case SIOCSIFHWADDR: - case SIOCGIFFLAGS: - case SIOCSIFFLAGS: - case SIOCGIFMTU: - case SIOCGIFCONF: - case SIOCADDMULTI: - case SIOCDELMULTI: - case SIOCGIFCOUNT: - case SIOCGIFINDEX: - case SIOCGIFNAME: - return ((dev_ioctl(cmd,(void *) arg))); case SIOCSIFMETRIC: case SIOCSIFBRDADDR: @@ -2111,7 +2095,7 @@ static int atalk_ioctl(struct socket *sock,unsigned int cmd, unsigned long arg) return (-EINVAL); default: - return (-EINVAL); + return dev_ioctl(cmd, (void *) arg); } return (put_user(amount, (int *)arg)); diff --git a/net/core/scm.c b/net/core/scm.c index cdb5f3d03deb..b69ec15fc401 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -210,12 +210,16 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) { struct cmsghdr *cm = (struct cmsghdr*)msg->msg_control; - int fdmax = (msg->msg_controllen - sizeof(struct cmsghdr))/sizeof(int); + int fdmax = 0; int fdnum = scm->fp->count; struct file **fp = scm->fp->fp; int *cmfptr; int err = 0, i; + if (msg->msg_controllen > sizeof(struct cmsghdr)) + fdmax = ((msg->msg_controllen - sizeof(struct cmsghdr)) + / sizeof(int)); + if (fdnum < fdmax) fdmax = fdnum; @@ -251,7 +255,7 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) msg->msg_controllen -= cmlen; } } - if (i < fdnum) + if (i < fdnum || (fdnum && fdmax <= 0)) msg->msg_flags |= MSG_CTRUNC; /* diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index e924bfee982c..0b45c8e4abc3 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c @@ -7,7 +7,7 @@ * PROC file system. It is mainly used for debugging and * statistics. * - * Version: $Id: proc.c,v 1.34.2.4 2000/10/18 17:50:41 davem Exp $ + * Version: $Id: proc.c,v 1.34.2.5 2000/10/29 12:06:28 davem Exp $ * * Authors: Fred N. van Kempen, * Gerald J. Heim, diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 04b49d843497..dd376077d21d 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -5,7 +5,7 @@ * Authors: * Pedro Roque * - * $Id: route.c,v 1.35 1999/03/21 05:22:57 davem Exp $ + * $Id: route.c,v 1.35.2.1 2000/11/03 01:14:28 davem Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -1926,19 +1926,19 @@ ctl_table ipv6_route_table[] = { &proc_dointvec}, {NET_IPV6_ROUTE_GC_MIN_INTERVAL, "gc_min_interval", &ip6_rt_gc_min_interval, sizeof(int), 0644, NULL, - &proc_dointvec_jiffies}, + &proc_dointvec_jiffies, &sysctl_jiffies}, {NET_IPV6_ROUTE_GC_TIMEOUT, "gc_timeout", &ip6_rt_gc_timeout, sizeof(int), 0644, NULL, - &proc_dointvec_jiffies}, + &proc_dointvec_jiffies, &sysctl_jiffies}, {NET_IPV6_ROUTE_GC_INTERVAL, "gc_interval", &ip6_rt_gc_interval, sizeof(int), 0644, NULL, - &proc_dointvec_jiffies}, + &proc_dointvec_jiffies, &sysctl_jiffies}, {NET_IPV6_ROUTE_GC_ELASTICITY, "gc_elasticity", &ip6_rt_gc_elasticity, sizeof(int), 0644, NULL, - &proc_dointvec_jiffies}, + &proc_dointvec_jiffies, &sysctl_jiffies}, {NET_IPV6_ROUTE_MTU_EXPIRES, "mtu_expires", &ip6_rt_mtu_expires, sizeof(int), 0644, NULL, - &proc_dointvec_jiffies}, + &proc_dointvec_jiffies, &sysctl_jiffies}, {0} }; -- 2.39.5