Linux 4.1.15
Greg KH
maintainerI'm announcing the release of the 4.1.15 kernel.
All users of the 4.1 kernel series must upgrade.
The updated 4.1.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.1.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 | 2 drivers/block/rbd.c | 1 drivers/firewire/ohci.c | 5 drivers/net/phy/broadcom.c | 2 drivers/net/usb/qmi_wwan.c | 1 fs/btrfs/file.c | 16 +- fs/btrfs/inode.c | 92 ++++++++++++--- fs/btrfs/ioctl.c | 195 ++++++++++++++++++++++++-------- fs/btrfs/xattr.c | 4 fs/ceph/mds_client.c | 2 fs/debugfs/inode.c | 6 fs/ext4/ext4_jbd2.c | 6 fs/ext4/page-io.c | 5 fs/ext4/super.c | 12 + fs/jbd2/journal.c | 6 fs/nfs/inode.c | 6 fs/nfs/nfs4client.c | 2 fs/nfsd/nfs4state.c | 127 ++++++++++++++++++-- fs/nfsd/state.h | 19 +-- fs/ocfs2/namei.c | 2 include/linux/ipv6.h | 2 include/linux/jbd2.h | 1 include/net/af_unix.h | 1 include/net/ip6_tunnel.h | 3 include/net/ip_tunnels.h | 3 include/net/ipv6.h | 22 +++ include/net/sch_generic.h | 3 kernel/bpf/arraymap.c | 2 net/core/neighbour.c | 4 net/core/scm.c | 2 net/dccp/ipv6.c | 33 +++-- net/ipv4/ipmr.c | 15 +- net/ipv4/tcp_input.c | 23 +++ net/ipv4/tcp_ipv4.c | 3 net/ipv4/tcp_timer.c | 12 + net/ipv6/af_inet6.c | 13 +- net/ipv6/datagram.c | 4 net/ipv6/exthdrs.c | 3 net/ipv6/inet6_connection_sock.c | 11 + net/ipv6/ip6mr.c | 15 +- net/ipv6/ipv6_sockglue.c | 33 +++-- net/ipv6/mcast.c | 2 net/ipv6/netfilter/nf_conntrack_reasm.c | 5 net/ipv6/raw.c | 8 - net/ipv6/reassembly.c | 10 + net/ipv6/syncookies.c | 2 net/ipv6/tcp_ipv6.c | 28 ++-- net/ipv6/udp.c | 8 - net/l2tp/l2tp_ip6.c | 8 - net/packet/af_packet.c | 86 +++++++------- net/rds/connection.c | 6 net/rds/send.c | 4 net/sched/sch_api.c | 27 ++-- net/sched/sch_generic.c | 2 net/sched/sch_mq.c | 4 net/sched/sch_mqprio.c | 4 net/sctp/auth.c | 4 net/sctp/socket.c | 9 + net/unix/af_unix.c | 183 ++++++++++++++++++++++++++---- sound/pci/hda/patch_hdmi.c | 3 tools/net/Makefile | 7 - 61 files changed, 857 insertions(+), 272 deletions(-)
Aaro Koskinen (1):
broadcom: fix PHY_ID_BCM5481 entry in the id table
Andrew Elble (1):
nfsd: eliminate sending duplicate and repeated delegations
Arnd Bergmann (1):
ceph: fix message length computation
Benjamin Coddington (1):
nfs4: start callback_ident at idr 1
Bjørn Mork (1):
net: qmi_wwan: add XS Stick W100-2 from 4G Systems
Daeho Jeong (1):
ext4, jbd2: ensure entering into panic after recording an error in superblock
Daniel Borkmann (8):
packet: do skb_probe_transport_header when we actually have data
packet: always probe for transport header
packet: only allow extra vlan len on ethernet devices
packet: infer protocol from ethernet header if unset
packet: fix tpacket_snd max frame len
net, scm: fix PaX detected msg_controllen overflow in scm_detach_fds bpf, array: fix heap out-of-bounds access when updating elements
debugfs: fix refcount imbalance in start_creating
Eric Dumazet (6):
tcp: md5: fix lockdep annotation
tcp: fix potential huge kmalloc() calls in TCP_REPAIR
tcp: initialize tp->copied_seq in case of cross SYN connection
ipv6: add complete rcu protection around np->opt
ipv6: sctp: implement sctp_v6_destroy_sock()
net_sched: fix qdisc_tree_decrease_qlen() races
Filipe Manana (5):
Btrfs: fix file corruption and data loss after cloning inline extents
Btrfs: fix truncation of compressed and inlined extents
Btrfs: fix race leading to incorrect item deletion when dropping extents
Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow
Btrfs: fix race when listing an inode's xattrs
Greg Kroah-Hartman (1):
Linux 4.1.15
Ilya Dryomov (1):
rbd: don't put snap_context twice in rbd_queue_workfn()
Jason A. Donenfeld (1):
ip_tunnel: disable preemption when updating per-cpu tstats
Jeff Layton (2):
nfsd: serialize state seqid morphing operations
nfs: if we have no valid attrs, then don't declare the attribute cache valid
Junxiao Bi (1):
ocfs2: fix umask ignored issue
Kamal Mostafa (1):
tools/net: Use include/uapi with __EXPORTED_HEADERS__
Konstantin Khlebnikov (1):
net/neighbour: fix crash at dumping device-agnostic proxy entries
Lu, Han (1):
ALSA: hda/hdmi - apply Skylake fix-ups to Broxton display codec
Lukas Czerner (1):
ext4: fix potential use after free in __ext4_journal_stop
Michal Kubeček (1):
ipv6: distinguish frag queues by device for multicast and link-local packets
Neil Horman (1):
snmp: Remove duplicate OUTMCAST stat increment
Nikolay Aleksandrov (2):
net: ipmr: fix static mfc/dev leaks on table destruction
net: ip6mr: fix static mfc/dev leaks on table destruction
Quentin Casasnovas (1):
RDS: fix race condition when sending a message on unbound socket
Rainer Weikusat (1):
unix: avoid use-after-free in ep_remove_wait_queue
Stefan Richter (1):
firewire: ohci: fix JMicron JMB38x IT context discovery
Theodore Ts'o (1):
ext4 crypto: fix memory leak in ext4_bio_write_page()
Yuchung Cheng (1):
tcp: disable Fast Open on timeouts after handshake
lucien (1):
sctp: translate host order to network order when setting a hmacid
Greg KH
maintainerMakefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 1 -SUBLEVEL = 14 +SUBLEVEL = 15 EXTRAVERSION = NAME = Series 4800
drivers/block/rbd.c +1 -0
@@ -3417,6 +3417,7 @@ static void rbd_queue_workfn(struct work_struct *work) goto err_rq; } img_request->rq = rq; + snapc =NULL ;/* img_request consumes a ref */ if (op_type ==OBJ_OP_DISCARD ) result = rbd_img_request_fill(img_request, OBJ_REQUEST_NODATA,
drivers/firewire/ohci.c +5 -0
@@ -3675,6 +3675,11 @@ static int pci_probe(struct pci_dev *dev,reg_write (ohci, OHCI1394_IsoXmitIntMaskSet, ~0 ); ohci->it_context_support =reg_read (ohci, OHCI1394_IsoXmitIntMaskSet); +/* JMicron JMB38x often shows 0 at first read, just ignore it */ +if (!ohci->it_context_support) { +ohci_notice (ohci,"overriding IsoXmitIntMask\n" ); + ohci->it_context_support =0xf ; + }reg_write (ohci, OHCI1394_IsoXmitIntMaskClear, ~0 ); ohci->it_context_mask = ohci->it_context_support; ohci->n_it =hweight32 (ohci->it_context_mask);
drivers/net/phy/broadcom.c +1 -1
@@ -675,7 +675,7 @@ static struct mdio_device_id __maybe_unused broadcom_tbl[] = { { PHY_ID_BCM5461, 0xfffffff0 }, { PHY_ID_BCM54616S, 0xfffffff0 }, { PHY_ID_BCM5464, 0xfffffff0 }, - { PHY_ID_BCM5482, 0xfffffff0 }, + { PHY_ID_BCM5481, 0xfffffff0 }, { PHY_ID_BCM5482, 0xfffffff0 }, { PHY_ID_BCM50610, 0xfffffff0 }, { PHY_ID_BCM50610M, 0xfffffff0 },
drivers/net/usb/qmi_wwan.c +1 -0
@@ -774,6 +774,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */ + {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */ {QMI_FIXED_INTF(0x0b3c, 0xc000, 4)}, /* Olivetti Olicard 100 */ {QMI_FIXED_INTF(0x0b3c, 0xc001, 4)}, /* Olivetti Olicard 120 */ {QMI_FIXED_INTF(0x0b3c, 0xc002, 4)}, /* Olivetti Olicard 140 */
fs/btrfs/file.c +12 -4
@@ -756,8 +756,16 @@ next_slot: }btrfs_item_key_to_cpu (leaf, &key, path->slots[0 ]); -if (key.objectid > ino || - key.type >BTRFS_EXTENT_DATA_KEY || key.offset >= end) + +if (key.objectid > ino) +break ; +if (WARN_ON_ONCE (key.objectid < ino) || + key.type <BTRFS_EXTENT_DATA_KEY ) { +ASSERT (del_nr ==0 ); + path->slots[0 ]++; + goto next_slot; + } +if (key.type >BTRFS_EXTENT_DATA_KEY || key.offset >= end)break ; fi = btrfs_item_ptr(leaf, path->slots[0],
@@ -776,8 +784,8 @@ next_slot:btrfs_file_extent_inline_len (leaf, path->slots[0 ], fi); }else { -WARN_ON (1 ); - extent_end = search_start; +/* can't happen */ +BUG (); }/*
fs/btrfs/inode.c +76 -16
117 lines not on this page · raw message
fs/btrfs/ioctl.c +152 -43
221 lines not on this page · raw message
fs/btrfs/xattr.c +3 -1
@@ -313,8 +313,10 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)/* check to make sure this item is what we want */ if (found_key.objectid != key.objectid)break ; -if (found_key.type !=BTRFS_XATTR_ITEM_KEY ) +if (found_key.type >BTRFS_XATTR_ITEM_KEY )break ; +if (found_key.type <BTRFS_XATTR_ITEM_KEY ) + goto next; di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item);if (verify_dir_item (root, leaf, di))
fs/ceph/mds_client.c +1 -1
@@ -1905,7 +1905,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, len =sizeof (*head) + pathlen1 + pathlen2 +2 *(1 +sizeof (u32) +sizeof (u64)) + -sizeof (struct timespec ); +sizeof (struct ceph_timespec );/* calculate (max) length for cap releases */ len += sizeof(struct ceph_mds_request_release) *
fs/debugfs/inode.c +5 -1
@@ -276,8 +276,12 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)dput (dentry); dentry =ERR_PTR (-EEXIST ); } -if (IS_ERR (dentry)) + +if (IS_ERR (dentry)) {mutex_unlock (&d_inode (parent)->i_mutex); +simple_release_fs (&debugfs_mount, &debugfs_mount_count); + } +return dentry; }
fs/ext4/ext4_jbd2.c +3 -3
@@ -88,13 +88,13 @@ int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle)return 0 ; } + err = handle->h_err;if (!handle->h_transaction) { - err =jbd2_journal_stop (handle); -return handle->h_err ? handle->h_err : err; + rc =jbd2_journal_stop (handle); +return err ? err : rc; } sb = handle->h_transaction->t_journal->j_private; - err = handle->h_err; rc =jbd2_journal_stop (handle);if (!err)
fs/ext4/page-io.c +4 -1
@@ -426,6 +426,7 @@ int ext4_bio_write_page(struct ext4_io_submit *io,struct buffer_head *bh, *head;int ret =0 ;int nr_submitted =0 ; +int nr_to_submit =0 ; blocksize =1 << inode->i_blkbits;
@@ -478,11 +479,13 @@ int ext4_bio_write_page(struct ext4_io_submit *io,unmap_underlying_metadata (bh->b_bdev, bh->b_blocknr); }set_buffer_async_write (bh); + nr_to_submit++; }while ((bh = bh->b_this_page) != head); bh = head =page_buffers (page); -if (ext4_encrypted_inode (inode) &&S_ISREG (inode->i_mode)) { +if (ext4_encrypted_inode (inode) &&S_ISREG (inode->i_mode) && + nr_to_submit) { data_page =ext4_encrypt (inode, page);if (IS_ERR (data_page)) { ret =PTR_ERR (data_page);
fs/ext4/super.c +10 -2
@@ -396,9 +396,13 @@ static void ext4_handle_error(struct super_block *sb)smp_wmb (); sb->s_flags |=MS_RDONLY ; } -if (test_opt (sb,ERRORS_PANIC )) +if (test_opt (sb,ERRORS_PANIC )) { +if (EXT4_SB (sb)->s_journal && + !(EXT4_SB (sb)->s_journal->j_flags &JBD2_REC_ERR )) +return ;panic ("EXT4-fs (device %s): panic forced after error\n" , sb->s_id); + } }#define ext4_error_ratelimit (sb) \
@@ -587,8 +591,12 @@ void __ext4_abort(struct super_block *sb, const char *function,jbd2_journal_abort (EXT4_SB (sb)->s_journal, -EIO );save_error_info (sb, function, line); } -if (test_opt (sb,ERRORS_PANIC )) +if (test_opt (sb,ERRORS_PANIC )) { +if (EXT4_SB (sb)->s_journal && + !(EXT4_SB (sb)->s_journal->j_flags &JBD2_REC_ERR )) +return ;panic ("EXT4-fs panic from previous error\n" ); + } } void __ext4_msg(struct super_block *sb,
fs/jbd2/journal.c +5 -1
@@ -2086,8 +2086,12 @@ static void __journal_abort_soft (journal_t *journal, int errno)__jbd2_journal_abort_hard (journal); -if (errno) +if (errno) {jbd2_journal_update_sb_errno (journal); +write_lock (&journal->j_state_lock); + journal->j_flags |=JBD2_REC_ERR ; +write_unlock (&journal->j_state_lock); + } }/**
fs/nfs/inode.c +5 -1
@@ -1813,7 +1813,11 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)if ((long )fattr->gencount - (long )nfsi->attr_gencount >0 ) nfsi->attr_gencount = fattr->gencount; } - invalid &= ~NFS_INO_INVALID_ATTR ; + +/* Don't declare attrcache up to date if there were no attrs! */ +if (fattr->valid !=0 ) + invalid &= ~NFS_INO_INVALID_ATTR ; +/* Don't invalidate the data if we were to blame */ if (!(S_ISREG (inode->i_mode) ||S_ISDIR (inode->i_mode) ||S_ISLNK (inode->i_mode)))
fs/nfs/nfs4client.c +1 -1
@@ -33,7 +33,7 @@ static int nfs_get_cb_ident_idr(struct nfs_client *clp, int minorversion)return ret;idr_preload (GFP_KERNEL );spin_lock (&nn->nfs_client_lock); - ret =idr_alloc (&nn->cb_ident_idr, clp,0 ,0 ,GFP_NOWAIT ); + ret =idr_alloc (&nn->cb_ident_idr, clp,1 ,0 ,GFP_NOWAIT );if (ret >=0 ) clp->cl_cb_ident = ret;spin_unlock (&nn->nfs_client_lock);
fs/nfsd/nfs4state.c +112 -15
261 lines not on this page · raw message
fs/nfsd/state.h +10 -9
@@ -533,15 +533,16 @@ struct nfs4_file {* Better suggestions welcome. */ struct nfs4_ol_stateid { -struct nfs4_stid st_stid;/* must be first field */ -struct list_head st_perfile; -struct list_head st_perstateowner; -struct list_head st_locks; -struct nfs4_stateowner * st_stateowner; -struct nfs4_clnt_odstate * st_clnt_odstate; -unsigned char st_access_bmap; -unsigned char st_deny_bmap; -struct nfs4_ol_stateid * st_openstp; +struct nfs4_stid st_stid; +struct list_head st_perfile; +struct list_head st_perstateowner; +struct list_head st_locks; +struct nfs4_stateowner *st_stateowner; +struct nfs4_clnt_odstate *st_clnt_odstate; +unsigned char st_access_bmap; +unsigned char st_deny_bmap; +struct nfs4_ol_stateid *st_openstp; +struct rw_semaphore st_rwsem; };static inline struct nfs4_ol_stateid *openlockstateid (struct nfs4_stid *s)
fs/ocfs2/namei.c +2 -0
@@ -365,6 +365,8 @@ static int ocfs2_mknod(struct inode *dir,mlog_errno (status); goto leave; } +/* update inode->i_mode after mask with "umask". */ + inode->i_mode = mode; handle = ocfs2_start_trans(osb, ocfs2_mknod_credits(osb->sb, S_ISDIR(mode),
include/linux/ipv6.h +1 -1
@@ -224,7 +224,7 @@ struct ipv6_pinfo {struct ipv6_ac_socklist *ipv6_ac_list;struct ipv6_fl_socklist __rcu *ipv6_fl_list; -struct ipv6_txoptions *opt; +struct ipv6_txoptions __rcu *opt;struct sk_buff *pktoptions;struct sk_buff *rxpmtu;struct inet6_cork cork;
include/linux/jbd2.h +1 -0
@@ -1007,6 +1007,7 @@ struct journal_s#define JBD2_ABORT_ON_SYNCDATA_ERR 0x040/* Abort the journal on file * data write error in ordered * mode */ +#define JBD2_REC_ERR 0x080/* The errno in the sb has been recorded */ /* * Function declarations for the journaling transaction and buffer
include/net/af_unix.h +1 -0
@@ -63,6 +63,7 @@ struct unix_sock {#define UNIX_GC_CANDIDATE 0#define UNIX_GC_MAYBE_CYCLE 1struct socket_wq peer_wq; +wait_queue_t peer_wake; };static inline struct unix_sock *unix_sk (struct sock *sk)
include/net/ip6_tunnel.h +2 -1
@@ -83,11 +83,12 @@ static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb, err =ip6_local_out_sk (sk, skb);if (net_xmit_eval (err) ==0 ) { -struct pcpu_sw_netstats *tstats =this_cpu_ptr (dev->tstats); +struct pcpu_sw_netstats *tstats =get_cpu_ptr (dev->tstats);u64_stats_update_begin (&tstats->syncp); tstats->tx_bytes += pkt_len; tstats->tx_packets++;u64_stats_update_end (&tstats->syncp); +put_cpu_ptr (tstats); }else { stats->tx_errors++; stats->tx_aborted_errors++;
include/net/ip_tunnels.h +2 -1
@@ -207,12 +207,13 @@ static inline void iptunnel_xmit_stats(int err, struct pcpu_sw_netstats __percpu *stats) {if (err >0 ) { -struct pcpu_sw_netstats *tstats =this_cpu_ptr (stats); +struct pcpu_sw_netstats *tstats =get_cpu_ptr (stats);u64_stats_update_begin (&tstats->syncp); tstats->tx_bytes += err; tstats->tx_packets++;u64_stats_update_end (&tstats->syncp); +put_cpu_ptr (tstats); }else if (err <0 ) { err_stats->tx_errors++; err_stats->tx_aborted_errors++;
include/net/ipv6.h +21 -1
@@ -205,6 +205,7 @@ extern rwlock_t ip6_ra_lock;*/ struct ipv6_txoptions { +atomic_t refcnt;/* Length of this structure */ int tot_len;
@@ -217,7 +218,7 @@ struct ipv6_txoptions {struct ipv6_opt_hdr *dst0opt;struct ipv6_rt_hdr *srcrt;/* Routing Header */ struct ipv6_opt_hdr *dst1opt; - +struct rcu_head rcu;/* Option buffer, as read by IPV6_PKTOPTIONS, starts here. */ };
@@ -250,6 +251,24 @@ struct ipv6_fl_socklist {struct rcu_head rcu; }; +static inline struct ipv6_txoptions *txopt_get (const struct ipv6_pinfo *np) +{ +struct ipv6_txoptions *opt; + +rcu_read_lock (); + opt =rcu_dereference (np->opt); +if (opt && !atomic_inc_not_zero (&opt->refcnt)) + opt =NULL ; +rcu_read_unlock (); +return opt; +} + +static inline void txopt_put (struct ipv6_txoptions *opt) +{ +if (opt &&atomic_dec_and_test (&opt->refcnt)) +kfree_rcu (opt, rcu); +} +struct ip6_flowlabel *fl6_sock_lookup (struct sock *sk,__be32 label); struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space, struct ip6_flowlabel *fl,
@@ -488,6 +507,7 @@ struct ip6_create_arg {u32 user;const struct in6_addr *src;const struct in6_addr *dst; +int iif;u8 ecn; };
include/net/sch_generic.h +3 -0
@@ -61,6 +61,9 @@ struct Qdisc {*/ #define TCQ_F_WARN_NONWC (1 << 16)#define TCQ_F_CPUSTATS 0x20/* run using percpu statistics */ +#define TCQ_F_NOPARENT 0x40/* root of its hierarchy : +* qdisc_tree_decrease_qlen() should stop. +*/ u32 limit;const struct Qdisc_ops *ops;struct qdisc_size_table __rcu *stab;
kernel/bpf/arraymap.c +1 -1
@@ -109,7 +109,7 @@ static int array_map_update_elem(struct bpf_map *map, void *key, void *value,/* all elements already exist */ return -EEXIST ; -memcpy (array->value + array->elem_size * index, value, array->elem_size); +memcpy (array->value + array->elem_size * index, value, map->value_size);return 0 ; }
net/core/neighbour.c +2 -2
@@ -2207,7 +2207,7 @@ static int pneigh_fill_info(struct sk_buff *skb, struct pneigh_entry *pn, ndm->ndm_pad2 =0 ; ndm->ndm_flags = pn->flags |NTF_PROXY ; ndm->ndm_type =RTN_UNICAST ; - ndm->ndm_ifindex = pn->dev->ifindex; + ndm->ndm_ifindex = pn->dev ? pn->dev->ifindex :0 ; ndm->ndm_state =NUD_NONE ;if (nla_put (skb,NDA_DST , tbl->key_len, pn->key))
@@ -2282,7 +2282,7 @@ static int pneigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,if (h > s_h) s_idx =0 ;for (n = tbl->phash_buckets[h], idx =0 ; n; n = n->next) { -if (dev_net (n->dev) != net) +if (pneigh_net (n) != net)continue ;if (idx < s_idx) goto next;
net/core/scm.c +2 -0
@@ -305,6 +305,8 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) err =put_user (cmlen, &cm->cmsg_len);if (!err) { cmlen =CMSG_SPACE (i*sizeof (int )); +if (msg->msg_controllen < cmlen) + cmlen = msg->msg_controllen; msg->msg_control += cmlen; msg->msg_controllen -= cmlen; }
net/dccp/ipv6.c +21 -12
@@ -202,7 +202,9 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req)security_req_classify_flow (req,flowi6_to_flowi (&fl6)); - final_p =fl6_update_dst (&fl6, np->opt, &final); +rcu_read_lock (); + final_p =fl6_update_dst (&fl6,rcu_dereference (np->opt), &final); +rcu_read_unlock (); dst =ip6_dst_lookup_flow (sk, &fl6, final_p);if (IS_ERR (dst)) {
@@ -219,7 +221,10 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req) &ireq->ir_v6_loc_addr, &ireq->ir_v6_rmt_addr); fl6.daddr = ireq->ir_v6_rmt_addr; - err =ip6_xmit (sk, skb, &fl6, np->opt, np->tclass); +rcu_read_lock (); + err =ip6_xmit (sk, skb, &fl6,rcu_dereference (np->opt), + np->tclass); +rcu_read_unlock (); err =net_xmit_eval (err); }
@@ -415,6 +420,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, {struct inet_request_sock *ireq =inet_rsk (req);struct ipv6_pinfo *newnp, *np =inet6_sk (sk); +struct ipv6_txoptions *opt;struct inet_sock *newinet;struct dccp6_sock *newdp6;struct sock *newsk;
@@ -534,13 +540,15 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,* Yes, keeping reference count would be much more clever, but we make * one more one thing there: reattach optmem to newsk. */ -if (np->opt !=NULL ) - newnp->opt =ipv6_dup_options (newsk, np->opt); - + opt =rcu_dereference (np->opt); +if (opt) { + opt =ipv6_dup_options (newsk, opt); +RCU_INIT_POINTER (newnp->opt, opt); + }inet_csk (newsk)->icsk_ext_hdr_len =0 ; -if (newnp->opt !=NULL ) -inet_csk (newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen + - newnp->opt->opt_flen); +if (opt) +inet_csk (newsk)->icsk_ext_hdr_len = opt->opt_nflen + + opt->opt_flen;dccp_sync_mss (newsk,dst_mtu (dst));
@@ -793,6 +801,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,struct ipv6_pinfo *np =inet6_sk (sk);struct dccp_sock *dp =dccp_sk (sk);struct in6_addr *saddr =NULL , *final_p, final; +struct ipv6_txoptions *opt;struct flowi6 fl6;struct dst_entry *dst;int addr_type;
@@ -892,7 +901,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr, fl6.fl6_sport = inet->inet_sport;security_sk_classify_flow (sk,flowi6_to_flowi (&fl6)); - final_p =fl6_update_dst (&fl6, np->opt, &final); + opt =rcu_dereference_protected (np->opt,sock_owned_by_user (sk)); + final_p =fl6_update_dst (&fl6, opt, &final); dst =ip6_dst_lookup_flow (sk, &fl6, final_p);if (IS_ERR (dst)) {
@@ -912,9 +922,8 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,__ip6_dst_store (sk, dst,NULL ,NULL ); icsk->icsk_ext_hdr_len =0 ; -if (np->opt !=NULL ) - icsk->icsk_ext_hdr_len = (np->opt->opt_flen + - np->opt->opt_nflen); +if (opt) + icsk->icsk_ext_hdr_len = opt->opt_flen + opt->opt_nflen; inet->inet_dport = usin->sin6_port;
net/ipv4/ipmr.c +8 -7
@@ -134,7 +134,7 @@ static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm);static void mroute_netlink_event (struct mr_table *mrt,struct mfc_cache *mfc,int cmd); -static void mroute_clean_tables (struct mr_table *mrt); +static void mroute_clean_tables (struct mr_table *mrt,bool all);static void ipmr_expire_process (unsigned long arg);#ifdef CONFIG_IP_MROUTE_MULTIPLE_TABLES
@@ -351,7 +351,7 @@ static struct mr_table *ipmr_new_table(struct net *net, u32 id)static void ipmr_free_table (struct mr_table *mrt) {del_timer_sync (&mrt->ipmr_expire_timer); -mroute_clean_tables (mrt); +mroute_clean_tables (mrt, true);kfree (mrt); }
@@ -1209,7 +1209,7 @@ static int ipmr_mfc_add(struct net *net, struct mr_table *mrt,* Close the multicast socket, and clear the vif tables etc */ -static void mroute_clean_tables (struct mr_table *mrt) +static void mroute_clean_tables (struct mr_table *mrt,bool all) {int i;LIST_HEAD (list);
@@ -1218,8 +1218,9 @@ static void mroute_clean_tables(struct mr_table *mrt)/* Shut down all active vif entries */ for (i =0 ; i < mrt->maxvif; i++) { -if (!(mrt->vif_table[i].flags &VIFF_STATIC )) -vif_delete (mrt, i,0 , &list); +if (!all && (mrt->vif_table[i].flags &VIFF_STATIC )) +continue ; +vif_delete (mrt, i,0 , &list); }unregister_netdevice_many (&list);
@@ -1227,7 +1228,7 @@ static void mroute_clean_tables(struct mr_table *mrt)for (i =0 ; i <MFC_LINES ; i++) {list_for_each_entry_safe (c, next, &mrt->mfc_cache_array[i], list) { -if (c->mfc_flags &MFC_STATIC ) +if (!all && (c->mfc_flags &MFC_STATIC ))continue ;list_del_rcu (&c->list);mroute_netlink_event (mrt, c,RTM_DELROUTE );
@@ -1262,7 +1263,7 @@ static void mrtsock_destruct(struct sock *sk)NETCONFA_IFINDEX_ALL , net->ipv4.devconf_all);RCU_INIT_POINTER (mrt->mroute_sk,NULL ); -mroute_clean_tables (mrt); +mroute_clean_tables (mrt, false); } }rtnl_unlock ();
net/ipv4/tcp_input.c +20 -3
@@ -4438,19 +4438,34 @@ static int __must_check tcp_queue_rcv(struct sock *sk, struct sk_buff *skb, intint tcp_send_rcvq (struct sock *sk,struct msghdr *msg,size_t size) {struct sk_buff *skb; +int err = -ENOMEM ; +int data_len =0 ;bool fragstolen;if (size ==0 )return 0 ; - skb =alloc_skb (size, sk->sk_allocation); +if (size >PAGE_SIZE ) { +int npages =min_t (size_t, size >>PAGE_SHIFT ,MAX_SKB_FRAGS ); + + data_len = npages <<PAGE_SHIFT ; + size = data_len + (size & ~PAGE_MASK ); + } + skb =alloc_skb_with_frags (size - data_len, data_len, +PAGE_ALLOC_COSTLY_ORDER , + &err, sk->sk_allocation);if (!skb) goto err; +skb_put (skb, size - data_len); + skb->data_len = data_len; + skb->len = size; +if (tcp_try_rmem_schedule (sk, skb, skb->truesize)) goto err_free; -if (memcpy_from_msg (skb_put (skb, size), msg, size)) + err =skb_copy_datagram_from_iter (skb,0 , &msg->msg_iter, size); +if (err) goto err_free;TCP_SKB_CB (skb)->seq =tcp_sk (sk)->rcv_nxt;
@@ -4466,7 +4481,8 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size) err_free:kfree_skb (skb); err: -return -ENOMEM ; +return err; + }static void tcp_data_queue (struct sock *sk,struct sk_buff *skb)
@@ -5622,6 +5638,7 @@ discard: } tp->rcv_nxt =TCP_SKB_CB (skb)->seq +1 ; + tp->copied_seq = tp->rcv_nxt; tp->rcv_wup =TCP_SKB_CB (skb)->seq +1 ;/* RFC1323: The window in SYN & SYN/ACK segments is
net/ipv4/tcp_ipv4.c +2 -1
@@ -922,7 +922,8 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, } md5sig =rcu_dereference_protected (tp->md5sig_info, -sock_owned_by_user (sk)); +sock_owned_by_user (sk) || +lockdep_is_held (&sk->sk_lock.slock));if (!md5sig) { md5sig =kmalloc (sizeof (*md5sig), gfp);if (!md5sig)
net/ipv4/tcp_timer.c +12 -0
@@ -176,6 +176,18 @@ static int tcp_write_timeout(struct sock *sk) syn_set = true; }else {if (retransmits_timed_out (sk, sysctl_tcp_retries1,0 ,0 )) { +/* Some middle-boxes may black-hole Fast Open _after_ +* the handshake. Therefore we conservatively disable +* Fast Open on this path on recurring timeouts with +* few or zero bytes acked after Fast Open. +*/ +if (tp->syn_data_acked && + tp->bytes_acked <= tp->rx_opt.mss_clamp) { +tcp_fastopen_cache_set (sk,0 ,NULL , true,0 ); +if (icsk->icsk_retransmits == sysctl_tcp_retries1) +NET_INC_STATS_BH (sock_net (sk), +LINUX_MIB_TCPFASTOPENACTIVEFAIL ); + }/* Black hole detection */ tcp_mtu_probing (icsk, sk);
net/ipv6/af_inet6.c +9 -4
@@ -425,9 +425,11 @@ void inet6_destroy_sock(struct sock *sk)/* Free tx options */ - opt =xchg (&np->opt,NULL ); -if (opt) -sock_kfree_s (sk, opt, opt->tot_len); + opt =xchg ((__force struct ipv6_txoptions **)&np->opt,NULL ); +if (opt) { +atomic_sub (opt->tot_len, &sk->sk_omem_alloc); +txopt_put (opt); + } }EXPORT_SYMBOL_GPL (inet6_destroy_sock);
@@ -656,7 +658,10 @@ int inet6_sk_rebuild_header(struct sock *sk) fl6.fl6_sport = inet->inet_sport;security_sk_classify_flow (sk,flowi6_to_flowi (&fl6)); - final_p =fl6_update_dst (&fl6, np->opt, &final); +rcu_read_lock (); + final_p =fl6_update_dst (&fl6,rcu_dereference (np->opt), + &final); +rcu_read_unlock (); dst =ip6_dst_lookup_flow (sk, &fl6, final_p);if (IS_ERR (dst)) {
net/ipv6/datagram.c +3 -1
@@ -167,8 +167,10 @@ ipv4_connected:security_sk_classify_flow (sk,flowi6_to_flowi (&fl6)); - opt = flowlabel ? flowlabel->opt : np->opt; +rcu_read_lock (); + opt = flowlabel ? flowlabel->opt :rcu_dereference (np->opt); final_p =fl6_update_dst (&fl6, opt, &final); +rcu_read_unlock (); dst =ip6_dst_lookup_flow (sk, &fl6, final_p); err =0 ;
net/ipv6/exthdrs.c +2 -1
@@ -727,6 +727,7 @@ ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt) *((char **)&opt2->dst1opt) += dif;if (opt2->srcrt) *((char **)&opt2->srcrt) += dif; +atomic_set (&opt2->refcnt,1 ); }return opt2; }
@@ -790,7 +791,7 @@ ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,return ERR_PTR (-ENOBUFS );memset (opt2,0 , tot_len); - +atomic_set (&opt2->refcnt,1 ); opt2->tot_len = tot_len; p = (char *)(opt2 +1 );
net/ipv6/inet6_connection_sock.c +8 -3
@@ -77,7 +77,9 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk,memset (fl6,0 ,sizeof (*fl6)); fl6->flowi6_proto =IPPROTO_TCP ; fl6->daddr = ireq->ir_v6_rmt_addr; - final_p =fl6_update_dst (fl6, np->opt, &final); +rcu_read_lock (); + final_p =fl6_update_dst (fl6,rcu_dereference (np->opt), &final); +rcu_read_unlock (); fl6->saddr = ireq->ir_v6_loc_addr; fl6->flowi6_oif = ireq->ir_iif; fl6->flowi6_mark = ireq->ir_mark;
@@ -207,7 +209,9 @@ static struct dst_entry *inet6_csk_route_socket(struct sock *sk, fl6->fl6_dport = inet->inet_dport;security_sk_classify_flow (sk,flowi6_to_flowi (fl6)); - final_p =fl6_update_dst (fl6, np->opt, &final); +rcu_read_lock (); + final_p =fl6_update_dst (fl6,rcu_dereference (np->opt), &final); +rcu_read_unlock (); dst =__inet6_csk_dst_check (sk, np->dst_cookie);if (!dst) {
@@ -240,7 +244,8 @@ int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused/* Restore final destination back after routing done */ fl6.daddr = sk->sk_v6_daddr; - res =ip6_xmit (sk, skb, &fl6, np->opt, np->tclass); + res =ip6_xmit (sk, skb, &fl6,rcu_dereference (np->opt), + np->tclass);rcu_read_unlock ();return res; }
net/ipv6/ip6mr.c +8 -7
@@ -118,7 +118,7 @@ static void mr6_netlink_event(struct mr6_table *mrt, struct mfc6_cache *mfc, int cmd);static int ip6mr_rtm_dumproute (struct sk_buff *skb,struct netlink_callback *cb); -static void mroute_clean_tables (struct mr6_table *mrt); +static void mroute_clean_tables (struct mr6_table *mrt,bool all);static void ipmr_expire_process (unsigned long arg);#ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES
@@ -335,7 +335,7 @@ static struct mr6_table *ip6mr_new_table(struct net *net, u32 id)static void ip6mr_free_table (struct mr6_table *mrt) {del_timer_sync (&mrt->ipmr_expire_timer); -mroute_clean_tables (mrt); +mroute_clean_tables (mrt, true);kfree (mrt); }
@@ -1543,7 +1543,7 @@ static int ip6mr_mfc_add(struct net *net, struct mr6_table *mrt,* Close the multicast socket, and clear the vif tables etc */ -static void mroute_clean_tables (struct mr6_table *mrt) +static void mroute_clean_tables (struct mr6_table *mrt,bool all) {int i;LIST_HEAD (list);
@@ -1553,8 +1553,9 @@ static void mroute_clean_tables(struct mr6_table *mrt)* Shut down all active vif entries */ for (i =0 ; i < mrt->maxvif; i++) { -if (!(mrt->vif6_table[i].flags &VIFF_STATIC )) -mif6_delete (mrt, i, &list); +if (!all && (mrt->vif6_table[i].flags &VIFF_STATIC )) +continue ; +mif6_delete (mrt, i, &list); }unregister_netdevice_many (&list);
@@ -1563,7 +1564,7 @@ static void mroute_clean_tables(struct mr6_table *mrt)*/ for (i =0 ; i <MFC6_LINES ; i++) {list_for_each_entry_safe (c, next, &mrt->mfc6_cache_array[i], list) { -if (c->mfc_flags &MFC_STATIC ) +if (!all && (c->mfc_flags &MFC_STATIC ))continue ;write_lock_bh (&mrt_lock);list_del (&c->list);
@@ -1626,7 +1627,7 @@ int ip6mr_sk_done(struct sock *sk) net->ipv6.devconf_all);write_unlock_bh (&mrt_lock); -mroute_clean_tables (mrt); +mroute_clean_tables (mrt, false); err =0 ;break ; }
net/ipv6/ipv6_sockglue.c +22 -11
@@ -111,7 +111,8 @@ struct ipv6_txoptions *ipv6_update_options(struct sock *sk, icsk->icsk_sync_mss (sk, icsk->icsk_pmtu_cookie); } } - opt =xchg (&inet6_sk (sk)->opt, opt); + opt =xchg ((__force struct ipv6_txoptions **)&inet6_sk (sk)->opt, + opt);sk_dst_reset (sk);return opt;
@@ -231,9 +232,12 @@ 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 (&np->opt,NULL ); -if (opt) -sock_kfree_s (sk, opt, opt->tot_len); + 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);
@@ -403,7 +407,8 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,if (optname !=IPV6_RTHDR && !ns_capable (net->user_ns,CAP_NET_RAW ))break ; - opt =ipv6_renew_options (sk, np->opt, optname, + opt =rcu_dereference_protected (np->opt,sock_owned_by_user (sk)); + opt =ipv6_renew_options (sk, opt, optname, (struct ipv6_opt_hdr __user *)optval, optlen);if (IS_ERR (opt)) {
@@ -432,8 +437,10 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, retv =0 ; opt =ipv6_update_options (sk, opt); sticky_done: -if (opt) -sock_kfree_s (sk, opt, opt->tot_len); +if (opt) { +atomic_sub (opt->tot_len, &sk->sk_omem_alloc); +txopt_put (opt); + }break ; }
@@ -486,6 +493,7 @@ sticky_done:break ;memset (opt,0 ,sizeof (*opt)); +atomic_set (&opt->refcnt,1 ); opt->tot_len =sizeof (*opt) + optlen; retv = -EFAULT ;if (copy_from_user (opt+1 , optval, optlen))
@@ -502,8 +510,10 @@ update: retv =0 ; opt =ipv6_update_options (sk, opt); done: -if (opt) -sock_kfree_s (sk, opt, opt->tot_len); +if (opt) { +atomic_sub (opt->tot_len, &sk->sk_omem_alloc); +txopt_put (opt); + }break ; }case IPV6_UNICAST_HOPS :
@@ -1110,10 +1120,11 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,case IPV6_RTHDR :case IPV6_DSTOPTS : { +struct ipv6_txoptions *opt;lock_sock (sk); - len =ipv6_getsockopt_sticky (sk, np->opt, - optname, optval, len); + opt =rcu_dereference_protected (np->opt,sock_owned_by_user (sk)); + len =ipv6_getsockopt_sticky (sk, opt, optname, optval, len);release_sock (sk);/* check if ipv6_getsockopt_sticky() returns err code */ if (len <0 )
net/ipv6/mcast.c +0 -2
@@ -1651,7 +1651,6 @@ out:if (!err) {ICMP6MSGOUT_INC_STATS (net, idev,ICMPV6_MLD2_REPORT );ICMP6_INC_STATS (net, idev,ICMP6_MIB_OUTMSGS ); -IP6_UPD_PO_STATS (net, idev,IPSTATS_MIB_OUTMCAST , payload_len); }else {IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTDISCARDS ); }
@@ -2014,7 +2013,6 @@ out:if (!err) {ICMP6MSGOUT_INC_STATS (net, idev, type);ICMP6_INC_STATS (net, idev,ICMP6_MIB_OUTMSGS ); -IP6_UPD_PO_STATS (net, idev,IPSTATS_MIB_OUTMCAST , full_len); }else IP6_INC_STATS (net, idev,IPSTATS_MIB_OUTDISCARDS );
net/ipv6/netfilter/nf_conntrack_reasm.c +3 -2
@@ -190,7 +190,7 @@ static void nf_ct_frag6_expire(unsigned long data)/* Creation primitives. */ static inline struct frag_queue *fq_find (struct net *net,__be32 id,u32 user,struct in6_addr *src, -struct in6_addr *dst,u8 ecn) +struct in6_addr *dst,int iif,u8 ecn) {struct inet_frag_queue *q;struct ip6_create_arg arg;
@@ -200,6 +200,7 @@ static inline struct frag_queue *fq_find(struct net *net, __be32 id, arg.user = user; arg.src = src; arg.dst = dst; + arg.iif = iif; arg.ecn = ecn;local_bh_disable ();
@@ -603,7 +604,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user) fhdr = (struct frag_hdr *)skb_transport_header (clone); fq =fq_find (net, fhdr->identification, user, &hdr->saddr, &hdr->daddr, -ip6_frag_ecn (hdr)); + skb->dev ? skb->dev->ifindex :0 ,ip6_frag_ecn (hdr));if (fq ==NULL ) {pr_debug ("Can't find and can't create new queue\n" ); goto ret_orig;
net/ipv6/raw.c +6 -2
@@ -731,6 +731,7 @@ static int raw6_getfrag(void *from, char *to, int offset, int len, int odd,static int rawv6_sendmsg (struct sock *sk,struct msghdr *msg,size_t len) { +struct ipv6_txoptions *opt_to_free =NULL ;struct ipv6_txoptions opt_space; DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name);struct in6_addr *daddr, *final_p, final;
@@ -837,8 +838,10 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)if (!(opt->opt_nflen|opt->opt_flen)) opt =NULL ; } -if (!opt) - opt = np->opt; +if (!opt) { + opt =txopt_get (np); + opt_to_free = opt; + }if (flowlabel) opt =fl6_merge_options (&opt_space, flowlabel, opt); opt =ipv6_fixup_options (&opt_space, opt);
@@ -901,6 +904,7 @@ done:dst_release (dst); out:fl6_sock_release (flowlabel); +txopt_put (opt_to_free);return err <0 ? err : len; do_confirm:dst_confirm (dst);
net/ipv6/reassembly.c +7 -3
@@ -108,7 +108,10 @@ bool ip6_frag_match(const struct inet_frag_queue *q, const void *a)return fq->id == arg->id && fq->user == arg->user &&ipv6_addr_equal (&fq->saddr, arg->src) && -ipv6_addr_equal (&fq->daddr, arg->dst); +ipv6_addr_equal (&fq->daddr, arg->dst) && + (arg->iif == fq->iif || + !(ipv6_addr_type (arg->dst) & (IPV6_ADDR_MULTICAST | +IPV6_ADDR_LINKLOCAL ))); }EXPORT_SYMBOL (ip6_frag_match);
@@ -180,7 +183,7 @@ static void ip6_frag_expire(unsigned long data)static struct frag_queue *fq_find (struct net *net,__be32 id,const struct in6_addr *src, -const struct in6_addr *dst,u8 ecn) +const struct in6_addr *dst,int iif,u8 ecn) {struct inet_frag_queue *q;struct ip6_create_arg arg;
@@ -190,6 +193,7 @@ fq_find(struct net *net, __be32 id, const struct in6_addr *src, arg.user =IP6_DEFRAG_LOCAL_DELIVER ; arg.src = src; arg.dst = dst; + arg.iif = iif; arg.ecn = ecn; hash =inet6_hash_frag (id, src, dst);
@@ -551,7 +555,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) } fq =fq_find (net, fhdr->identification, &hdr->saddr, &hdr->daddr, -ip6_frag_ecn (hdr)); + skb->dev ? skb->dev->ifindex :0 ,ip6_frag_ecn (hdr));if (fq) {int ret;
net/ipv6/syncookies.c +1 -1
@@ -242,7 +242,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)memset (&fl6,0 ,sizeof (fl6)); fl6.flowi6_proto =IPPROTO_TCP ; fl6.daddr = ireq->ir_v6_rmt_addr; - final_p =fl6_update_dst (&fl6, np->opt, &final); + final_p =fl6_update_dst (&fl6,rcu_dereference (np->opt), &final); fl6.saddr = ireq->ir_v6_loc_addr; fl6.flowi6_oif = sk->sk_bound_dev_if; fl6.flowi6_mark = ireq->ir_mark;
net/ipv6/tcp_ipv6.c +17 -11
@@ -121,6 +121,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,struct ipv6_pinfo *np =inet6_sk (sk);struct tcp_sock *tp =tcp_sk (sk);struct in6_addr *saddr =NULL , *final_p, final; +struct ipv6_txoptions *opt;struct rt6_info *rt;struct flowi6 fl6;struct dst_entry *dst;
@@ -237,7 +238,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, fl6.fl6_dport = usin->sin6_port; fl6.fl6_sport = inet->inet_sport; - final_p =fl6_update_dst (&fl6, np->opt, &final); + opt =rcu_dereference_protected (np->opt,sock_owned_by_user (sk)); + final_p =fl6_update_dst (&fl6, opt, &final);security_sk_classify_flow (sk,flowi6_to_flowi (&fl6));
@@ -266,9 +268,9 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr,tcp_fetch_timewait_stamp (sk, dst); icsk->icsk_ext_hdr_len =0 ; -if (np->opt) - icsk->icsk_ext_hdr_len = (np->opt->opt_flen + - np->opt->opt_nflen); +if (opt) + icsk->icsk_ext_hdr_len = opt->opt_flen + + opt->opt_nflen; tp->rx_opt.mss_clamp =IPV6_MIN_MTU -sizeof (struct tcphdr ) -sizeof (struct ipv6hdr );
@@ -464,7 +466,8 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst, fl6->flowlabel =ip6_flowlabel (ipv6_hdr (ireq->pktopts));skb_set_queue_mapping (skb, queue_mapping); - err =ip6_xmit (sk, skb, fl6, np->opt, np->tclass); + err =ip6_xmit (sk, skb, fl6,rcu_dereference (np->opt), + np->tclass); err =net_xmit_eval (err); }
@@ -994,6 +997,7 @@ static struct sock *tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,struct inet_request_sock *ireq;struct ipv6_pinfo *newnp, *np =inet6_sk (sk);struct tcp6_sock *newtcp6sk; +struct ipv6_txoptions *opt;struct inet_sock *newinet;struct tcp_sock *newtp;struct sock *newsk;
@@ -1129,13 +1133,15 @@ static struct sock *tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,but we make one more one thing there: reattach optmem to newsk. */ -if (np->opt) - newnp->opt =ipv6_dup_options (newsk, np->opt); - + opt =rcu_dereference (np->opt); +if (opt) { + opt =ipv6_dup_options (newsk, opt); +RCU_INIT_POINTER (newnp->opt, opt); + }inet_csk (newsk)->icsk_ext_hdr_len =0 ; -if (newnp->opt) -inet_csk (newsk)->icsk_ext_hdr_len = (newnp->opt->opt_nflen + - newnp->opt->opt_flen); +if (opt) +inet_csk (newsk)->icsk_ext_hdr_len = opt->opt_nflen + + opt->opt_flen;tcp_ca_openreq_child (newsk, dst);
net/ipv6/udp.c +6 -2
@@ -1107,6 +1107,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name);struct in6_addr *daddr, *final_p, final;struct ipv6_txoptions *opt =NULL ; +struct ipv6_txoptions *opt_to_free =NULL ;struct ip6_flowlabel *flowlabel =NULL ;struct flowi6 fl6;struct dst_entry *dst;
@@ -1260,8 +1261,10 @@ do_udp_sendmsg: opt =NULL ; connected =0 ; } -if (!opt) - opt = np->opt; +if (!opt) { + opt =txopt_get (np); + opt_to_free = opt; + }if (flowlabel) opt =fl6_merge_options (&opt_space, flowlabel, opt); opt =ipv6_fixup_options (&opt_space, opt);
@@ -1370,6 +1373,7 @@ release_dst: out:dst_release (dst);fl6_sock_release (flowlabel); +txopt_put (opt_to_free);if (!err)return len;/*
net/l2tp/l2tp_ip6.c +6 -2
@@ -486,6 +486,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) DECLARE_SOCKADDR(struct sockaddr_l2tpip6 *, lsa, msg->msg_name);struct in6_addr *daddr, *final_p, final;struct ipv6_pinfo *np =inet6_sk (sk); +struct ipv6_txoptions *opt_to_free =NULL ;struct ipv6_txoptions *opt =NULL ;struct ip6_flowlabel *flowlabel =NULL ;struct dst_entry *dst =NULL ;
@@ -575,8 +576,10 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) opt =NULL ; } -if (opt ==NULL ) - opt = np->opt; +if (!opt) { + opt =txopt_get (np); + opt_to_free = opt; + }if (flowlabel) opt =fl6_merge_options (&opt_space, flowlabel, opt); opt =ipv6_fixup_options (&opt_space, opt);
@@ -631,6 +634,7 @@ done:dst_release (dst); out:fl6_sock_release (flowlabel); +txopt_put (opt_to_free);return err <0 ? err : len;
net/packet/af_packet.c +44 -42
150 lines not on this page · raw message
net/rds/connection.c +0 -6
@@ -187,12 +187,6 @@ new_conn: } } -if (trans ==NULL ) { -kmem_cache_free (rds_conn_slab, conn); - conn =ERR_PTR (-ENODEV ); - goto out; - } - conn->c_trans = trans; ret = trans->conn_alloc (conn, gfp);
net/rds/send.c +3 -1
@@ -986,11 +986,13 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)release_sock (sk); } -/* racing with another thread binding seems ok here */ +lock_sock (sk);if (daddr ==0 || rs->rs_bound_addr ==0 ) { +release_sock (sk); ret = -ENOTCONN ;/* XXX not a great errno */ goto out; } +release_sock (sk);/* size of rm including all sgs */ ret =rds_rm_size (msg, payload_len);
net/sched/sch_api.c +18 -9
@@ -253,7 +253,8 @@ int qdisc_set_default(const char *name) }/* We know handle. Find qdisc among all qdisc's attached to device -(root qdisc, all its children, children of children etc.) +* (root qdisc, all its children, children of children etc.) +* Note: caller either uses rtnl or rcu_read_lock() */ static struct Qdisc *qdisc_match_from_root (struct Qdisc *root,u32 handle)
@@ -264,7 +265,7 @@ static struct Qdisc *qdisc_match_from_root(struct Qdisc *root, u32 handle) root->handle == handle)return root; -list_for_each_entry (q, &root->list, list) { +list_for_each_entry_rcu (q, &root->list, list) {if (q->handle == handle)return q; }
@@ -277,15 +278,18 @@ void qdisc_list_add(struct Qdisc *q)struct Qdisc *root =qdisc_dev (q)->qdisc;WARN_ON_ONCE (root == &noop_qdisc); -list_add_tail (&q->list, &root->list); +ASSERT_RTNL (); +list_add_tail_rcu (&q->list, &root->list); } }EXPORT_SYMBOL (qdisc_list_add);void qdisc_list_del (struct Qdisc *q) { -if ((q->parent !=TC_H_ROOT ) && !(q->flags &TCQ_F_INGRESS )) -list_del (&q->list); +if ((q->parent !=TC_H_ROOT ) && !(q->flags &TCQ_F_INGRESS )) { +ASSERT_RTNL (); +list_del_rcu (&q->list); + } }EXPORT_SYMBOL (qdisc_list_del);
@@ -750,14 +754,18 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)if (n ==0 )return ; drops =max_t (int, n,0 ); +rcu_read_lock ();while ((parentid = sch->parent)) {if (TC_H_MAJ (parentid) ==TC_H_MAJ (TC_H_INGRESS )) -return ; +break ; +if (sch->flags &TCQ_F_NOPARENT ) +break ; +/* TODO: perform the search on a per txq basis */ sch =qdisc_lookup (qdisc_dev (sch),TC_H_MAJ (parentid));if (sch ==NULL ) { -WARN_ON (parentid !=TC_H_ROOT ); -return ; +WARN_ON_ONCE (parentid !=TC_H_ROOT ); +break ; } cops = sch->ops->cl_ops;if (cops->qlen_notify) {
@@ -768,6 +776,7 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n) sch->q.qlen -= n;__qdisc_qstats_drop (sch, drops); } +rcu_read_unlock (); }EXPORT_SYMBOL (qdisc_tree_decrease_qlen);
@@ -941,7 +950,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, }lockdep_set_class (qdisc_lock (sch), &qdisc_tx_lock);if (!netif_is_multiqueue (dev)) - sch->flags |=TCQ_F_ONETXQUEUE ; + sch->flags |=TCQ_F_ONETXQUEUE |TCQ_F_NOPARENT ; } sch->handle = handle;
net/sched/sch_generic.c +1 -1
@@ -743,7 +743,7 @@ static void attach_one_default_qdisc(struct net_device *dev,return ; }if (!netif_is_multiqueue (dev)) - qdisc->flags |=TCQ_F_ONETXQUEUE ; + qdisc->flags |=TCQ_F_ONETXQUEUE |TCQ_F_NOPARENT ; } dev_queue->qdisc_sleeping = qdisc; }
net/sched/sch_mq.c +2 -2
@@ -63,7 +63,7 @@ static int mq_init(struct Qdisc *sch, struct nlattr *opt)if (qdisc ==NULL ) goto err; priv->qdiscs[ntx] = qdisc; - qdisc->flags |=TCQ_F_ONETXQUEUE ; + qdisc->flags |=TCQ_F_ONETXQUEUE |TCQ_F_NOPARENT ; } sch->flags |=TCQ_F_MQROOT ;
@@ -156,7 +156,7 @@ static int mq_graft(struct Qdisc *sch, unsigned long cl, struct Qdisc *new, *old =dev_graft_qdisc (dev_queue, new);if (new) - new->flags |=TCQ_F_ONETXQUEUE ; + new->flags |=TCQ_F_ONETXQUEUE |TCQ_F_NOPARENT ;if (dev->flags &IFF_UP )dev_activate (dev);return 0 ;
net/sched/sch_mqprio.c +2 -2
@@ -132,7 +132,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt) goto err; } priv->qdiscs[i] = qdisc; - qdisc->flags |=TCQ_F_ONETXQUEUE ; + qdisc->flags |=TCQ_F_ONETXQUEUE |TCQ_F_NOPARENT ; }/* If the mqprio options indicate that hardware should own
@@ -209,7 +209,7 @@ static int mqprio_graft(struct Qdisc *sch, unsigned long cl, struct Qdisc *new, *old =dev_graft_qdisc (dev_queue, new);if (new) - new->flags |=TCQ_F_ONETXQUEUE ; + new->flags |=TCQ_F_ONETXQUEUE |TCQ_F_NOPARENT ;if (dev->flags &IFF_UP )dev_activate (dev);
net/sctp/auth.c +2 -2
@@ -809,8 +809,8 @@ int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep,if (!has_sha1)return -EINVAL ; -memcpy (ep->auth_hmacs_list->hmac_ids, &hmacs->shmac_idents[0 ], - hmacs->shmac_num_idents *sizeof (__u16)); +for (i =0 ; i < hmacs->shmac_num_idents; i++) + ep->auth_hmacs_list->hmac_ids[i] =htons (hmacs->shmac_idents[i]); ep->auth_hmacs_list->param_hdr.length =htons (sizeof (sctp_paramhdr_t) + hmacs->shmac_num_idents *sizeof (__u16));return 0 ;
net/sctp/socket.c +8 -1
@@ -7387,6 +7387,13 @@ struct proto sctp_prot = {#if IS_ENABLED (CONFIG_IPV6 ) +#include <net/transp_v6.h> +static void sctp_v6_destroy_sock (struct sock *sk) +{ +sctp_destroy_sock (sk); +inet6_destroy_sock (sk); +} +struct proto sctpv6_prot = { .name ="SCTPv6" , .owner = THIS_MODULE,
@@ -7396,7 +7403,7 @@ struct proto sctpv6_prot = { .accept = sctp_accept, .ioctl = sctp_ioctl, .init = sctp_init_sock, - .destroy = sctp_destroy_sock, + .destroy = sctp_v6_destroy_sock, .shutdown = sctp_shutdown, .setsockopt = sctp_setsockopt, .getsockopt = sctp_getsockopt,
net/unix/af_unix.c +164 -19
257 lines not on this page · raw message
sound/pci/hda/patch_hdmi.c +2 -1
@@ -48,8 +48,9 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");#define is_haswell (codec) ((codec)->core.vendor_id == 0x80862807)#define is_broadwell (codec) ((codec)->core.vendor_id == 0x80862808)#define is_skylake (codec) ((codec)->core.vendor_id == 0x80862809) +#define is_broxton (codec) ((codec)->core.vendor_id == 0x8086280a)#define is_haswell_plus (codec) (is_haswell(codec) || is_broadwell(codec) \ - || is_skylake(codec)) + || is_skylake(codec) || is_broxton(codec))#define is_valleyview (codec) ((codec)->core.vendor_id == 0x80862882)#define is_cherryview (codec) ((codec)->core.vendor_id == 0x80862883)
tools/net/Makefile +4 -3
@@ -4,6 +4,9 @@ CC = gcc LEX = flex YACC = bison +CFLAGS += -Wall -O2 +CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include + %.yacc.c: %.y $(YACC) -o $@ -d $<
@@ -12,15 +15,13 @@ YACC = bison all : bpf_jit_disasm bpf_dbg bpf_asm -bpf_jit_disasm : CFLAGS = -Wall -O2 -DPACKAGE='bpf_jit_disasm' +bpf_jit_disasm : CFLAGS += -DPACKAGE='bpf_jit_disasm' bpf_jit_disasm : LDLIBS = -lopcodes -lbfd -ldl bpf_jit_disasm : bpf_jit_disasm.o -bpf_dbg : CFLAGS = -Wall -O2 bpf_dbg : LDLIBS = -lreadline bpf_dbg : bpf_dbg.o -bpf_asm : CFLAGS = -Wall -O2 -I. bpf_asm : LDLIBS = bpf_asm : bpf_asm.o bpf_exp.yacc.o bpf_exp.lex.o bpf_exp.lex.o : bpf_exp.yacc.c