Linux 3.10.51
Greg KH
maintainerI'm announcing the release of the 3.10.51 kernel.
All users of the 3.10 kernel series must upgrade.
The updated 3.10.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-3.10.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 4 ++- arch/parisc/include/uapi/asm/signal.h | 2 - arch/s390/kernel/ptrace.c | 9 ++++++-- arch/x86/boot/header.S | 26 +++++++++++++++++++---- arch/x86/boot/tools/build.c | 37 ++++++++++++++++++++++++++------- arch/x86/kernel/entry_32.S | 9 ++++---- block/blk-cgroup.c | 7 ++++++ block/blk-tag.c | 33 ++++++----------------------- block/compat_ioctl.c | 1 drivers/ata/ahci.c | 1 drivers/ata/libata-core.c | 12 ++++++++-- drivers/hwmon/smsc47m192.c | 4 ++- drivers/input/input.c | 6 +++-- drivers/media/dvb-frontends/tda10071.c | 6 ++++- drivers/media/usb/hdpvr/hdpvr-video.c | 6 ++--- fs/coredump.c | 2 - include/linux/libata.h | 1 kernel/trace/trace.c | 2 - kernel/trace/trace_clock.c | 9 ++++---- mm/hugetlb.c | 1 mm/slab_common.c | 2 + net/netfilter/nfnetlink_queue_core.c | 29 ++++++++++++++++++------- 22 files changed, 140 insertions(+), 69 deletions(-)
Antti Palosaari (1):
media: tda10071: force modulation to QPSK on DVB-S
Christoph Hellwig (1):
block: don't assume last put of shared tags is for the host
Christoph Lameter (1):
slab_common: Do not check for duplicate slab names
Dmitry Torokhov (1):
Input: fix defuzzing logic
Greg Kroah-Hartman (1):
Linux 3.10.51
Guenter Roeck (1):
hwmon: (smsc47m192) Fix temperature limit and vrm write operations
Hans Verkuil (1):
media: hdpvr: fix two audio bugs
John David Anglin (1):
parisc: Remove SA_RESTORER define
Kevin Hao (1):
libata: support the ata host which implements a queue depth less than 32
Linus Torvalds (1):
Fix gcc-4.9.0 miscompilation of load_balance() in scheduler
Martin Schwidefsky (1):
s390/ptrace: fix PSW mask check
Michael Brown (1):
x86/efi: Include a .bss section within the PE/COFF headers
Mikulas Patocka (2):
block: provide compat ioctl for BLKZEROOUT
slab_common: fix the check for duplicate slab names
Naoya Horiguchi (1):
mm: hugetlb: fix copy_hugetlb_page_range()
Romain Degez (1):
ahci: add support for the Promise FastTrak TX8660 SATA HBA (ahci mode)
Silesh C V (1):
coredump: fix the setting of PF_DUMPCORE
Sven Wegener (1):
x86_32, entry: Store badsys error code in %eax
Tejun Heo (2):
libata: introduce ata_host->n_tags to avoid oops on SAS controllers
blkcg: don't call into policy draining if root_blkg is already gone
Tony Luck (1):
tracing: Fix wraparound problems in "uptime" trace clock
Zoltan Kiss (1):
core, nfqueue, openvswitch: Orphan frags in skb_zerocopy and handle errors
Greg KH
maintainerMakefile +3 -1
@@ -1,6 +1,6 @@ VERSION = 3 PATCHLEVEL = 10 -SUBLEVEL = 50 +SUBLEVEL = 51 EXTRAVERSION = NAME = TOSSUG Baby Fish
@@ -614,6 +614,8 @@ KBUILD_CFLAGS += -fomit-frame-pointer endif endif +KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments) + ifdef CONFIG_DEBUG_INFO KBUILD_CFLAGS += -g KBUILD_AFLAGS += -gdwarf-2
arch/parisc/include/uapi/asm/signal.h +0 -2
@@ -69,8 +69,6 @@#define SA_NOMASK SA_NODEFER#define SA_ONESHOT SA_RESETHAND -#define SA_RESTORER 0x04000000/* obsolete -- ignored */ -#define MINSIGSTKSZ 2048#define SIGSTKSZ 8192
arch/s390/kernel/ptrace.c +7 -2
@@ -314,7 +314,9 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data)* psw and gprs are stored on the stack */ if (addr == (addr_t) &dummy->regs.psw.mask && - ((data & ~PSW_MASK_USER ) != psw_user_bits || + (((data^psw_user_bits) & ~PSW_MASK_USER ) || + (((data^psw_user_bits) &PSW_MASK_ASC ) && + ((data|psw_user_bits) &PSW_MASK_ASC ) ==PSW_MASK_ASC ) || ((data &PSW_MASK_EA ) && !(data &PSW_MASK_BA ))))/* Invalid psw mask. */ return -EINVAL ;
@@ -627,7 +629,10 @@ static int __poke_user_compat(struct task_struct *child,*/ if (addr == (addr_t) &dummy32->regs.psw.mask) {/* Build a 64 bit psw mask from 31 bit mask. */ -if ((tmp & ~PSW32_MASK_USER ) != psw32_user_bits) +if (((tmp^psw32_user_bits) & ~PSW32_MASK_USER ) || + (((tmp^psw32_user_bits) &PSW32_MASK_ASC ) && + ((tmp|psw32_user_bits) &PSW32_MASK_ASC ) + ==PSW32_MASK_ASC ))/* Invalid psw mask. */ return -EINVAL ; regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) |
arch/x86/boot/header.S +22 -4
@@ -91,10 +91,9 @@ bs_die: .section ".bsdata", "a" bugger_off_msg: - .ascii "Direct floppy boot is not supported. " - .ascii "Use a boot loader program instead.\r\n" + .ascii "Use a boot loader.\r\n" .ascii "\n" - .ascii "Remove disk and press any key to reboot ...\r\n" + .ascii "Remove disk and press any key to reboot...\r\n" .byte 0 #ifdef CONFIG_EFI_STUB
@@ -108,7 +107,7 @@ coff_header: #else .word 0x8664 # x86-64 #endif - .word 3 # nr_sections + .word 4 # nr_sections .long 0 # TimeDateStamp .long 0 # PointerToSymbolTable .long 1 # NumberOfSymbols
@@ -250,6 +249,25 @@ section_table: .word 0 # NumberOfLineNumbers .long 0x60500020 # Characteristics (section flags) + # + # The offset & size fields are filled in by build.c. + # + .ascii ".bss" + .byte 0 + .byte 0 + .byte 0 + .byte 0 + .long 0 + .long 0x0 + .long 0 # Size of initialized data + # on disk + .long 0x0 + .long 0 # PointerToRelocations + .long 0 # PointerToLineNumbers + .word 0 # NumberOfRelocations + .word 0 # NumberOfLineNumbers + .long 0xc8000080 # Characteristics (section flags) + #endif /* CONFIG_EFI_STUB */ # Kernel attributes; used by setup. This is part 1 of the
arch/x86/boot/tools/build.c +30 -7
@@ -141,7 +141,7 @@ static void usage(void)#ifdef CONFIG_EFI_STUB -static void update_pecoff_section_header (char *section_name,u32 offset,u32 size) +static void update_pecoff_section_header_fields (char *section_name,u32 vma,u32 size,u32 datasz,u32 offset) {unsigned int pe_header;unsigned short num_sections;
@@ -162,10 +162,10 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 sizput_unaligned_le32 (size, section +0x8 );/* section header vma field */ -put_unaligned_le32 (offset, section +0xc ); +put_unaligned_le32 (vma, section +0xc );/* section header 'size of initialised data' field */ -put_unaligned_le32 (size, section +0x10 ); +put_unaligned_le32 (datasz, section +0x10 );/* section header 'file offset' field */ put_unaligned_le32 (offset, section +0x14 );
@@ -177,6 +177,11 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 siz } } +static void update_pecoff_section_header (char *section_name,u32 offset,u32 size) +{ +update_pecoff_section_header_fields (section_name, offset, size, size, offset); +} +static void update_pecoff_setup_and_reloc (unsigned int size) {u32 setup_offset =0x200 ;
@@ -201,9 +206,6 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz) pe_header =get_unaligned_le32 (&buf[0x3c ]); -/* Size of image */ -put_unaligned_le32 (file_sz, &buf[pe_header +0x50 ]); -/* * Size of code: Subtract the size of the first sector (512 bytes) * which includes the header.
@@ -218,6 +220,22 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz) update_pecoff_section_header(".text", text_start, text_sz); } +static void update_pecoff_bss (unsigned int file_sz,unsigned int init_sz) +{ +unsigned int pe_header; +unsigned int bss_sz = init_sz - file_sz; + + pe_header =get_unaligned_le32 (&buf[0x3c ]); + +/* Size of uninitialized data */ +put_unaligned_le32 (bss_sz, &buf[pe_header +0x24 ]); + +/* Size of image */ +put_unaligned_le32 (init_sz, &buf[pe_header +0x50 ]); + +update_pecoff_section_header_fields (".bss" , file_sz, bss_sz,0 ,0 ); +} +#endif /* CONFIG_EFI_STUB */
@@ -268,6 +286,9 @@ int main(int argc, char ** argv)int fd;void *kernel;u32 crc =0xffffffffUL ; +#ifdef CONFIG_EFI_STUB +unsigned int init_sz; +#endif /* Defaults for old kernel */ #ifdef CONFIG_X86_32
@@ -338,7 +359,9 @@ int main(int argc, char ** argv)put_unaligned_le32 (sys_size, &buf[0x1f4 ]);#ifdef CONFIG_EFI_STUB -update_pecoff_text (setup_sectors *512 , sz + i + ((sys_size *16 ) - sz)); +update_pecoff_text (setup_sectors *512 , i + (sys_size *16 )); + init_sz =get_unaligned_le32 (&buf[0x260 ]); +update_pecoff_bss (i + (sys_size *16 ), init_sz);#ifdef CONFIG_X86_64 /* Yes, this is really how we defined it :( */ efi_stub_entry -=0x200 ;
arch/x86/kernel/entry_32.S +5 -4
@@ -436,8 +436,8 @@ sysenter_do_call: cmpl $(NR_syscalls), %eax jae sysenter_badsys call *sys_call_table(,%eax,4) - movl %eax,PT_EAX(%esp) sysenter_after_call: + movl %eax,PT_EAX(%esp) LOCKDEP_SYS_EXIT DISABLE_INTERRUPTS(CLBR_ANY) TRACE_IRQS_OFF
@@ -517,6 +517,7 @@ ENTRY(system_call) jae syscall_badsys syscall_call: call *sys_call_table(,%eax,4) +syscall_after_call: movl %eax,PT_EAX(%esp) # store the return value syscall_exit: LOCKDEP_SYS_EXIT
@@ -686,12 +687,12 @@ syscall_fault: END(syscall_fault) syscall_badsys: - movl $-ENOSYS,PT_EAX(%esp) - jmp syscall_exit + movl $-ENOSYS,%eax + jmp syscall_after_call END(syscall_badsys) sysenter_badsys: - movl $-ENOSYS,PT_EAX(%esp) + movl $-ENOSYS,%eax jmp sysenter_after_call END(syscall_badsys) CFI_ENDPROC
block/blk-cgroup.c +7 -0
@@ -876,6 +876,13 @@ void blkcg_drain_queue(struct request_queue *q) {lockdep_assert_held (q->queue_lock); +/* +* @q could be exiting and already have destroyed all blkgs as +* indicated by NULL root_blkg. If so, don't confuse policies. +*/ +if (!q->root_blkg) +return ; +blk_throtl_drain (q); }
block/blk-tag.c +7 -26
@@ -27,18 +27,15 @@ struct request *blk_queue_find_tag(struct request_queue *q, int tag)EXPORT_SYMBOL (blk_queue_find_tag);/** -* __blk_free_tags - release a given set of tag maintenance info +* blk_free_tags - release a given set of tag maintenance info * @bqt: the tag map to free * -* Tries to free the specified @bqt. Returns true if it was -* actually freed and false if there are still references using it +* Drop the reference count on @bqt and frees it when the last reference +* is dropped. */ -static int __blk_free_tags (struct blk_queue_tag *bqt) +void blk_free_tags (struct blk_queue_tag *bqt) { -int retval; - - retval =atomic_dec_and_test (&bqt->refcnt); -if (retval) { +if (atomic_dec_and_test (&bqt->refcnt)) {BUG_ON (find_first_bit (bqt->tag_map, bqt->max_depth) < bqt->max_depth);
@@ -50,9 +47,8 @@ static int __blk_free_tags(struct blk_queue_tag *bqt)kfree (bqt); } - -return retval; } +EXPORT_SYMBOL (blk_free_tags);/** * __blk_queue_free_tags - release tag maintenance info
@@ -69,28 +65,13 @@ void __blk_queue_free_tags(struct request_queue *q)if (!bqt)return ; -__blk_free_tags (bqt); +blk_free_tags (bqt); q->queue_tags =NULL ;queue_flag_clear_unlocked (QUEUE_FLAG_QUEUED , q); }/** -* blk_free_tags - release a given set of tag maintenance info -* @bqt: the tag map to free -* -* For externally managed @bqt frees the map. Callers of this -* function must guarantee to have released all the queues that -* might have been using this tag map. -*/ -void blk_free_tags (struct blk_queue_tag *bqt) -{ -if (unlikely (!__blk_free_tags (bqt))) -BUG (); -} -EXPORT_SYMBOL (blk_free_tags); - -/** * blk_queue_free_tags - release tag maintenance info * @q: the request queue for the device *
block/compat_ioctl.c +1 -0
@@ -689,6 +689,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)case BLKROSET :case BLKDISCARD :case BLKSECDISCARD : +case BLKZEROOUT :/* * the ones below are implemented in blkdev_locked_ioctl, * but we call blkdev_ioctl, which gets the lock for us
drivers/ata/ahci.c +1 -0
@@ -455,6 +455,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {/* Promise */ { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */ + { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode *//* Asmedia */ { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */
drivers/ata/libata-core.c +10 -2
@@ -4758,6 +4758,10 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)* ata_qc_new - Request an available ATA command, for queueing * @ap: target port * +* Some ATA host controllers may implement a queue depth which is less +* than ATA_MAX_QUEUE. So we shouldn't allocate a tag which is beyond +* the hardware limitation. +* * LOCKING: * None. */
@@ -4765,14 +4769,15 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)static struct ata_queued_cmd *ata_qc_new (struct ata_port *ap) {struct ata_queued_cmd *qc =NULL ; +unsigned int max_queue = ap->host->n_tags;unsigned int i, tag;/* no command while frozen */ if (unlikely (ap->pflags &ATA_PFLAG_FROZEN ))return NULL ; -for (i =0 ; i <ATA_MAX_QUEUE ; i++) { - tag = (i + ap->last_tag +1 ) %ATA_MAX_QUEUE ; +for (i =0 , tag = ap->last_tag +1 ; i < max_queue; i++, tag++) { + tag = tag < max_queue ? tag :0 ;/* the last tag is reserved for internal command. */ if (tag ==ATA_TAG_INTERNAL )
@@ -6073,6 +6078,7 @@ void ata_host_init(struct ata_host *host, struct device *dev, {spin_lock_init (&host->lock);mutex_init (&host->eh_mutex); + host->n_tags =ATA_MAX_QUEUE -1 ; host->dev = dev; host->ops = ops; }
@@ -6154,6 +6160,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) {int i, rc; + host->n_tags =clamp (sht->can_queue,1 ,ATA_MAX_QUEUE -1 ); +/* host must have been started */ if (!(host->flags &ATA_HOST_STARTED )) {dev_err (host->dev,"BUG: trying to register unstarted host\n" );
drivers/hwmon/smsc47m192.c +3 -1
@@ -86,7 +86,7 @@ static inline u8 IN_TO_REG(unsigned long val, int n)*/ static inline s8 TEMP_TO_REG (int val) { -return clamp_val (SCALE (val,1 ,1000 ),-128000 ,127000 ); +return SCALE (clamp_val (val,-128000 ,127000 ),1 ,1000 ); }static inline int TEMP_FROM_REG (s8 val)
@@ -384,6 +384,8 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, err =kstrtoul (buf,10 , &val);if (err)return err; +if (val >255 ) +return -EINVAL ; data->vrm = val;return count;
drivers/input/input.c +4 -2
@@ -257,9 +257,10 @@ static int input_handle_abs_event(struct input_dev *dev, }static int input_get_disposition (struct input_dev *dev, -unsigned int type,unsigned int code,int value) +unsigned int type,unsigned int code,int *pval) {int disposition =INPUT_IGNORE_EVENT ; +int value = *pval;switch (type) {
@@ -357,6 +358,7 @@ static int input_get_disposition(struct input_dev *dev,break ; } + *pval = value;return disposition; }
@@ -365,7 +367,7 @@ static void input_handle_event(struct input_dev *dev, {int disposition; - disposition =input_get_disposition (dev, type, code, value); + disposition =input_get_disposition (dev, type, code, &value);if ((disposition &INPUT_PASS_TO_DEVICE ) && dev->event) dev->event (dev, type, code, value);
drivers/media/dvb-frontends/tda10071.c +5 -1
@@ -667,6 +667,7 @@ static int tda10071_set_frontend(struct dvb_frontend *fe)struct dtv_frontend_properties *c = &fe->dtv_property_cache;int ret, i;u8 mode, rolloff, pilot, inversion, div; +fe_modulation_t modulation;dev_dbg (&priv->i2c->dev,"%s: delivery_system=%d modulation=%d " \ "frequency=%d symbol_rate=%d inversion=%d pilot=%d " \
@@ -701,10 +702,13 @@ static int tda10071_set_frontend(struct dvb_frontend *fe)switch (c->delivery_system) {case SYS_DVBS : + modulation =QPSK ; rolloff =0 ; pilot =2 ;break ;case SYS_DVBS2 : + modulation = c->modulation; +switch (c->rolloff) {case ROLLOFF_20 : rolloff =2 ;
@@ -749,7 +753,7 @@ static int tda10071_set_frontend(struct dvb_frontend *fe)for (i =0 , mode =0xff ; i <ARRAY_SIZE (TDA10071_MODCOD ); i++) {if (c->delivery_system ==TDA10071_MODCOD [i].delivery_system && - c->modulation ==TDA10071_MODCOD [i].modulation && + modulation ==TDA10071_MODCOD [i].modulation && c->fec_inner ==TDA10071_MODCOD [i].fec) { mode =TDA10071_MODCOD [i].val; dev_dbg(&priv->i2c->dev, "%s: mode found=%02x\n",
drivers/media/usb/hdpvr/hdpvr-video.c +3 -3
@@ -81,7 +81,7 @@ static void hdpvr_read_bulk_callback(struct urb *urb) }/*=========================================================================*/ -/* bufffer bits */ +/* buffer bits */ /* function expects dev->io_mutex to be hold by caller */ int hdpvr_cancel_queue (struct hdpvr_device *dev)
@@ -921,7 +921,7 @@ static int hdpvr_s_ctrl(struct v4l2_ctrl *ctrl)case V4L2_CID_MPEG_AUDIO_ENCODING :if (dev->flags &HDPVR_FLAG_AC3_CAP ) { opt->audio_codec = ctrl->val; -return hdpvr_set_audio (dev, opt->audio_input, +return hdpvr_set_audio (dev, opt->audio_input +1 , opt->audio_codec); }return 0 ;
@@ -1191,7 +1191,7 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent,v4l2_ctrl_new_std_menu (hdl, &hdpvr_ctrl_ops,V4L2_CID_MPEG_AUDIO_ENCODING , ac3 ?V4L2_MPEG_AUDIO_ENCODING_AC3 :V4L2_MPEG_AUDIO_ENCODING_AAC , -0x7 ,V4L2_MPEG_AUDIO_ENCODING_AAC ); +0x7 , ac3 ? dev->options.audio_codec :V4L2_MPEG_AUDIO_ENCODING_AAC ); v4l2_ctrl_new_std_menu(hdl, &hdpvr_ctrl_ops, V4L2_CID_MPEG_VIDEO_ENCODING, V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC, 0x3,
fs/coredump.c +1 -1
@@ -299,7 +299,7 @@ static int zap_threads(struct task_struct *tsk, struct mm_struct *mm,if (unlikely (nr <0 ))return nr; - tsk->flags =PF_DUMPCORE ; + tsk->flags |=PF_DUMPCORE ;if (atomic_read (&mm->mm_users) == nr +1 ) goto done;/*
include/linux/libata.h +1 -0
@@ -547,6 +547,7 @@ struct ata_host {struct device *dev;void __iomem *const *iomap;unsigned int n_ports; +unsigned int n_tags;/* nr of NCQ tags */ void *private_data;struct ata_port_operations *ops;unsigned long flags;
kernel/trace/trace.c +1 -1
@@ -741,7 +741,7 @@ static struct { { trace_clock_local, "local", 1 }, { trace_clock_global, "global", 1 }, { trace_clock_counter, "counter", 0 }, - { trace_clock_jiffies, "uptime", 1 }, + { trace_clock_jiffies, "uptime", 0 }, { trace_clock, "perf", 1 },ARCH_TRACE_CLOCKS };
kernel/trace/trace_clock.c +5 -4
@@ -59,13 +59,14 @@ u64 notrace trace_clock(void)/* * trace_jiffy_clock(): Simply use jiffies as a clock counter. +* Note that this use of jiffies_64 is not completely safe on +* 32-bit systems. But the window is tiny, and the effect if +* we are affected is that we will have an obviously bogus +* timestamp on a trace event - i.e. not life threatening. */ u64 notrace trace_clock_jiffies(void) { -u64 jiffy = jiffies -INITIAL_JIFFIES ; - -/* Return nsecs */ -return (u64 )jiffies_to_usecs (jiffy) *1000ULL ; +return jiffies_64_to_clock_t (jiffies_64 -INITIAL_JIFFIES ); }/*
mm/hugetlb.c +1 -0
@@ -2400,6 +2400,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, }else {if (cow)huge_ptep_set_wrprotect (src, addr, src_pte); + entry =huge_ptep_get (src_pte); ptepage =pte_page (entry);get_page (ptepage);page_dup_rmap (ptepage);
mm/slab_common.c +2 -0
@@ -55,6 +55,7 @@ static int kmem_cache_sanity_check(struct mem_cgroup *memcg, const char *name,continue ; } +#if !defined(CONFIG_SLUB )/* * For simplicity, we won't check this in the list of memcg * caches. We have control over memcg naming, and if there
@@ -68,6 +69,7 @@ static int kmem_cache_sanity_check(struct mem_cgroup *memcg, const char *name, s =NULL ;return -EINVAL ; } +#endif }WARN_ON (strchr (name,' ' ));/* It confuses parsers */
net/netfilter/nfnetlink_queue_core.c +21 -8
@@ -227,22 +227,23 @@ nfqnl_flush(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn, unsigned long data)spin_unlock_bh (&queue->lock); } -static void +static int nfqnl_zcopy (struct sk_buff *to,const struct sk_buff *from,int len,int hlen) {int i, j =0 ;int plen =0 ;/* length of skb->head fragment */ +int ret;struct page *page;unsigned int offset;/* dont bother with small payloads */ -if (len <=skb_tailroom (to)) { -skb_copy_bits (from,0 ,skb_put (to, len), len); -return ; - } +if (len <=skb_tailroom (to)) +return skb_copy_bits (from,0 ,skb_put (to, len), len);if (hlen) { -skb_copy_bits (from,0 ,skb_put (to, hlen), hlen); + ret =skb_copy_bits (from,0 ,skb_put (to, hlen), hlen); +if (unlikely (ret)) +return ret; len -= hlen; }else { plen =min_t (int,skb_headlen (from), len);
@@ -260,6 +261,11 @@ nfqnl_zcopy(struct sk_buff *to, const struct sk_buff *from, int len, int hlen) to->len += len + plen; to->data_len += len + plen; +if (unlikely (skb_orphan_frags (from,GFP_ATOMIC ))) { +skb_tx_error (from); +return -ENOMEM ; + } +for (i =0 ; i <skb_shinfo (from)->nr_frags; i++) {if (!len)break ;
@@ -270,6 +276,8 @@ nfqnl_zcopy(struct sk_buff *to, const struct sk_buff *from, int len, int hlen) j++; }skb_shinfo (to)->nr_frags = j; + +return 0 ; }static int nfqnl_put_packet_info (struct sk_buff *nlskb,struct sk_buff *packet)
@@ -355,13 +363,16 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, skb =nfnetlink_alloc_skb (&init_net, size, queue->peer_portid,GFP_ATOMIC ); -if (!skb) +if (!skb) { +skb_tx_error (entskb);return NULL ; + } nlh =nlmsg_put (skb,0 ,0 ,NFNL_SUBSYS_QUEUE <<8 |NFQNL_MSG_PACKET ,sizeof (struct nfgenmsg ),0 );if (!nlh) { +skb_tx_error (entskb);kfree_skb (skb);return NULL ; }
@@ -481,13 +492,15 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, nla->nla_type =NFQA_PAYLOAD ; nla->nla_len =nla_attr_size (data_len); -nfqnl_zcopy (skb, entskb, data_len, hlen); +if (nfqnl_zcopy (skb, entskb, data_len, hlen)) + goto nla_put_failure; } nlh->nlmsg_len = skb->len;return skb; nla_put_failure: +skb_tx_error (entskb);kfree_skb (skb);net_err_ratelimited ("nf_queue: error creating packet message\n" );return NULL ;