Linux 4.2.8
Greg KH
maintainerI'm announcing the release of the 4.2.8 kernel.
All users of the 4.2 kernel series must upgrade.
NOTE: This is the LAST 4.2.y kernel to be released. It is now end-of-life. Please move to the 4.3.y kernel series at this time.
The updated 4.2.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.2.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/media/pci/cobalt/Kconfig | 2 drivers/net/ethernet/cavium/thunder/nicvf_main.c | 7 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 39 +- drivers/net/ethernet/via/via-rhine.c | 3 drivers/net/phy/broadcom.c | 2 drivers/net/usb/qmi_wwan.c | 1 fs/btrfs/ctree.h | 4 fs/btrfs/delayed-ref.c | 139 +++++++- fs/btrfs/delayed-ref.h | 7 fs/btrfs/extent-tree.c | 59 +-- fs/btrfs/file.c | 36 +- fs/btrfs/inode.c | 96 ++++-- fs/btrfs/ioctl.c | 257 +++++++++------- fs/btrfs/relocation.c | 16 - fs/btrfs/send.c | 10 fs/btrfs/tree-log.c | 2 fs/btrfs/xattr.c | 4 fs/ceph/mds_client.c | 2 fs/debugfs/inode.c | 6 fs/ext4/crypto.c | 1 fs/ext4/crypto_fname.c | 2 fs/ext4/crypto_key.c | 16 - fs/ext4/crypto_policy.c | 3 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_fib.h | 3 include/net/ip6_tunnel.h | 3 include/net/ip_tunnels.h | 3 include/net/ipv6.h | 22 + include/net/sch_generic.h | 3 include/net/switchdev.h | 2 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/route.c | 22 + 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 | 286 +++++++++++++++--- sound/pci/hda/patch_hdmi.c | 3 tools/net/Makefile | 7 79 files changed, 1202 insertions(+), 453 deletions(-)
Aaro Koskinen (1):
broadcom: fix PHY_ID_BCM5481 entry in the id table
Andrej Ota (1):
via-rhine: fix VLAN receive handling regression.
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
David Sterba (1):
btrfs: fix signed overflows in btrfs_sync_file
Dragos Tatulea (1):
net: switchdev: fix return code of fdb_dump stub
Eran Ben Elisha (1):
net/mlx4_core: Fix sleeping while holding spinlock at rem_slave_counters
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 (7):
Btrfs: fix file corruption and data loss after cloning inline extents
Btrfs: fix truncation of compressed and inlined extents
Btrfs: fix regression when running delayed references
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
Btrfs: fix regression running delayed references when using qgroups
Greg Kroah-Hartman (1):
Linux 4.2.8
Hannes Frederic Sowa (4):
af-unix: fix use-after-free with concurrent readers while splicing
af_unix: don't append consumed skbs to sk_receive_queue
af_unix: take receive queue lock while appending new skb
af-unix: passcred support for sendpage
Hans Verkuil (1):
cobalt: fix Kconfig dependency
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
Martin KaFai Lau (3):
ipv6: Avoid creating RTF_CACHE from a rt that is not managed by fib6 tree
ipv6: Check expire on DST_NOCACHE route
ipv6: Check rt->dst.from for the DST_NOCACHE route
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
Pavel Fedin (1):
net: thunder: Check for driver data in nicvf_remove()
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
Robin Ruede (1):
btrfs: fix resending received snapshot with parent
Stefan Richter (1):
firewire: ohci: fix JMicron JMB38x IT context discovery
Theodore Ts'o (2):
ext4 crypto: fix memory leak in ext4_bio_write_page() ext4 crypto: replace some BUG_ON()'s with error checks
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 = 2 -SUBLEVEL = 7 +SUBLEVEL = 8 EXTRAVERSION = NAME = Hurr durr I'ma sheep
drivers/block/rbd.c +1 -0
@@ -3439,6 +3439,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/media/pci/cobalt/Kconfig +1 -1
@@ -1,6 +1,6 @@ config VIDEO_COBALT tristate "Cisco Cobalt support" - depends on VIDEO_V4L2 && I2C && MEDIA_CONTROLLER + depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API depends on PCI_MSI && MTD_COMPLEX_MAPPINGS && GPIOLIB depends on SND select I2C_ALGOBIT
drivers/net/ethernet/cavium/thunder/nicvf_main.c +6 -1
@@ -1325,7 +1325,12 @@ err_disable_device:static void nicvf_remove (struct pci_dev *pdev) {struct net_device *netdev =pci_get_drvdata (pdev); -struct nicvf *nic =netdev_priv (netdev); +struct nicvf *nic; + +if (!netdev) +return ; + + nic =netdev_priv (netdev);unregister_netdev (netdev);nicvf_unregister_interrupts (nic);
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +27 -12
@@ -4934,26 +4934,41 @@ static void rem_slave_counters(struct mlx4_dev *dev, int slave)struct res_counter *counter;struct res_counter *tmp;int err; -int index; +int *counters_arr =NULL ; +int i, j; err =move_all_busy (dev, slave,RES_COUNTER );if (err)mlx4_warn (dev,"rem_slave_counters: Could not move all counters - too busy for slave %d\n" , slave); -spin_lock_irq (mlx4_tlock (dev)); -list_for_each_entry_safe (counter, tmp, counter_list, com.list) { -if (counter->com.owner == slave) { - index = counter->com.res_id; -rb_erase (&counter->com.node, - &tracker->res_tree[RES_COUNTER ]); -list_del (&counter->com.list); -kfree (counter); -__mlx4_counter_free (dev, index); + counters_arr =kmalloc_array (dev->caps.max_counters, +sizeof (*counters_arr),GFP_KERNEL ); +if (!counters_arr) +return ; + +do { + i =0 ; + j =0 ; +spin_lock_irq (mlx4_tlock (dev)); +list_for_each_entry_safe (counter, tmp, counter_list, com.list) { +if (counter->com.owner == slave) { + counters_arr[i++] = counter->com.res_id; +rb_erase (&counter->com.node, + &tracker->res_tree[RES_COUNTER ]); +list_del (&counter->com.list); +kfree (counter); + } + } +spin_unlock_irq (mlx4_tlock (dev)); + +while (j < i) { +__mlx4_counter_free (dev, counters_arr[j++]);mlx4_release_resource (dev, slave,RES_COUNTER ,1 ,0 ); } - } -spin_unlock_irq (mlx4_tlock (dev)); + }while (i); + +kfree (counters_arr); }static void rem_slave_xrcdns (struct mlx4_dev *dev,int slave)
drivers/net/ethernet/via/via-rhine.c +2 -1
@@ -2134,10 +2134,11 @@ static int rhine_rx(struct net_device *dev, int limit) }skb_put (skb, pkt_len); - skb->protocol =eth_type_trans (skb, dev);rhine_rx_vlan_tag (skb, desc, data_size); + skb->protocol =eth_type_trans (skb, dev); +netif_receive_skb (skb);u64_stats_update_begin (&rp->rx_stats.syncp);
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
@@ -775,6 +775,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/ctree.h +2 -2
@@ -3404,7 +3404,7 @@ int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,int btrfs_free_extent (struct btrfs_trans_handle *trans,struct btrfs_root *root,u64 bytenr,u64 num_bytes,u64 parent,u64 root_objectid, -u64 owner,u64 offset,int no_quota); +u64 owner,u64 offset);int btrfs_free_reserved_extent (struct btrfs_root *root,u64 start,u64 len,int delalloc);
@@ -3417,7 +3417,7 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,int btrfs_inc_extent_ref (struct btrfs_trans_handle *trans,struct btrfs_root *root,u64 bytenr,u64 num_bytes,u64 parent, -u64 root_objectid,u64 owner,u64 offset,int no_quota); +u64 root_objectid,u64 owner,u64 offset);int btrfs_start_dirty_block_groups (struct btrfs_trans_handle *trans,struct btrfs_root *root);
fs/btrfs/delayed-ref.c +120 -19
211 lines not on this page · raw message
fs/btrfs/delayed-ref.h +2 -5
@@ -68,7 +68,6 @@ struct btrfs_delayed_ref_node { unsigned int action:8; unsigned int type:8; - unsigned int no_quota:1;/* is this node still in the rbtree? */ unsigned int is_head:1; unsigned int in_tree:1;
@@ -233,15 +232,13 @@ int btrfs_add_delayed_tree_ref(struct btrfs_fs_info *fs_info,struct btrfs_trans_handle *trans, u64 bytenr, u64 num_bytes, u64 parent, u64 ref_root, int level, int action, - struct btrfs_delayed_extent_op *extent_op, - int no_quota); + struct btrfs_delayed_extent_op *extent_op);int btrfs_add_delayed_data_ref (struct btrfs_fs_info *fs_info,struct btrfs_trans_handle *trans,u64 bytenr,u64 num_bytes,u64 parent,u64 ref_root,u64 owner,u64 offset,int action, -struct btrfs_delayed_extent_op *extent_op, -int no_quota); +struct btrfs_delayed_extent_op *extent_op); int btrfs_add_delayed_extent_op(struct btrfs_fs_info *fs_info, struct btrfs_trans_handle *trans, u64 bytenr, u64 num_bytes,
fs/btrfs/extent-tree.c +30 -29
182 lines not on this page · raw message
fs/btrfs/file.c +24 -12
@@ -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 (); }/*
@@ -847,7 +855,7 @@ next_slot: disk_bytenr, num_bytes,0 , root->root_key.objectid, new_key.objectid, - start - extent_offset, 1); + start - extent_offset);BUG_ON (ret);/* -ENOMEM */ } key.offset = start;
@@ -925,7 +933,7 @@ delete_extent_item: disk_bytenr, num_bytes,0 , root->root_key.objectid, key.objectid, key.offset - - extent_offset, 0); + extent_offset);BUG_ON (ret);/* -ENOMEM */ inode_sub_bytes (inode, extent_end - key.offset);
@@ -1204,7 +1212,7 @@ again: ret =btrfs_inc_extent_ref (trans, root, bytenr, num_bytes,0 , root->root_key.objectid, - ino, orig_offset,1 ); + ino, orig_offset);BUG_ON (ret);/* -ENOMEM */ if (split == start) {
@@ -1231,7 +1239,7 @@ again: del_nr++; ret =btrfs_free_extent (trans, root, bytenr, num_bytes,0 , root->root_key.objectid, - ino, orig_offset,0 ); + ino, orig_offset);BUG_ON (ret);/* -ENOMEM */ } other_start =0 ;
@@ -1248,7 +1256,7 @@ again: del_nr++; ret =btrfs_free_extent (trans, root, bytenr, num_bytes,0 , root->root_key.objectid, - ino, orig_offset,0 ); + ino, orig_offset);BUG_ON (ret);/* -ENOMEM */ }if (del_nr ==0 ) {
@@ -1868,8 +1876,13 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)struct btrfs_log_ctx ctx;int ret =0 ;bool full_sync =0 ; -const u64 len = end - start +1 ; +u64 len; +/* +* The range length can be represented by u64, we have to do the typecasts +* to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync() +*/ + len = (u64 )end - (u64 )start +1 ;trace_btrfs_sync_file (file, datasync);/*
@@ -2057,8 +2070,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) } }if (!full_sync) { - ret =btrfs_wait_ordered_range (inode, start, - end - start +1 ); + ret =btrfs_wait_ordered_range (inode, start, len);if (ret) {btrfs_end_transaction (trans, root); goto out;
fs/btrfs/inode.c +78 -18
133 lines not on this page · raw message
fs/btrfs/ioctl.c +153 -104
314 lines not on this page · raw message
fs/btrfs/relocation.c +7 -9
@@ -1716,7 +1716,7 @@ int replace_file_extents(struct btrfs_trans_handle *trans, ret =btrfs_inc_extent_ref (trans, root, new_bytenr, num_bytes, parent,btrfs_header_owner (leaf), - key.objectid, key.offset,1 ); + key.objectid, key.offset);if (ret) {btrfs_abort_transaction (trans, root, ret);break ;
@@ -1724,7 +1724,7 @@ int replace_file_extents(struct btrfs_trans_handle *trans, ret =btrfs_free_extent (trans, root, bytenr, num_bytes, parent,btrfs_header_owner (leaf), - key.objectid, key.offset,1 ); + key.objectid, key.offset);if (ret) {btrfs_abort_transaction (trans, root, ret);break ;
@@ -1900,23 +1900,21 @@ again: ret =btrfs_inc_extent_ref (trans, src, old_bytenr, blocksize, path->nodes[level]->start, - src->root_key.objectid, level -1 ,0 , -1 ); + src->root_key.objectid, level -1 ,0 );BUG_ON (ret); ret =btrfs_inc_extent_ref (trans, dest, new_bytenr, blocksize,0 , dest->root_key.objectid, level -1 , -0 ,1 ); +0 );BUG_ON (ret); ret =btrfs_free_extent (trans, src, new_bytenr, blocksize, path->nodes[level]->start, - src->root_key.objectid, level -1 ,0 , -1 ); + src->root_key.objectid, level -1 ,0 );BUG_ON (ret); ret =btrfs_free_extent (trans, dest, old_bytenr, blocksize,0 , dest->root_key.objectid, level -1 , -0 ,1 ); +0 );BUG_ON (ret);btrfs_unlock_up_safe (path,0 );
@@ -2746,7 +2744,7 @@ static int do_relocation(struct btrfs_trans_handle *trans, node->eb->start, blocksize, upper->eb->start,btrfs_header_owner (upper->eb), - node->level, 0, 1); + node->level, 0);BUG_ON (ret); ret =btrfs_drop_subtree (trans, root, eb, upper->eb);
fs/btrfs/send.c +8 -2
@@ -2351,8 +2351,14 @@ static int send_subvol_begin(struct send_ctx *sctx) }TLV_PUT_STRING (sctx,BTRFS_SEND_A_PATH , name, namelen); -TLV_PUT_UUID (sctx,BTRFS_SEND_A_UUID , - sctx->send_root->root_item.uuid); + +if (!btrfs_is_empty_uuid (sctx->send_root->root_item.received_uuid)) +TLV_PUT_UUID (sctx,BTRFS_SEND_A_UUID , + sctx->send_root->root_item.received_uuid); +else +TLV_PUT_UUID (sctx,BTRFS_SEND_A_UUID , + sctx->send_root->root_item.uuid); +TLV_PUT_U64 (sctx,BTRFS_SEND_A_CTRANSID ,le64_to_cpu (sctx->send_root->root_item.ctransid));if (parent_root) {
fs/btrfs/tree-log.c +1 -1
@@ -700,7 +700,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, ret =btrfs_inc_extent_ref (trans, root, ins.objectid, ins.offset,0 , root->root_key.objectid, - key->objectid, offset,0 ); + key->objectid, offset);if (ret) goto out; }else {
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
@@ -1935,7 +1935,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
@@ -271,8 +271,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/crypto.c +0 -1
@@ -296,7 +296,6 @@ static int ext4_page_crypto(struct ext4_crypto_ctx *ctx,else res =crypto_ablkcipher_encrypt (req);if (res == -EINPROGRESS || res == -EBUSY ) { -BUG_ON (req->base.data != &ecr);wait_for_completion (&ecr.completion); res = ecr.res; }
fs/ext4/crypto_fname.c +0 -2
@@ -121,7 +121,6 @@ static int ext4_fname_encrypt(struct inode *inode,ablkcipher_request_set_crypt (req, &src_sg, &dst_sg, ciphertext_len, iv); res =crypto_ablkcipher_encrypt (req);if (res == -EINPROGRESS || res == -EBUSY ) { -BUG_ON (req->base.data != &ecr);wait_for_completion (&ecr.completion); res = ecr.res; }
@@ -183,7 +182,6 @@ static int ext4_fname_decrypt(struct inode *inode,ablkcipher_request_set_crypt (req, &src_sg, &dst_sg, iname->len, iv); res =crypto_ablkcipher_decrypt (req);if (res == -EINPROGRESS || res == -EBUSY ) { -BUG_ON (req->base.data != &ecr);wait_for_completion (&ecr.completion); res = ecr.res; }
fs/ext4/crypto_key.c +13 -3
@@ -71,7 +71,6 @@ static int ext4_derive_key_aes(char deriving_key[EXT4_AES_128_ECB_KEY_SIZE], EXT4_AES_256_XTS_KEY_SIZE, NULL); res =crypto_ablkcipher_encrypt (req);if (res == -EINPROGRESS || res == -EBUSY ) { -BUG_ON (req->base.data != &ecr);wait_for_completion (&ecr.completion); res = ecr.res; }
@@ -208,7 +207,12 @@ retry: goto out; } crypt_info->ci_keyring_key = keyring_key; -BUG_ON (keyring_key->type != &key_type_logon); +if (keyring_key->type != &key_type_logon) { +printk_once (KERN_WARNING +"ext4: key type must be logon\n" ); + res = -ENOKEY ; + goto out; + } ukp = ((struct user_key_payload *)keyring_key->payload.data);if (ukp->datalen !=sizeof (struct ext4_encryption_key )) { res = -EINVAL ;
@@ -217,7 +221,13 @@ retry: master_key = (struct ext4_encryption_key *)ukp->data;BUILD_BUG_ON (EXT4_AES_128_ECB_KEY_SIZE !=EXT4_KEY_DERIVATION_NONCE_SIZE ); -BUG_ON (master_key->size !=EXT4_AES_256_XTS_KEY_SIZE ); +if (master_key->size !=EXT4_AES_256_XTS_KEY_SIZE ) { +printk_once (KERN_WARNING +"ext4: key size incorrect: %d\n" , + master_key->size); + res = -ENOKEY ; + goto out; + } res =ext4_derive_key_aes (ctx.nonce, master_key->raw, raw_key); got_key:
fs/ext4/crypto_policy.c +2 -1
@@ -137,7 +137,8 @@ int ext4_is_child_context_consistent_with_parent(struct inode *parent,if ((parent ==NULL ) || (child ==NULL )) {pr_err ("parent %p child %p\n" , parent, child); -BUG_ON (1 ); +WARN_ON (1 );/* Should never happen */ +return 0 ; }/* no restrictions if the parent directory is not encrypted */ if (!ext4_encrypted_inode (parent))
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
@@ -425,6 +425,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;
@@ -477,11 +478,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
@@ -397,9 +397,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) \
@@ -588,8 +592,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
@@ -2071,8 +2071,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
@@ -1816,7 +1816,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
@@ -534,15 +534,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
@@ -62,6 +62,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_fib.h +2 -1
@@ -165,7 +165,8 @@ static inline void rt6_update_expires(struct rt6_info *rt0, int timeout)static inline u32 rt6_get_cookie (const struct rt6_info *rt) { -if (rt->rt6i_flags &RTF_PCPU ||unlikely (rt->dst.flags &DST_NOCACHE )) +if (rt->rt6i_flags &RTF_PCPU || + (unlikely (rt->dst.flags &DST_NOCACHE ) && rt->dst.from)) rt = (struct rt6_info *)(rt->dst.from);return rt->rt6i_node ? rt->rt6i_node->fn_sernum :0 ;
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. */ };
@@ -252,6 +253,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,
@@ -490,6 +509,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;
include/net/switchdev.h +1 -1
@@ -268,7 +268,7 @@ static inline int switchdev_port_fdb_dump(struct sk_buff *skb, struct net_device *filter_dev, int idx) { -return -EOPNOTSUPP ; +return idx; }#endif
kernel/bpf/arraymap.c +1 -1
@@ -104,7 +104,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
@@ -2210,7 +2210,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))
@@ -2285,7 +2285,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
@@ -4434,19 +4434,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;
@@ -4462,7 +4477,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)
@@ -5620,6 +5636,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
@@ -426,9 +426,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);
@@ -657,7 +659,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);
@@ -904,6 +907,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/route.c +19 -3
@@ -401,6 +401,14 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, } } +static bool __rt6_check_expired (const struct rt6_info *rt) +{ +if (rt->rt6i_flags &RTF_EXPIRES ) +return time_after (jiffies, rt->dst.expires); +else +return false; +} +static bool rt6_check_expired (const struct rt6_info *rt) {if (rt->rt6i_flags &RTF_EXPIRES ) {
@@ -1255,7 +1263,8 @@ static struct dst_entry *rt6_check(struct rt6_info *rt, u32 cookie)static struct dst_entry *rt6_dst_from_check (struct rt6_info *rt,u32 cookie) { -if (rt->dst.obsolete ==DST_OBSOLETE_FORCE_CHK && +if (!__rt6_check_expired (rt) && + rt->dst.obsolete ==DST_OBSOLETE_FORCE_CHK &&rt6_check ((struct rt6_info *)(rt->dst.from), cookie))return &rt->dst;else
@@ -1275,7 +1284,8 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie)rt6_dst_from_metrics_check (rt); -if ((rt->rt6i_flags &RTF_PCPU ) ||unlikely (dst->flags &DST_NOCACHE )) +if (rt->rt6i_flags &RTF_PCPU || + (unlikely (dst->flags &DST_NOCACHE ) && rt->dst.from))return rt6_dst_from_check (rt, cookie);else return rt6_check (rt, cookie);
@@ -1326,6 +1336,12 @@ static void rt6_do_update_pmtu(struct rt6_info *rt, u32 mtu)rt6_update_expires (rt, net->ipv6.sysctl.ip6_rt_mtu_expires); } +static bool rt6_cache_allowed_for_pmtu (const struct rt6_info *rt) +{ +return !(rt->rt6i_flags &RTF_CACHE ) && + (rt->rt6i_flags &RTF_PCPU || rt->rt6i_node); +} +static void __ip6_rt_update_pmtu (struct dst_entry *dst,const struct sock *sk,const struct ipv6hdr *iph,u32 mtu) {
@@ -1339,7 +1355,7 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,if (mtu >=dst_mtu (dst))return ; -if (rt6->rt6i_flags &RTF_CACHE ) { +if (!rt6_cache_allowed_for_pmtu (rt6)) {rt6_do_update_pmtu (rt6, mtu); }else {const struct in6_addr *daddr, *saddr;
net/ipv6/syncookies.c +1 -1
@@ -225,7 +225,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
@@ -120,6 +120,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 flowi6 fl6;struct dst_entry *dst;int addr_type;
@@ -235,7 +236,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));
@@ -263,9 +265,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 );
@@ -461,7 +463,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); }
@@ -991,6 +994,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;
@@ -1126,13 +1130,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
@@ -7375,6 +7375,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,
@@ -7384,7 +7391,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 +251 -35
180 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.