From 0583b1c52378f304187f8e6e8ceabb836c993f5d Mon Sep 17 00:00:00 2001 From: Fedor Date: Sat, 19 Dec 2009 00:19:11 -0500 Subject: [PATCH] OpenWRT kernel 2.6 patches --- release/src-rt/linux/linux-2.6/Makefile | 3 + .../linux/linux-2.6/arch/mips/kernel/gdb-stub.c | 2 + .../src-rt/linux/linux-2.6/arch/mips/mm/tlbex.c | 2 +- .../linux-2.6/drivers/mtd/chips/cfi_cmdset_0001.c | 87 +++++++++++----------- .../linux-2.6/drivers/mtd/devices/block2mtd.c | 41 ++++++---- .../linux-2.6/drivers/usb/serial/usb-serial.c | 5 +- release/src-rt/linux/linux-2.6/fs/cifs/connect.c | 7 +- release/src-rt/linux/linux-2.6/fs/jffs2/build.c | 11 +++ release/src-rt/linux/linux-2.6/fs/jffs2/scan.c | 20 ++++- .../linux/linux-2.6/include/asm-mips/system.h | 2 +- .../src-rt/linux/linux-2.6/include/linux/stddef.h | 2 +- .../src-rt/linux/linux-2.6/include/linux/time.h | 6 ++ .../src-rt/linux/linux-2.6/include/linux/types.h | 10 +++ release/src-rt/linux/linux-2.6/kernel/fork.c | 4 +- .../src-rt/linux/linux-2.6/lib/kobject_uevent.c | 19 ++++- release/src-rt/linux/linux-2.6/net/core/sock.c | 2 + .../src-rt/linux/linux-2.6/net/sctp/sm_statefuns.c | 14 ++++ release/src-rt/linux/linux-2.6/net/socket.c | 2 +- release/src-rt/linux/linux-2.6/sound/core/Kconfig | 2 +- 19 files changed, 164 insertions(+), 77 deletions(-) diff --git a/release/src-rt/linux/linux-2.6/Makefile b/release/src-rt/linux/linux-2.6/Makefile index 4361e77310..5ca4bccf52 100644 --- a/release/src-rt/linux/linux-2.6/Makefile +++ b/release/src-rt/linux/linux-2.6/Makefile @@ -535,6 +535,9 @@ CFLAGS += $(call cc-option, -fno-stack-protector) NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS) +# improve gcc optimization +CFLAGS += $(call cc-option,-funit-at-a-time,) + # warn about C99 declaration after statement CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) diff --git a/release/src-rt/linux/linux-2.6/arch/mips/kernel/gdb-stub.c b/release/src-rt/linux/linux-2.6/arch/mips/kernel/gdb-stub.c index 44e6511121..c18f0ee24b 100644 --- a/release/src-rt/linux/linux-2.6/arch/mips/kernel/gdb-stub.c +++ b/release/src-rt/linux/linux-2.6/arch/mips/kernel/gdb-stub.c @@ -656,6 +656,7 @@ void set_async_breakpoint(unsigned long *epc) *epc = (unsigned long)async_breakpoint; } +#ifdef CONFIG_SMP static void kgdb_wait(void *arg) { unsigned flags; @@ -668,6 +669,7 @@ static void kgdb_wait(void *arg) local_irq_restore(flags); } +#endif /* * GDB stub needs to call kgdb_wait on all processor with interrupts diff --git a/release/src-rt/linux/linux-2.6/arch/mips/mm/tlbex.c b/release/src-rt/linux/linux-2.6/arch/mips/mm/tlbex.c index 84d872b500..26ac1a6516 100644 --- a/release/src-rt/linux/linux-2.6/arch/mips/mm/tlbex.c +++ b/release/src-rt/linux/linux-2.6/arch/mips/mm/tlbex.c @@ -887,7 +887,6 @@ static __init void build_tlb_write_entry(u32 **p, struct label **l, case CPU_R10000: case CPU_R12000: case CPU_R14000: - case CPU_4KC: case CPU_SB1: case CPU_SB1A: case CPU_4KSC: @@ -917,6 +916,7 @@ static __init void build_tlb_write_entry(u32 **p, struct label **l, tlbw(p); break; + case CPU_4KC: case CPU_4KEC: case CPU_24K: case CPU_34K: diff --git a/release/src-rt/linux/linux-2.6/drivers/mtd/chips/cfi_cmdset_0001.c b/release/src-rt/linux/linux-2.6/drivers/mtd/chips/cfi_cmdset_0001.c index 2f19fa78d2..ff5cfa46b1 100644 --- a/release/src-rt/linux/linux-2.6/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/release/src-rt/linux/linux-2.6/drivers/mtd/chips/cfi_cmdset_0001.c @@ -933,7 +933,7 @@ static void __xipram xip_enable(struct map_info *map, struct flchip *chip, static int __xipram xip_wait_for_operation( struct map_info *map, struct flchip *chip, - unsigned long adr, unsigned int chip_op_time ) + unsigned long adr, int *chip_op_time ) { struct cfi_private *cfi = map->fldrv_priv; struct cfi_pri_intelext *cfip = cfi->cmdset_priv; @@ -942,7 +942,7 @@ static int __xipram xip_wait_for_operation( flstate_t oldstate, newstate; start = xip_currtime(); - usec = chip_op_time * 8; + usec = *chip_op_time * 8; if (usec == 0) usec = 500000; done = 0; @@ -1052,8 +1052,8 @@ static int __xipram xip_wait_for_operation( #define XIP_INVAL_CACHED_RANGE(map, from, size) \ INVALIDATE_CACHED_RANGE(map, from, size) -#define INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, inval_adr, inval_len, usec) \ - xip_wait_for_operation(map, chip, cmd_adr, usec) +#define INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, inval_adr, inval_len, p_usec) \ + xip_wait_for_operation(map, chip, cmd_adr, p_usec) #else @@ -1065,65 +1065,65 @@ static int __xipram xip_wait_for_operation( static int inval_cache_and_wait_for_operation( struct map_info *map, struct flchip *chip, unsigned long cmd_adr, unsigned long inval_adr, int inval_len, - unsigned int chip_op_time) + int *chip_op_time ) { struct cfi_private *cfi = map->fldrv_priv; map_word status, status_OK = CMD(0x80); - int chip_state = chip->state; - unsigned int timeo, sleep_time; + int z, chip_state = chip->state; + unsigned long timeo; spin_unlock(chip->mutex); if (inval_len) INVALIDATE_CACHED_RANGE(map, inval_adr, inval_len); + if (*chip_op_time) + cfi_udelay(*chip_op_time); spin_lock(chip->mutex); - /* set our timeout to 8 times the expected delay */ - timeo = chip_op_time * 8; - if (!timeo) - timeo = 500000; - sleep_time = chip_op_time / 2; + timeo = *chip_op_time * 8 * HZ / 1000000; + if (timeo < HZ/2) + timeo = HZ/2; + timeo += jiffies; + z = 0; for (;;) { + if (chip->state != chip_state) { + /* Someone's suspended the operation: sleep */ + DECLARE_WAITQUEUE(wait, current); + + set_current_state(TASK_UNINTERRUPTIBLE); + add_wait_queue(&chip->wq, &wait); + spin_unlock(chip->mutex); + schedule(); + remove_wait_queue(&chip->wq, &wait); + timeo = jiffies + (HZ / 2); /* FIXME */ + spin_lock(chip->mutex); + continue; + } + status = map_read(map, cmd_adr); if (map_word_andequal(map, status, status_OK, status_OK)) break; - if (!timeo) { + /* OK Still waiting */ + if (time_after(jiffies, timeo)) { map_write(map, CMD(0x70), cmd_adr); chip->state = FL_STATUS; return -ETIME; } - /* OK Still waiting. Drop the lock, wait a while and retry. */ + /* Latency issues. Drop the lock, wait a while and retry */ + z++; spin_unlock(chip->mutex); - if (sleep_time >= 1000000/HZ) { - /* - * Half of the normal delay still remaining - * can be performed with a sleeping delay instead - * of busy waiting. - */ - msleep(sleep_time/1000); - timeo -= sleep_time; - sleep_time = 1000000/HZ; - } else { - udelay(1); - cond_resched(); - timeo--; - } + cfi_udelay(1); spin_lock(chip->mutex); - - while (chip->state != chip_state) { - /* Someone's suspended the operation: sleep */ - DECLARE_WAITQUEUE(wait, current); - set_current_state(TASK_UNINTERRUPTIBLE); - add_wait_queue(&chip->wq, &wait); - spin_unlock(chip->mutex); - schedule(); - remove_wait_queue(&chip->wq, &wait); - spin_lock(chip->mutex); - } } + if (!z) { + if (!--(*chip_op_time)) + *chip_op_time = 1; + } else if (z > 1) + ++(*chip_op_time); + /* Done and happy. */ chip->state = FL_STATUS; return 0; @@ -1132,7 +1132,8 @@ static int inval_cache_and_wait_for_operation( #endif #define WAIT_TIMEOUT(map, chip, adr, udelay) \ - INVAL_CACHE_AND_WAIT(map, chip, adr, 0, 0, udelay); + ({ int __udelay = (udelay); \ + INVAL_CACHE_AND_WAIT(map, chip, adr, 0, 0, &__udelay); }) static int do_point_onechip (struct map_info *map, struct flchip *chip, loff_t adr, size_t len) @@ -1356,7 +1357,7 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip, ret = INVAL_CACHE_AND_WAIT(map, chip, adr, adr, map_bankwidth(map), - chip->word_write_time); + &chip->word_write_time); if (ret) { xip_enable(map, chip, adr); printk(KERN_ERR "%s: word write error (status timeout)\n", map->name); @@ -1593,7 +1594,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, adr, len, - chip->buffer_write_time); + &chip->buffer_write_time); if (ret) { map_write(map, CMD(0x70), cmd_adr); chip->state = FL_STATUS; @@ -1728,7 +1729,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, ret = INVAL_CACHE_AND_WAIT(map, chip, adr, adr, len, - chip->erase_time); + &chip->erase_time); if (ret) { map_write(map, CMD(0x70), adr); chip->state = FL_STATUS; diff --git a/release/src-rt/linux/linux-2.6/drivers/mtd/devices/block2mtd.c b/release/src-rt/linux/linux-2.6/drivers/mtd/devices/block2mtd.c index be4b9948c7..7ce302c451 100644 --- a/release/src-rt/linux/linux-2.6/drivers/mtd/devices/block2mtd.c +++ b/release/src-rt/linux/linux-2.6/drivers/mtd/devices/block2mtd.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -237,10 +238,11 @@ static void block2mtd_free_device(struct block2mtd_dev *dev) /* FIXME: ensure that mtd->size % erase_size == 0 */ -static struct block2mtd_dev *add_device(char *devname, int erase_size) +static struct block2mtd_dev *add_device(char *devname, int erase_size, char *mtdname) { struct block_device *bdev; struct block2mtd_dev *dev; + struct mtd_partition *part; if (!devname) return NULL; @@ -279,14 +281,18 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size) /* Setup the MTD structure */ /* make the name contain the block device in */ - dev->mtd.name = kmalloc(sizeof("block2mtd: ") + strlen(devname), - GFP_KERNEL); + + if (!mtdname) + mtdname = devname; + + dev->mtd.name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL); + if (!dev->mtd.name) goto devinit_err; + + strcpy(dev->mtd.name, mtdname); - sprintf(dev->mtd.name, "block2mtd: %s", devname); - - dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK; + dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1); dev->mtd.erasesize = erase_size; dev->mtd.writesize = 1; dev->mtd.type = MTD_RAM; @@ -298,15 +304,18 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size) dev->mtd.read = block2mtd_read; dev->mtd.priv = dev; dev->mtd.owner = THIS_MODULE; - - if (add_mtd_device(&dev->mtd)) { + + part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL); + part->name = dev->mtd.name; + part->offset = 0; + part->size = dev->mtd.size; + if (add_mtd_partitions(&dev->mtd, part, 1)) { /* Device didnt get added, so free the entry */ goto devinit_err; } list_add(&dev->list, &blkmtd_device_list); INFO("mtd%d: [%s] erase_size = %dKiB [%d]", dev->mtd.index, - dev->mtd.name + strlen("blkmtd: "), - dev->mtd.erasesize >> 10, dev->mtd.erasesize); + mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize); return dev; devinit_err: @@ -379,9 +388,9 @@ static char block2mtd_paramline[80 + 12]; /* 80 for device, 12 for erase size */ static int block2mtd_setup2(const char *val) { - char buf[80 + 12]; /* 80 for device, 12 for erase size */ + char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */ char *str = buf; - char *token[2]; + char *token[3]; char *name; size_t erase_size = PAGE_SIZE; int i, ret; @@ -392,7 +401,7 @@ static int block2mtd_setup2(const char *val) strcpy(str, val); kill_final_newline(str); - for (i = 0; i < 2; i++) + for (i = 0; i < 3; i++) token[i] = strsep(&str, ","); if (str) @@ -412,8 +421,10 @@ static int block2mtd_setup2(const char *val) parse_err("illegal erase size"); } } + if (token[2] && (strlen(token[2]) + 1 > 80)) + parse_err("mtd device name too long"); - add_device(name, erase_size); + add_device(name, erase_size, token[2]); return 0; } @@ -447,7 +458,7 @@ static int block2mtd_setup(const char *val, struct kernel_param *kp) module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200); -MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,]\""); +MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=[,[,]]\""); static int __init block2mtd_init(void) { diff --git a/release/src-rt/linux/linux-2.6/drivers/usb/serial/usb-serial.c b/release/src-rt/linux/linux-2.6/drivers/usb/serial/usb-serial.c index 87f378806d..c2fe7f6b3d 100644 --- a/release/src-rt/linux/linux-2.6/drivers/usb/serial/usb-serial.c +++ b/release/src-rt/linux/linux-2.6/drivers/usb/serial/usb-serial.c @@ -56,6 +56,7 @@ static struct usb_driver usb_serial_driver = { drivers depend on it. */ +static ushort maxSize = 0; static int debug; static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */ static spinlock_t table_lock; @@ -864,7 +865,7 @@ int usb_serial_probe(struct usb_interface *interface, dev_err(&interface->dev, "No free urbs available\n"); goto probe_error; } - buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); + buffer_size = (endpoint->wMaxPacketSize > maxSize) ? endpoint->wMaxPacketSize : maxSize; port->bulk_in_size = buffer_size; port->bulk_in_endpointAddress = endpoint->bEndpointAddress; port->bulk_in_buffer = kmalloc (buffer_size, GFP_KERNEL); @@ -1245,3 +1246,5 @@ MODULE_LICENSE("GPL"); module_param(debug, bool, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Debug enabled or not"); +module_param(maxSize, ushort,0); +MODULE_PARM_DESC(maxSize,"User specified USB endpoint size"); diff --git a/release/src-rt/linux/linux-2.6/fs/cifs/connect.c b/release/src-rt/linux/linux-2.6/fs/cifs/connect.c index f4e92661b2..784912f934 100644 --- a/release/src-rt/linux/linux-2.6/fs/cifs/connect.c +++ b/release/src-rt/linux/linux-2.6/fs/cifs/connect.c @@ -3275,14 +3275,11 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, BCC(smb_buffer_response)) { kfree(tcon->nativeFileSystem); tcon->nativeFileSystem = - kzalloc(length + 2, GFP_KERNEL); + kzalloc((4 * length) + 2, GFP_KERNEL); cifs_strfromUCS_le(tcon->nativeFileSystem, (__le16 *) bcc_ptr, length, nls_codepage); - bcc_ptr += 2 * length; - bcc_ptr[0] = 0; /* null terminate the string */ - bcc_ptr[1] = 0; - bcc_ptr += 2; + bcc_ptr += (2 * length) + 2; } /* else do not bother copying these informational fields */ } else { diff --git a/release/src-rt/linux/linux-2.6/fs/jffs2/build.c b/release/src-rt/linux/linux-2.6/fs/jffs2/build.c index 0ca2fff261..51464f76ac 100644 --- a/release/src-rt/linux/linux-2.6/fs/jffs2/build.c +++ b/release/src-rt/linux/linux-2.6/fs/jffs2/build.c @@ -105,6 +105,17 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c) dbg_fsbuild("scanned flash completely\n"); jffs2_dbg_dump_block_lists_nolock(c); + if (c->flags & (1 << 7)) { + printk("%s(): unlocking the mtd device... ", __func__); + if (c->mtd->unlock) + c->mtd->unlock(c->mtd, 0, c->mtd->size); + printk("done.\n"); + + printk("%s(): erasing all blocks after the end marker... ", __func__); + jffs2_erase_pending_blocks(c, -1); + printk("done.\n"); + } + dbg_fsbuild("pass 1 starting\n"); c->flags |= JFFS2_SB_FLAG_BUILDING; /* Now scan the directory tree, increasing nlink according to every dirent found. */ diff --git a/release/src-rt/linux/linux-2.6/fs/jffs2/scan.c b/release/src-rt/linux/linux-2.6/fs/jffs2/scan.c index 2a1c976c79..6493ba88c5 100644 --- a/release/src-rt/linux/linux-2.6/fs/jffs2/scan.c +++ b/release/src-rt/linux/linux-2.6/fs/jffs2/scan.c @@ -142,9 +142,12 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) /* reset summary info for next eraseblock scan */ jffs2_sum_reset_collected(s); - - ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), - buf_size, s); + + if (c->flags & (1 << 7)) + ret = BLK_STATE_ALLFF; + else + ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), + buf_size, s); if (ret < 0) goto out; @@ -545,6 +548,17 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo return err; } + if ((buf[0] == 0xde) && + (buf[1] == 0xad) && + (buf[2] == 0xc0) && + (buf[3] == 0xde)) { + /* end of filesystem. erase everything after this point */ + printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset); + c->flags |= (1 << 7); + + return BLK_STATE_ALLFF; + } + /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ ofs = 0; diff --git a/release/src-rt/linux/linux-2.6/include/asm-mips/system.h b/release/src-rt/linux/linux-2.6/include/asm-mips/system.h index bb0b289dbc..e47e4e6fa7 100644 --- a/release/src-rt/linux/linux-2.6/include/asm-mips/system.h +++ b/release/src-rt/linux/linux-2.6/include/asm-mips/system.h @@ -188,7 +188,7 @@ extern __u64 __xchg_u64_unsupported_on_32bit_kernels(volatile __u64 * m, __u64 v if something tries to do an invalid xchg(). */ extern void __xchg_called_with_bad_pointer(void); -static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) +static __always_inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) { switch (size) { case 4: diff --git a/release/src-rt/linux/linux-2.6/include/linux/stddef.h b/release/src-rt/linux/linux-2.6/include/linux/stddef.h index 6a40c76bdc..5dab46c445 100644 --- a/release/src-rt/linux/linux-2.6/include/linux/stddef.h +++ b/release/src-rt/linux/linux-2.6/include/linux/stddef.h @@ -16,6 +16,7 @@ enum { false = 0, true = 1 }; +#endif /* __KERNEL__ */ #undef offsetof #ifdef __compiler_offsetof @@ -23,6 +24,5 @@ enum { #else #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif -#endif /* __KERNEL__ */ #endif diff --git a/release/src-rt/linux/linux-2.6/include/linux/time.h b/release/src-rt/linux/linux-2.6/include/linux/time.h index dda9be685a..7852527091 100644 --- a/release/src-rt/linux/linux-2.6/include/linux/time.h +++ b/release/src-rt/linux/linux-2.6/include/linux/time.h @@ -1,6 +1,10 @@ #ifndef _LINUX_TIME_H #define _LINUX_TIME_H +#ifndef __KERNEL__ +#include +#else + #include #ifdef __KERNEL__ @@ -225,4 +229,6 @@ struct itimerval { */ #define TIMER_ABSTIME 0x01 +#endif /* __KERNEL__ DEBIAN */ + #endif diff --git a/release/src-rt/linux/linux-2.6/include/linux/types.h b/release/src-rt/linux/linux-2.6/include/linux/types.h index 0351bf2fac..eb2f6f3a17 100644 --- a/release/src-rt/linux/linux-2.6/include/linux/types.h +++ b/release/src-rt/linux/linux-2.6/include/linux/types.h @@ -1,6 +1,14 @@ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H +/* Debian: Use userland types instead. */ +#ifndef __KERNEL__ +# include +/* For other kernel headers. */ +# include +# include +#else + #ifdef __KERNEL__ #define BITS_TO_LONGS(bits) \ @@ -162,6 +170,8 @@ typedef unsigned long blkcnt_t; #endif /* __KERNEL_STRICT_NAMES */ +#endif /* __KERNEL__ DEBIAN */ + /* * Below are truly Linux-specific types that should never collide with * any application/library that wants linux/types.h. diff --git a/release/src-rt/linux/linux-2.6/kernel/fork.c b/release/src-rt/linux/linux-2.6/kernel/fork.c index 73ad5cda1b..987df16726 100644 --- a/release/src-rt/linux/linux-2.6/kernel/fork.c +++ b/release/src-rt/linux/linux-2.6/kernel/fork.c @@ -1163,7 +1163,9 @@ static struct task_struct *copy_process(unsigned long clone_flags, p->parent_exec_id = p->self_exec_id; /* ok, now we should be set up.. */ - p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL); + p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : + (clone_flags & CLONE_PARENT) ? current->group_leader->exit_signal : + (clone_flags & CSIGNAL); p->pdeath_signal = 0; p->exit_state = 0; diff --git a/release/src-rt/linux/linux-2.6/lib/kobject_uevent.c b/release/src-rt/linux/linux-2.6/lib/kobject_uevent.c index 12e311dc66..f22d2b956a 100644 --- a/release/src-rt/linux/linux-2.6/lib/kobject_uevent.c +++ b/release/src-rt/linux/linux-2.6/lib/kobject_uevent.c @@ -30,9 +30,22 @@ u64 uevent_seqnum; char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug"; static DEFINE_SPINLOCK(sequence_lock); #if defined(CONFIG_NET) -static struct sock *uevent_sock; +struct sock *uevent_sock = NULL; +EXPORT_SYMBOL_GPL(uevent_sock); #endif +u64 uevent_next_seqnum(void) +{ + u64 seq; + + spin_lock(&sequence_lock); + seq = ++uevent_seqnum; + spin_unlock(&sequence_lock); + + return seq; +} +EXPORT_SYMBOL_GPL(uevent_next_seqnum); + static char *action_to_string(enum kobject_action action) { switch (action) { @@ -169,9 +182,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, } /* we will send an event, request a new sequence number */ - spin_lock(&sequence_lock); - seq = ++uevent_seqnum; - spin_unlock(&sequence_lock); + seq = uevent_next_seqnum(); sprintf(seq_buff, "SEQNUM=%llu", (unsigned long long)seq); #if defined(CONFIG_NET) diff --git a/release/src-rt/linux/linux-2.6/net/core/sock.c b/release/src-rt/linux/linux-2.6/net/core/sock.c index c14ce0198d..e54b6a82d9 100644 --- a/release/src-rt/linux/linux-2.6/net/core/sock.c +++ b/release/src-rt/linux/linux-2.6/net/core/sock.c @@ -674,6 +674,8 @@ int sock_getsockopt(struct socket *sock, int level, int optname, if (len < 0) return -EINVAL; + v.val = 0; + switch(optname) { case SO_DEBUG: v.val = sock_flag(sk, SOCK_DBG); diff --git a/release/src-rt/linux/linux-2.6/net/sctp/sm_statefuns.c b/release/src-rt/linux/linux-2.6/net/sctp/sm_statefuns.c index f02ce3dddb..8bef197a93 100644 --- a/release/src-rt/linux/linux-2.6/net/sctp/sm_statefuns.c +++ b/release/src-rt/linux/linux-2.6/net/sctp/sm_statefuns.c @@ -3413,6 +3413,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(const struct sctp_endpoint *ep, { struct sctp_chunk *chunk = arg; struct sctp_fwdtsn_hdr *fwdtsn_hdr; + struct sctp_fwdtsn_skip *skip; __u16 len; __u32 tsn; @@ -3442,6 +3443,12 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn(const struct sctp_endpoint *ep, if (sctp_tsnmap_check(&asoc->peer.tsn_map, tsn) < 0) goto discard_noforce; + /* Silently discard the chunk if stream-id is not valid */ + sctp_walk_fwdtsn(skip, chunk) { + if (ntohs(skip->stream) >= asoc->c.sinit_max_instreams) + goto discard_noforce; + } + sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn)); if (len > sizeof(struct sctp_fwdtsn_hdr)) sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN, @@ -3473,6 +3480,7 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast( { struct sctp_chunk *chunk = arg; struct sctp_fwdtsn_hdr *fwdtsn_hdr; + struct sctp_fwdtsn_skip *skip; __u16 len; __u32 tsn; @@ -3502,6 +3510,12 @@ sctp_disposition_t sctp_sf_eat_fwd_tsn_fast( if (sctp_tsnmap_check(&asoc->peer.tsn_map, tsn) < 0) goto gen_shutdown; + /* Silently discard the chunk if stream-id is not valid */ + sctp_walk_fwdtsn(skip, chunk) { + if (ntohs(skip->stream) >= asoc->c.sinit_max_instreams) + goto gen_shutdown; + } + sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_FWDTSN, SCTP_U32(tsn)); if (len > sizeof(struct sctp_fwdtsn_hdr)) sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_FWDTSN, diff --git a/release/src-rt/linux/linux-2.6/net/socket.c b/release/src-rt/linux/linux-2.6/net/socket.c index 8211578517..e1f9a0b8aa 100644 --- a/release/src-rt/linux/linux-2.6/net/socket.c +++ b/release/src-rt/linux/linux-2.6/net/socket.c @@ -688,7 +688,7 @@ static ssize_t sock_sendpage(struct file *file, struct page *page, if (more) flags |= MSG_MORE; - return sock->ops->sendpage(sock, page, offset, size, flags); + return kernel_sendpage(sock, page, offset, size, flags); } static struct sock_iocb *alloc_sock_iocb(struct kiocb *iocb, diff --git a/release/src-rt/linux/linux-2.6/sound/core/Kconfig b/release/src-rt/linux/linux-2.6/sound/core/Kconfig index 829ca38b59..fc88529d5f 100644 --- a/release/src-rt/linux/linux-2.6/sound/core/Kconfig +++ b/release/src-rt/linux/linux-2.6/sound/core/Kconfig @@ -9,7 +9,7 @@ config SND_PCM depends on SND config SND_HWDEP - tristate + tristate "Sound hardware support" depends on SND config SND_RAWMIDI -- 2.11.4.GIT