Linux 4.14.314
Greg Kroah-Hartman
maintainerI'm announcing the release of the 4.14.314 kernel.
All users of the 4.14 kernel series must upgrade.
The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.14.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/arm/boot/dts/rk3288.dtsi | 2 arch/s390/kernel/ptrace.c | 8 - arch/x86/purgatory/Makefile | 3 drivers/iio/adc/at91-sama5d2_adc.c | 2 drivers/iio/counter/104-quad-8.c | 10 -- drivers/memstick/core/memstick.c | 5 - drivers/net/dsa/b53/b53_mmap.c | 14 +++ drivers/net/ethernet/intel/e1000e/netdev.c | 51 ++++++------ drivers/net/ethernet/intel/i40e/i40e_main.c | 9 +- drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c | 2 drivers/net/virtio_net.c | 7 + drivers/net/xen-netback/netback.c | 6 - drivers/scsi/megaraid/megaraid_sas_base.c | 2 drivers/scsi/scsi.c | 11 ++ fs/ext4/inline.c | 11 +- fs/ext4/xattr.c | 26 ------ fs/ext4/xattr.h | 6 - fs/nilfs2/segment.c | 20 ++++ include/net/ipv6.h | 2 include/net/udp.h | 2 include/net/udplite.h | 8 - include/trace/events/f2fs.h | 2 net/dccp/dccp.h | 1 net/dccp/ipv6.c | 15 +-- net/dccp/proto.c | 8 + net/ipv4/udp.c | 9 +- net/ipv4/udplite.c | 8 + net/ipv6/af_inet6.c | 15 +++ net/ipv6/ipv6_sockglue.c | 20 +--- net/ipv6/ping.c | 6 - net/ipv6/raw.c | 2 net/ipv6/tcp_ipv6.c | 8 - net/ipv6/udp.c | 17 +++- net/ipv6/udp_impl.h | 1 net/ipv6/udplite.c | 9 +- net/l2tp/l2tp_ip6.c | 2 net/sched/sch_qfq.c | 13 +-- net/sctp/socket.c | 29 ++++-- scripts/asn1_compiler.c | 2 tools/testing/selftests/sigaltstack/current_stack_pointer.h | 23 +++++ tools/testing/selftests/sigaltstack/sas.c | 7 - 42 files changed, 241 insertions(+), 165 deletions(-)
Aleksandr Loktionov (2):
i40e: fix accessing vsi->active_filters without holding lock
i40e: fix i40e_setup_misc_vector() error handling
Baokun Li (1):
ext4: fix use-after-free in ext4_xattr_set_entry
Damien Le Moal (1):
scsi: core: Improve scsi_vpd_inquiry() checks
Dan Carpenter (1):
iio: adc: at91-sama5d2_adc: fix an error code in at91_adc_allocate_trigger()
Douglas Raillard (1):
f2fs: Fix f2fs_truncate_partial_nodes ftrace event
Ekaterina Orlova (1):
ASN.1: Fix check for strdup() success
Greg Kroah-Hartman (2):
memstick: fix memory leak if card device is never registered Linux 4.14.314
Gwangun Jung (1):
net: sched: sch_qfq: prevent slab-out-of-bounds in qfq_activate_agg
Heiko Carstens (1):
s390/ptrace: fix PTRACE_GET_LAST_BREAK error handling
Jianqun Xu (1):
ARM: dts: rockchip: fix a typo error for rk3288 spdif node
Juergen Gross (1):
xen/netback: use same error messages for same errors
Kuniyuki Iwashima (5):
udp: Call inet6_destroy_sock() in setsockopt(IPV6_ADDRFORM).
tcp/udp: Call inet6_destroy_sock() in IPv6 sk->sk_destruct().
inet6: Remove inet6_destroy_sock() in sk->sk_prot->destroy().
dccp: Call inet6_destroy_sock() via sk->sk_destruct().
sctp: Call inet6_destroy_sock() via sk->sk_destruct().Nick Desaulniers (1):
selftests: sigaltstack: fix -Wuninitialized
Nikita Zhandarovich (1):
mlxfw: fix null-ptr-deref in mlxfw_mfa2_tlv_next()
Pingfan Liu (1):
x86/purgatory: Don't generate debug info for purgatory.ro
Ritesh Harjani (1):
ext4: remove duplicate definition of ext4_xattr_ibody_inline_set()
Ryusuke Konishi (1):
nilfs2: initialize unused bytes in segment summary blocks
Sebastian Basierski (1):
e1000e: Disable TSO on i219-LM card to increase speed
Tomas Henzl (1):
scsi: megaraid_sas: Fix fw_crash_buffer_show()
Tudor Ambarus (1):
Revert "ext4: fix use-after-free in ext4_xattr_set_entry"
William Breathitt Gray (1):
counter: 104-quad-8: Fix race condition between FLAG and CNTR reads
Xuan Zhuo (1):
virtio_net: bugfix overflow inside xdp_linearize_page()
Álvaro Fernández Rojas (1):
net: dsa: b53: mmap: add phy ops
Greg Kroah-Hartman
maintainerMakefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 14 -SUBLEVEL = 313 +SUBLEVEL = 314 EXTRAVERSION = NAME = Petit Gorille
arch/arm/boot/dts/rk3288.dtsi +1 -1
@@ -910,7 +910,7 @@ status = "disabled"; }; - spdif: sound@ff88b0000 { + spdif: sound@ff8b0000 { compatible = "rockchip,rk3288-spdif", "rockchip,rk3066-spdif"; reg = <0x0 0xff8b0000 0x0 0x10000>; #sound-dai-cells = <0>;
arch/s390/kernel/ptrace.c +2 -6
@@ -500,9 +500,7 @@ long arch_ptrace(struct task_struct *child, long request, }return 0 ;case PTRACE_GET_LAST_BREAK : -put_user (child->thread.last_break, - (unsigned long __user *) data); -return 0 ; +return put_user (child->thread.last_break, (unsigned long __user *)data);case PTRACE_ENABLE_TE :if (!MACHINE_HAS_TE )return -EIO ;
@@ -854,9 +852,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, }return 0 ;case PTRACE_GET_LAST_BREAK : -put_user (child->thread.last_break, - (unsigned int __user *) data); -return 0 ; +return put_user (child->thread.last_break, (unsigned int __user *)data); }return compat_ptrace_request (child, request, addr, data); }
arch/x86/purgatory/Makefile +3 -0
@@ -20,6 +20,9 @@ KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initia KBUILD_CFLAGS += -m$(BITS) KBUILD_CFLAGS += $(call cc-option,-fno-PIE) +AFLAGS_REMOVE_setup-x86_$(BITS).o += -Wa,-gdwarf-2 +AFLAGS_REMOVE_entry64.o += -Wa,-gdwarf-2 + $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE $(call if_changed,ld)
drivers/iio/adc/at91-sama5d2_adc.c +1 -1
@@ -400,7 +400,7 @@ static struct iio_trigger *at91_adc_allocate_trigger(struct iio_dev *indio, trig =devm_iio_trigger_alloc (&indio->dev,"%s-dev%d-%s" , indio->name, indio->id, trigger_name);if (!trig) -return NULL ; +return ERR_PTR (-ENOMEM ); trig->dev.parent = indio->dev.parent;iio_trigger_set_drvdata (trig, indio);
drivers/iio/counter/104-quad-8.c +1 -9
@@ -64,9 +64,6 @@ static int quad8_read_raw(struct iio_dev *indio_dev, {struct quad8_iio *const priv =iio_priv (indio_dev);const int base_offset = priv->base +2 * chan->channel; -unsigned int flags; -unsigned int borrow; -unsigned int carry;int i;switch (mask) {
@@ -76,12 +73,7 @@ static int quad8_read_raw(struct iio_dev *indio_dev,return IIO_VAL_INT ; } - flags =inb (base_offset +1 ); - borrow = flags &BIT (0 ); - carry = !!(flags &BIT (1 )); - -/* Borrow XOR Carry effectively doubles count range */ - *val = (borrow ^ carry) <<24 ; + *val =0 ;/* Reset Byte Pointer; transfer Counter to Output Latch */ outb (0x11 , base_offset +1 );
drivers/memstick/core/memstick.c +4 -1
@@ -416,6 +416,7 @@ static struct memstick_dev *memstick_alloc_card(struct memstick_host *host)return card; err_out: host->card = old_card; +kfree_const (card->dev.kobj.name);kfree (card);return NULL ; }
@@ -471,8 +472,10 @@ static void memstick_check(struct work_struct *work)put_device (&card->dev); host->card =NULL ; } - }else + }else { +kfree_const (card->dev.kobj.name);kfree (card); + } } out_power_off:
drivers/net/dsa/b53/b53_mmap.c +14 -0
@@ -207,6 +207,18 @@ static int b53_mmap_write64(struct b53_device *dev, u8 page, u8 reg,return 0 ; } +static int b53_mmap_phy_read16 (struct b53_device *dev,int addr,int reg, +u16 *value) +{ +return -EIO ; +} + +static int b53_mmap_phy_write16 (struct b53_device *dev,int addr,int reg, +u16 value) +{ +return -EIO ; +} +static const struct b53_io_ops b53_mmap_ops = { .read8 = b53_mmap_read8, .read16 = b53_mmap_read16,
@@ -218,6 +230,8 @@ static const struct b53_io_ops b53_mmap_ops = { .write32 = b53_mmap_write32, .write48 = b53_mmap_write48, .write64 = b53_mmap_write64, + .phy_read16 = b53_mmap_phy_read16, + .phy_write16 = b53_mmap_phy_write16, };static int b53_mmap_probe (struct platform_device *pdev)
drivers/net/ethernet/intel/e1000e/netdev.c +26 -25
63 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_main.c +6 -3
@@ -7378,8 +7378,11 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) pf->hw.aq.asq_last_status)); }/* reinit the misc interrupt */ -if (pf->flags &I40E_FLAG_MSIX_ENABLED ) +if (pf->flags &I40E_FLAG_MSIX_ENABLED ) { ret =i40e_setup_misc_vector (pf); +if (ret) + goto end_unlock; + }/* Add a filter to drop all Flow control frames from any VSI from being * transmitted. By doing so we stop a malicious VF from sending out
@@ -10078,15 +10081,15 @@ static int i40e_add_vsi(struct i40e_vsi *vsi) vsi->id = ctxt.vsi_number; } - vsi->active_filters =0 ; -clear_bit (__I40E_VSI_OVERFLOW_PROMISC, vsi->state);spin_lock_bh (&vsi->mac_filter_hash_lock); + vsi->active_filters =0 ;/* If macvlan filters already exist, force them to get loaded */ hash_for_each_safe (vsi->mac_filter_hash, bkt, h, f, hlist) { f->state =I40E_FILTER_NEW ; f_count++; }spin_unlock_bh (&vsi->mac_filter_hash_lock); +clear_bit (__I40E_VSI_OVERFLOW_PROMISC, vsi->state);if (f_count) { vsi->flags |=I40E_VSI_FLAG_FILTER_CHANGED ;
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c +2 -0
@@ -62,6 +62,8 @@ mlxfw_mfa2_tlv_next(const struct mlxfw_mfa2_file *mfa2_file,if (tlv->type ==MLXFW_MFA2_TLV_MULTI_PART ) { multi =mlxfw_mfa2_tlv_multi_get (mfa2_file, tlv); +if (!multi) +return NULL ; tlv_len =NLA_ALIGN (tlv_len +be16_to_cpu (multi->total_len)); }
drivers/net/virtio_net.c +6 -1
@@ -452,8 +452,13 @@ static struct page *xdp_linearize_page(struct receive_queue *rq,int page_off, unsigned int *len) { - struct page *page = alloc_page(GFP_ATOMIC); + int tailroom = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); +struct page *page; +if (page_off + *len + tailroom >PAGE_SIZE ) +return NULL ; + + page =alloc_page (GFP_ATOMIC );if (!page)return NULL ;
drivers/net/xen-netback/netback.c +2 -4
@@ -991,10 +991,8 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,/* No crossing a page as the payload mustn't fragment. */ if (unlikely ((txreq.offset + txreq.size) >XEN_PAGE_SIZE )) { -netdev_err (queue->vif->dev, -"txreq.offset: %u, size: %u, end: %lu\n" , - txreq.offset, txreq.size, - (unsigned long )(txreq.offset&~XEN_PAGE_MASK ) + txreq.size); +netdev_err (queue->vif->dev,"Cross page boundary, txreq.offset: %u, size: %u\n" , + txreq.offset, txreq.size);xenvif_fatal_tx_err (queue->vif);break ; }
drivers/scsi/megaraid/megaraid_sas_base.c +1 -1
@@ -2983,7 +2983,7 @@ megasas_fw_crash_buffer_show(struct device *cdev,spin_lock_irqsave (&instance->crashdump_lock, flags); buff_offset = instance->fw_crash_buffer_offset; -if (!instance->crash_dump_buf && +if (!instance->crash_dump_buf || !((instance->fw_crash_state ==AVAILABLE ) || (instance->fw_crash_state ==COPYING ))) { dev_err(&instance->pdev->dev,
drivers/scsi/scsi.c +9 -2
@@ -351,11 +351,18 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,if (result)return -EIO ; -/* Sanity check that we got the page back that we asked for */ +/* +* Sanity check that we got the page back that we asked for and that +* the page size is not 0. +*/ if (buffer[1 ] != page)return -EIO ; -return get_unaligned_be16 (&buffer[2 ]) +4 ; + result =get_unaligned_be16 (&buffer[2 ]); +if (!result) +return -EIO ; + +return result +4 ; }/**
fs/ext4/inline.c +5 -6
@@ -212,7 +212,7 @@ static int ext4_read_inline_data(struct inode *inode, void *buffer,/* * write the buffer to the inline inode. * If 'create' is set, we don't need to do the extra copy in the xattr -* value since it is already handled by ext4_xattr_ibody_inline_set. +* value since it is already handled by ext4_xattr_ibody_set. * That saves us one memcpy. */ static void ext4_write_inline_data(struct inode *inode, struct ext4_iloc *iloc,
@@ -294,7 +294,7 @@ static int ext4_create_inline_data(handle_t *handle,BUG_ON (!is.s.not_found); - error =ext4_xattr_ibody_inline_set (handle, inode, &i, &is); + error =ext4_xattr_ibody_set (handle, inode, &i, &is);if (error) {if (error == -ENOSPC ) ext4_clear_inode_state(inode,
@@ -366,7 +366,7 @@ static int ext4_update_inline_data(handle_t *handle, struct inode *inode, i.value = value; i.value_len = len; - error =ext4_xattr_ibody_inline_set (handle, inode, &i, &is); + error =ext4_xattr_ibody_set (handle, inode, &i, &is);if (error) goto out;
@@ -439,7 +439,7 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle,if (error) goto out; - error =ext4_xattr_ibody_inline_set (handle, inode, &i, &is); + error =ext4_xattr_ibody_set (handle, inode, &i, &is);if (error) goto out;
@@ -1951,8 +1951,7 @@ int ext4_inline_data_truncate(struct inode *inode, int *has_inline) i.value = value; i.value_len = i_size >EXT4_MIN_INLINE_DATA_SIZE ? i_size -EXT4_MIN_INLINE_DATA_SIZE :0 ; - err =ext4_xattr_ibody_inline_set (handle, inode, - &i, &is); + err =ext4_xattr_ibody_set (handle, inode, &i, &is);if (err) goto out_error; }
fs/ext4/xattr.c +1 -25
@@ -2222,7 +2222,7 @@ int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,return 0 ; } -int ext4_xattr_ibody_inline_set (handle_t *handle,struct inode *inode, +int ext4_xattr_ibody_set (handle_t *handle,struct inode *inode,struct ext4_xattr_info *i,struct ext4_xattr_ibody_find *is) {
@@ -2247,30 +2247,6 @@ int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode,return 0 ; } -static int ext4_xattr_ibody_set (handle_t *handle,struct inode *inode, -struct ext4_xattr_info *i, -struct ext4_xattr_ibody_find *is) -{ -struct ext4_xattr_ibody_header *header; -struct ext4_xattr_search *s = &is->s; -int error; - -if (EXT4_I (inode)->i_extra_isize ==0 ) -return -ENOSPC ; - error =ext4_xattr_set_entry (i, s, handle, inode, false/* is_block */ ); -if (error) -return error; - header =IHDR (inode,ext4_raw_inode (&is->iloc)); -if (!IS_LAST_ENTRY (s->first)) { - header->h_magic =cpu_to_le32 (EXT4_XATTR_MAGIC ); -ext4_set_inode_state (inode,EXT4_STATE_XATTR ); - }else { - header->h_magic =cpu_to_le32 (0 ); -ext4_clear_inode_state (inode,EXT4_STATE_XATTR ); - } -return 0 ; -} -static int ext4_xattr_value_same (struct ext4_xattr_search *s,struct ext4_xattr_info *i) {
fs/ext4/xattr.h +3 -3
@@ -198,9 +198,9 @@ extern int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,extern int ext4_xattr_ibody_get (struct inode *inode,int name_index,const char *name,void *buffer,size_t buffer_size); -extern int ext4_xattr_ibody_inline_set (handle_t *handle,struct inode *inode, -struct ext4_xattr_info *i, -struct ext4_xattr_ibody_find *is); +extern int ext4_xattr_ibody_set (handle_t *handle,struct inode *inode, +struct ext4_xattr_info *i, +struct ext4_xattr_ibody_find *is);extern struct mb_cache *ext4_xattr_create_cache (void );extern void ext4_xattr_destroy_cache (struct mb_cache *);
fs/nilfs2/segment.c +20 -0
@@ -444,6 +444,23 @@ static int nilfs_segctor_reset_segment_buffer(struct nilfs_sc_info *sci)return 0 ; } +/** +* nilfs_segctor_zeropad_segsum - zero pad the rest of the segment summary area +* @sci: segment constructor object +* +* nilfs_segctor_zeropad_segsum() zero-fills unallocated space at the end of +* the current segment summary block. +*/ +static void nilfs_segctor_zeropad_segsum (struct nilfs_sc_info *sci) +{ +struct nilfs_segsum_pointer *ssp; + + ssp = sci->sc_blk_cnt >0 ? &sci->sc_binfo_ptr : &sci->sc_finfo_ptr; +if (ssp->offset < ssp->bh->b_size) +memset (ssp->bh->b_data + ssp->offset,0 , + ssp->bh->b_size - ssp->offset); +} +static int nilfs_segctor_feed_segment (struct nilfs_sc_info *sci) { sci->sc_nblk_this_inc += sci->sc_curseg->sb_sum.nblocks;
@@ -452,6 +469,7 @@ static int nilfs_segctor_feed_segment(struct nilfs_sc_info *sci)* The current segment is filled up * (internal code) */ +nilfs_segctor_zeropad_segsum (sci); sci->sc_curseg =NILFS_NEXT_SEGBUF (sci->sc_curseg);return nilfs_segctor_reset_segment_buffer (sci); }
@@ -556,6 +574,7 @@ static int nilfs_segctor_add_file_block(struct nilfs_sc_info *sci, goto retry; }if (unlikely (required)) { +nilfs_segctor_zeropad_segsum (sci); err =nilfs_segbuf_extend_segsum (segbuf);if (unlikely (err)) goto failed;
@@ -1544,6 +1563,7 @@ static int nilfs_segctor_collect(struct nilfs_sc_info *sci, nadd =min_t (int, nadd <<1 ,SC_MAX_SEGDELTA ); sci->sc_stage = prev_stage; } +nilfs_segctor_zeropad_segsum (sci);nilfs_segctor_truncate_segments (sci, sci->sc_curseg, nilfs->ns_sufile);return 0 ;
include/net/ipv6.h +2 -0
@@ -942,6 +942,8 @@ void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,void ipv6_local_error (struct sock *sk,int err,struct flowi6 *fl6,u32 info);void ipv6_local_rxpmtu (struct sock *sk,struct flowi6 *fl6,u32 mtu); +void inet6_cleanup_sock (struct sock *sk); +void inet6_sock_destruct (struct sock *sk);int inet6_release (struct socket *sock);int inet6_bind (struct socket *sock,struct sockaddr *uaddr,int addr_len); int inet6_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len,
include/net/udp.h +1 -1
@@ -251,7 +251,7 @@ static inline int udp_rqueue_get(struct sock *sk) }/* net/ipv4/udp.c */ -void udp_destruct_sock (struct sock *sk); +void udp_destruct_common (struct sock *sk);void skb_consume_udp (struct sock *sk,struct sk_buff *skb,int len);int __udp_enqueue_schedule_skb (struct sock *sk,struct sk_buff *skb);void udp_skb_destructor (struct sock *sk,struct sk_buff *skb);
include/net/udplite.h +0 -8
@@ -24,14 +24,6 @@ static __inline__ int udplite_getfrag(void *from, char *to, int offset,return copy_from_iter_full (to, len, &msg->msg_iter) ?0 : -EFAULT ; } -/* Designate sk as UDP-Lite socket */ -static inline int udplite_sk_init (struct sock *sk) -{ -udp_init_sock (sk); -udp_sk (sk)->pcflag =UDPLITE_BIT ; -return 0 ; -} -/* * Checksumming routines */
include/trace/events/f2fs.h +1 -1
@@ -485,7 +485,7 @@ TRACE_EVENT(f2fs_truncate_partial_nodes,TP_STRUCT__entry (__field (dev_t ,dev )__field (ino_t, ino) - __field(nid_t, nid[3]) +__array (nid_t, nid,3 )__field (int, depth)__field (int, err) ),
net/dccp/dccp.h +1 -0
@@ -291,6 +291,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,int dccp_rcv_established (struct sock *sk,struct sk_buff *skb,const struct dccp_hdr *dh,const unsigned int len); +void dccp_destruct_common (struct sock *sk);int dccp_init_sock (struct sock *sk,const __u8 ctl_sock_initialized);void dccp_destroy_sock (struct sock *sk);
net/dccp/ipv6.c +8 -7
@@ -1000,6 +1000,12 @@ static const struct inet_connection_sock_af_ops dccp_ipv6_mapped = {#endif }; +static void dccp_v6_sk_destruct (struct sock *sk) +{ +dccp_destruct_common (sk); +inet6_sock_destruct (sk); +} +/* NOTE: A lot of things set to zero explicitly by call to * sk_alloc() so need not be done here. */
@@ -1012,17 +1018,12 @@ static int dccp_v6_init_sock(struct sock *sk)if (unlikely (!dccp_v6_ctl_sock_initialized)) dccp_v6_ctl_sock_initialized =1 ;inet_csk (sk)->icsk_af_ops = &dccp_ipv6_af_ops; + sk->sk_destruct = dccp_v6_sk_destruct; }return err; } -static void dccp_v6_destroy_sock (struct sock *sk) -{ -dccp_destroy_sock (sk); -inet6_destroy_sock (sk); -} -static struct timewait_sock_ops dccp6_timewait_sock_ops = { .twsk_obj_size =sizeof (struct dccp6_timewait_sock ), };
@@ -1045,7 +1046,7 @@ static struct proto dccp_v6_prot = { .accept = inet_csk_accept, .get_port = inet_csk_get_port, .shutdown = dccp_shutdown, - .destroy = dccp_v6_destroy_sock, + .destroy = dccp_destroy_sock, .orphan_count = &dccp_orphan_count, .max_header = MAX_DCCP_HEADER, .obj_size = sizeof(struct dccp6_sock),
net/dccp/proto.c +7 -1
@@ -171,12 +171,18 @@ const char *dccp_packet_name(const int type)EXPORT_SYMBOL_GPL (dccp_packet_name); -static void dccp_sk_destruct (struct sock *sk) +void dccp_destruct_common (struct sock *sk) {struct dccp_sock *dp =dccp_sk (sk);ccid_hc_tx_delete (dp->dccps_hc_tx_ccid, sk); dp->dccps_hc_tx_ccid =NULL ; +} +EXPORT_SYMBOL_GPL (dccp_destruct_common); + +static void dccp_sk_destruct (struct sock *sk) +{ +dccp_destruct_common (sk);inet_sock_destruct (sk); }
net/ipv4/udp.c +6 -3
@@ -1380,7 +1380,7 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb) }EXPORT_SYMBOL_GPL (__udp_enqueue_schedule_skb); -void udp_destruct_sock (struct sock *sk) +void udp_destruct_common (struct sock *sk) {/* reclaim completely the forward allocated memory */ struct udp_sock *up =udp_sk (sk);
@@ -1393,10 +1393,14 @@ void udp_destruct_sock(struct sock *sk)kfree_skb (skb); }udp_rmem_release (sk, total,0 , true); +} +EXPORT_SYMBOL_GPL (udp_destruct_common); +static void udp_destruct_sock (struct sock *sk) +{ +udp_destruct_common (sk);inet_sock_destruct (sk); } -EXPORT_SYMBOL_GPL (udp_destruct_sock);int udp_init_sock (struct sock *sk) {
@@ -1404,7 +1408,6 @@ int udp_init_sock(struct sock *sk) sk->sk_destruct = udp_destruct_sock;return 0 ; } -EXPORT_SYMBOL_GPL (udp_init_sock);void skb_consume_udp (struct sock *sk,struct sk_buff *skb,int len) {
net/ipv4/udplite.c +8 -0
@@ -19,6 +19,14 @@struct udp_table udplite_table__read_mostly ;EXPORT_SYMBOL (udplite_table); +/* Designate sk as UDP-Lite socket */ +static int udplite_sk_init (struct sock *sk) +{ +udp_init_sock (sk); +udp_sk (sk)->pcflag =UDPLITE_BIT ; +return 0 ; +} +static int udplite_rcv (struct sk_buff *skb) {return __udp4_lib_rcv (skb, &udplite_table,IPPROTO_UDPLITE );
net/ipv6/af_inet6.c +14 -1
@@ -107,6 +107,13 @@ static __inline__ struct ipv6_pinfo *inet6_sk_generic(struct sock *sk)return (struct ipv6_pinfo *)(((u8 *)sk) + offset); } +void inet6_sock_destruct (struct sock *sk) +{ +inet6_cleanup_sock (sk); +inet_sock_destruct (sk); +} +EXPORT_SYMBOL_GPL (inet6_sock_destruct); +static int inet6_create (struct net *net,struct socket *sock,int protocol,int kern) {
@@ -199,7 +206,7 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol, inet->hdrincl =1 ; } - sk->sk_destruct = inet_sock_destruct; + sk->sk_destruct = inet6_sock_destruct; sk->sk_family =PF_INET6 ; sk->sk_protocol = protocol;
@@ -480,6 +487,12 @@ void inet6_destroy_sock(struct sock *sk) }EXPORT_SYMBOL_GPL (inet6_destroy_sock); +void inet6_cleanup_sock (struct sock *sk) +{ +inet6_destroy_sock (sk); +} +EXPORT_SYMBOL_GPL (inet6_cleanup_sock); +/* * This does both peername and sockname. */
net/ipv6/ipv6_sockglue.c +8 -12
@@ -178,9 +178,6 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,if (optlen <sizeof (int )) goto e_inval;if (val ==PF_INET ) { -struct ipv6_txoptions *opt; -struct sk_buff *pktopt; -if (sk->sk_type ==SOCK_RAW )break ;
@@ -211,7 +208,6 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,break ; } -fl6_free_socklist (sk);__ipv6_sock_mc_close (sk);__ipv6_sock_ac_close (sk);
@@ -246,14 +242,14 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, sk->sk_socket->ops = &inet_dgram_ops; sk->sk_family =PF_INET ; } - opt =xchg ((__force struct ipv6_txoptions **)&np->opt, -NULL ); -if (opt) { -atomic_sub (opt->tot_len, &sk->sk_omem_alloc); -txopt_put (opt); - } - pktopt =xchg (&np->pktoptions,NULL ); -kfree_skb (pktopt); + +/* Disable all options not to allocate memory anymore, +* but there is still a race. See the lockless path +* in udpv6_sendmsg() and ipv6_local_rxpmtu(). +*/ + np->rxopt.all =0 ; + +inet6_cleanup_sock (sk);/* * ... and add it to the refcnt debug socks count
net/ipv6/ping.c +0 -6
@@ -26,11 +26,6 @@#include <net/transp_v6.h> #include <net/ping.h> -static void ping_v6_destroy (struct sock *sk) -{ -inet6_destroy_sock (sk); -} -/* Compatibility glue so we can support IPv6 when it's compiled as a module */ static int dummy_ipv6_recv_error (struct sock *sk,struct msghdr *msg,int len,int *addr_len)
@@ -178,7 +173,6 @@ struct proto pingv6_prot = { .owner = THIS_MODULE, .init = ping_init_sock, .close = ping_close, - .destroy = ping_v6_destroy, .connect = ip6_datagram_connect_v6_only, .disconnect = __udp_disconnect, .setsockopt = ipv6_setsockopt,
net/ipv6/raw.c +0 -2
@@ -1258,8 +1258,6 @@ static void raw6_destroy(struct sock *sk)lock_sock (sk);ip6_flush_pending_frames (sk);release_sock (sk); - -inet6_destroy_sock (sk); }static int rawv6_init_sk (struct sock *sk)
net/ipv6/tcp_ipv6.c +1 -7
@@ -1754,12 +1754,6 @@ static int tcp_v6_init_sock(struct sock *sk)return 0 ; } -static void tcp_v6_destroy_sock (struct sock *sk) -{ -tcp_v4_destroy_sock (sk); -inet6_destroy_sock (sk); -} -#ifdef CONFIG_PROC_FS /* Proc filesystem TCPv6 sock list dumping. */ static void get_openreq6(struct seq_file *seq,
@@ -1953,7 +1947,7 @@ struct proto tcpv6_prot = { .accept = inet_csk_accept, .ioctl = tcp_ioctl, .init = tcp_v6_init_sock, - .destroy = tcp_v6_destroy_sock, + .destroy = tcp_v4_destroy_sock, .shutdown = tcp_shutdown, .setsockopt = tcp_setsockopt, .getsockopt = tcp_getsockopt,
net/ipv6/udp.c +14 -3
@@ -66,6 +66,19 @@ static bool udp6_lib_exact_dif_match(struct net *net, struct sk_buff *skb)return false; } +static void udpv6_destruct_sock (struct sock *sk) +{ +udp_destruct_common (sk); +inet6_sock_destruct (sk); +} + +int udpv6_init_sock (struct sock *sk) +{ +skb_queue_head_init (&udp_sk (sk)->reader_queue); + sk->sk_destruct = udpv6_destruct_sock; +return 0 ; +} + static u32 udp6_ehashfn(const struct net *net, const struct in6_addr *laddr, const u16 lport,
@@ -1446,8 +1459,6 @@ void udpv6_destroy_sock(struct sock *sk)if (encap_destroy)encap_destroy (sk); } - -inet6_destroy_sock (sk); }/*
@@ -1552,7 +1563,7 @@ struct proto udpv6_prot = { .connect = ip6_datagram_connect, .disconnect = udp_disconnect, .ioctl = udp_ioctl, - .init = udp_init_sock, + .init = udpv6_init_sock, .destroy = udpv6_destroy_sock, .setsockopt = udpv6_setsockopt, .getsockopt = udpv6_getsockopt,
net/ipv6/udp_impl.h +1 -0
@@ -12,6 +12,7 @@ int __udp6_lib_rcv(struct sk_buff *, struct udp_table *, int);void __udp6_lib_err (struct sk_buff *,struct inet6_skb_parm *,u8 ,u8 ,int ,__be32 ,struct udp_table *); +int udpv6_init_sock (struct sock *sk);int udp_v6_get_port (struct sock *sk,unsigned short snum); int udpv6_getsockopt(struct sock *sk, int level, int optname,
net/ipv6/udplite.c +8 -1
@@ -14,6 +14,13 @@#include <linux/export.h> #include "udp_impl.h" +static int udplitev6_sk_init (struct sock *sk) +{ +udpv6_init_sock (sk); +udp_sk (sk)->pcflag =UDPLITE_BIT ; +return 0 ; +} +static int udplitev6_rcv (struct sk_buff *skb) {return __udp6_lib_rcv (skb, &udplite_table,IPPROTO_UDPLITE );
@@ -39,7 +46,7 @@ struct proto udplitev6_prot = { .connect = ip6_datagram_connect, .disconnect = udp_disconnect, .ioctl = udp_ioctl, - .init = udplite_sk_init, + .init = udplitev6_sk_init, .destroy = udpv6_destroy_sock, .setsockopt = udpv6_setsockopt, .getsockopt = udpv6_getsockopt,
net/l2tp/l2tp_ip6.c +0 -2
@@ -277,8 +277,6 @@ static void l2tp_ip6_destroy_sock(struct sock *sk)l2tp_tunnel_closeall (tunnel);sock_put (sk); } - -inet6_destroy_sock (sk); }static int l2tp_ip6_bind (struct sock *sk,struct sockaddr *uaddr,int addr_len)
net/sched/sch_qfq.c +7 -6
@@ -432,15 +432,16 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, }else weight =1 ; -if (tb[TCA_QFQ_LMAX ]) { +if (tb[TCA_QFQ_LMAX ]) lmax =nla_get_u32 (tb[TCA_QFQ_LMAX ]); -if (lmax <QFQ_MIN_LMAX || lmax > (1UL <<QFQ_MTU_SHIFT )) { -pr_notice ("qfq: invalid max length %u\n" , lmax); -return -EINVAL ; - } - }else +else lmax =psched_mtu (qdisc_dev (sch)); +if (lmax <QFQ_MIN_LMAX || lmax > (1UL <<QFQ_MTU_SHIFT )) { +pr_notice ("qfq: invalid max length %u\n" , lmax); +return -EINVAL ; + } + inv_w =ONE_FP / weight; weight =ONE_FP / inv_w;
net/sctp/socket.c +21 -8
@@ -4497,13 +4497,17 @@ static void sctp_destroy_sock(struct sock *sk) }/* Triggered when there are no references on the socket anymore */ -static void sctp_destruct_sock (struct sock *sk) +static void sctp_destruct_common (struct sock *sk) {struct sctp_sock *sp =sctp_sk (sk);/* Free up the HMAC transform. */ crypto_free_shash (sp->hmac); +} +static void sctp_destruct_sock (struct sock *sk) +{ +sctp_destruct_common (sk);inet_sock_destruct (sk); }
@@ -8134,7 +8138,7 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, newsk->sk_reuse = sk->sk_reuse; newsk->sk_shutdown = sk->sk_shutdown; - newsk->sk_destruct = sctp_destruct_sock; + newsk->sk_destruct = sk->sk_destruct; newsk->sk_family = sk->sk_family; newsk->sk_protocol =IPPROTO_SCTP ; newsk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
@@ -8351,11 +8355,20 @@ struct proto sctp_prot = {#if IS_ENABLED (CONFIG_IPV6 ) -#include <net/transp_v6.h> -static void sctp_v6_destroy_sock (struct sock *sk) +static void sctp_v6_destruct_sock (struct sock *sk) +{ +sctp_destruct_common (sk); +inet6_sock_destruct (sk); +} + +static int sctp_v6_init_sock (struct sock *sk) { -sctp_destroy_sock (sk); -inet6_destroy_sock (sk); +int ret =sctp_init_sock (sk); + +if (!ret) + sk->sk_destruct = sctp_v6_destruct_sock; + +return ret; } struct proto sctpv6_prot = {
@@ -8365,8 +8378,8 @@ struct proto sctpv6_prot = { .disconnect = sctp_disconnect, .accept = sctp_accept, .ioctl = sctp_ioctl, - .init = sctp_init_sock, - .destroy = sctp_v6_destroy_sock, + .init = sctp_v6_init_sock, + .destroy = sctp_destroy_sock, .shutdown = sctp_shutdown, .setsockopt = sctp_setsockopt, .getsockopt = sctp_getsockopt,
scripts/asn1_compiler.c +1 -1
@@ -629,7 +629,7 @@ int main(int argc, char **argv) p =strrchr (argv[1 ],'/' ); p = p ? p +1 : argv[1 ]; grammar_name =strdup (p); -if (!p) { +if (!grammar_name) {perror (NULL );exit (1 ); }
tools/testing/selftests/sigaltstack/current_stack_pointer.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#if __alpha__ +registerunsigned long sp asm("$30" ); +#elif __arm__ || __aarch64__ || __csky__ || __m68k__ || __mips__ || __riscv +registerunsigned long sp asm("sp" ); +#elif __i386__ +registerunsigned long sp asm("esp" ); +#elif __loongarch64 +registerunsigned long sp asm("$sp" ); +#elif __ppc__ +registerunsigned long sp asm("r1" ); +#elif __s390x__ +registerunsigned long sp asm("%15" ); +#elif __sh__ +registerunsigned long sp asm("r15" ); +#elif __x86_64__ +registerunsigned long sp asm("rsp" ); +#elif __XTENSA__ +registerunsigned long sp asm("a1" ); +#else +#error "implement current_stack_pointer equivalent" +#endif
tools/testing/selftests/sigaltstack/sas.c +1 -6
@@ -19,6 +19,7 @@#include <errno.h> #include "../kselftest.h" +#include "current_stack_pointer.h" #ifndef SS_AUTODISARM #define SS_AUTODISARM (1U << 31)
@@ -40,12 +41,6 @@ void my_usr1(int sig, siginfo_t *si, void *u)stack_t stk;struct stk_data *p; -#if __s390x__ - registerunsigned long sp asm("%15" ); -#else - registerunsigned long sp asm("sp" ); -#endif -if (sp < (unsigned long )sstack || sp >= (unsigned long )sstack +SIGSTKSZ ) {ksft_exit_fail_msg ("SP is not on sigaltstack\n" );