Linux 4.9.11
Greg KH
maintainerI'm announcing the release of the 4.9.11 kernel.
All users of the 4.9 kernel series must upgrade.
The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.9.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 arch/x86/kernel/fpu/core.c | 3 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 5 drivers/net/ethernet/mellanox/mlx5/core/en.h | 3 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 13 - drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 198 +++++++++---------- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 6 drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 4 drivers/net/loopback.c | 1 drivers/net/macvtap.c | 4 drivers/net/tun.c | 10 drivers/net/usb/catc.c | 56 +++-- drivers/net/usb/pegasus.c | 29 ++ drivers/net/usb/rtl8150.c | 34 ++- include/linux/can/core.h | 7 include/linux/netdevice.h | 4 include/net/cipso_ipv4.h | 4 include/net/ipv6.h | 2 include/net/lwtunnel.h | 5 net/can/af_can.c | 12 - net/can/af_can.h | 3 net/can/bcm.c | 4 net/can/gw.c | 2 net/can/raw.c | 4 net/core/dev.c | 31 +- net/dccp/ipv6.c | 4 net/dsa/dsa2.c | 1 net/ethernet/eth.c | 1 net/ipv4/cipso_ipv4.c | 4 net/ipv4/igmp.c | 1 net/ipv4/ip_output.c | 1 net/ipv4/ip_sockglue.c | 9 net/ipv4/ping.c | 2 net/ipv4/tcp.c | 6 net/ipv4/tcp_output.c | 6 net/ipv6/inet6_connection_sock.c | 2 net/ipv6/ip6_gre.c | 40 ++- net/ipv6/ip6_output.c | 4 net/ipv6/ip6_tunnel.c | 34 ++- net/ipv6/mcast.c | 50 ++-- net/ipv6/sit.c | 1 net/ipv6/tcp_ipv6.c | 28 +- net/l2tp/l2tp_core.h | 1 net/l2tp/l2tp_ip.c | 27 ++ net/l2tp/l2tp_ip6.c | 2 net/packet/af_packet.c | 7 net/sched/cls_matchall.c | 127 ++++-------- net/sctp/ipv6.c | 3 net/sctp/socket.c | 3 49 files changed, 468 insertions(+), 342 deletions(-)
Alexey Brodkin (1):
stmmac: Discard masked flags in interrupt status register
Ben Hutchings (4):
pegasus: Use heap buffers for all register access
rtl8150: Use heap buffers for all register access
catc: Combine failure cleanup code in catc_probe()
catc: Use heap buffer for memory size test
Benjamin Poirier (1):
mlx4: Invoke softirqs after napi_reschedule
Dan Carpenter (1):
ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim()
David Ahern (1):
lwtunnel: valid encap attr check should return 0 when lwtunnel is disabled
Eric Dumazet (10):
can: Fix kernel panic at security_sock_rcv_skb
ipv6: fix ip6_tnl_parse_tlv_enc_lim()
tcp: fix 0 divide in __tcp_select_window()
net: use a work queue to defer net_disable_timestamp() work
ipv4: keep skb->dst around in presence of IP options
netlabel: out of bound access in cipso_v4_validate()
ip6_gre: fix ip6gre_err() invalid reads
ipv6: tcp: add a missing tcp_v6_restore_cb()
tcp: avoid infinite loop in tcp_splice_read()
l2tp: do not use udp_ioctl()
Florian Fainelli (1):
net: dsa: Do not destroy invalid network devices
Gal Pressman (1):
net/mlx5e: Fix update of hash function/key via ethtool
Greg Kroah-Hartman (1):
Linux 4.9.11
Hangbin Liu (2):
mld: do not remove mld souce list info when set link down igmp, mld: Fix memory leak in igmpv3/mld_del_delrec()
Marcelo Ricardo Leitner (1):
sctp: avoid BUG_ON on sctp_wait_for_sndbuf
Mark Bloch (1):
net/mlx5: Don't unlock fte while still using it
Pablo Neira (1):
tcp: don't annotate mark on control socket from tcp_v6_send_response()
Pau Espin Pedrol (1):
tcp: fix mark propagation with fwmark_reflect enabled
WANG Cong (2):
sit: fix a double free on error path
ping: fix a null pointer dereference
Willem de Bruijn (4):
tun: read vnet_hdr_sz once
macvtap: read vnet_hdr_size once
net: introduce device min_header_len
packet: round up linear to header len
Yotam Gigi (1):
net/sched: matchall: Fix configuration race
Yu-cheng Yu (1):
x86/fpu/xstate: Fix xcomp_bv in XSAVES header
Greg KH
maintainerMakefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 9 -SUBLEVEL = 10 +SUBLEVEL = 11 EXTRAVERSION = NAME = Roaring Lionus
arch/x86/kernel/fpu/core.c +2 -1
@@ -236,7 +236,8 @@ void fpstate_init(union fpregs_state *state)* it will #GP. Make sure it is replaced after the memset(). */ if (static_cpu_has (X86_FEATURE_XSAVES )) - state->xsave.header.xcomp_bv =XCOMP_BV_COMPACTED_FORMAT ; + state->xsave.header.xcomp_bv =XCOMP_BV_COMPACTED_FORMAT | + xfeatures_mask;if (static_cpu_has (X86_FEATURE_FXSR ))fpstate_init_fxstate (&state->fxsave);
drivers/net/ethernet/mellanox/mlx4/en_rx.c +4 -1
@@ -507,8 +507,11 @@ void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv)return ;for (ring =0 ; ring < priv->rx_ring_num; ring++) { -if (mlx4_en_is_ring_empty (priv->rx_ring[ring])) +if (mlx4_en_is_ring_empty (priv->rx_ring[ring])) { +local_bh_disable ();napi_reschedule (&priv->rx_cq[ring]->napi); +local_bh_enable (); + } } }
drivers/net/ethernet/mellanox/mlx5/core/en.h +2 -1
@@ -765,7 +765,8 @@ void mlx5e_disable_vlan_filter(struct mlx5e_priv *priv);int mlx5e_modify_rqs_vsd (struct mlx5e_priv *priv,bool vsd);int mlx5e_redirect_rqt (struct mlx5e_priv *priv,u32 rqtn,int sz,int ix); -void mlx5e_build_tir_ctx_hash (void *tirc,struct mlx5e_priv *priv); +void mlx5e_build_indir_tir_ctx_hash (struct mlx5e_priv *priv,void *tirc, +enum mlx5e_traffic_types tt);int mlx5e_open_locked (struct net_device *netdev);int mlx5e_close_locked (struct net_device *netdev);
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +8 -5
@@ -975,15 +975,18 @@ static int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,static void mlx5e_modify_tirs_hash (struct mlx5e_priv *priv,void *in,int inlen) { -struct mlx5_core_dev *mdev = priv->mdev;void *tirc =MLX5_ADDR_OF (modify_tir_in, in, ctx); -int i; +struct mlx5_core_dev *mdev = priv->mdev; +int ctxlen =MLX5_ST_SZ_BYTES (tirc); +int tt;MLX5_SET (modify_tir_in, in, bitmask.hash,1 ); -mlx5e_build_tir_ctx_hash (tirc, priv); -for (i =0 ; i <MLX5E_NUM_INDIR_TIRS ; i++) -mlx5_core_modify_tir (mdev, priv->indir_tir[i].tirn, in, inlen); +for (tt =0 ; tt <MLX5E_NUM_INDIR_TIRS ; tt++) { +memset (tirc,0 , ctxlen); +mlx5e_build_indir_tir_ctx_hash (priv, tirc, tt); +mlx5_core_modify_tir (mdev, priv->indir_tir[tt].tirn, in, inlen); + } } static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +99 -99
223 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +4 -2
@@ -1110,9 +1110,8 @@ static struct mlx5_flow_rule *add_rule_fg(struct mlx5_flow_group *fg,return rule; } rule =add_rule_fte (fte, fg, dest); -unlock_ref_node (&fte->node);if (IS_ERR (rule)) - goto unlock_fg; + goto unlock_fte;else goto add_rule; }
@@ -1130,6 +1129,7 @@ static struct mlx5_flow_rule *add_rule_fg(struct mlx5_flow_group *fg, goto unlock_fg; }tree_init_node (&fte->node,0 , del_fte); +nested_lock_ref_node (&fte->node,FS_MUTEX_CHILD ); rule =add_rule_fte (fte, fg, dest);if (IS_ERR (rule)) {kfree (fte);
@@ -1142,6 +1142,8 @@ static struct mlx5_flow_rule *add_rule_fg(struct mlx5_flow_group *fg,list_add (&fte->node.list, prev); add_rule:tree_add_node (&rule->node, &fte->node); +unlock_fte: +unlock_ref_node (&fte->node); unlock_fg:unlock_ref_node (&fg->node);return rule;
drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +4 -0
@@ -305,8 +305,12 @@ static int dwmac1000_irq_status(struct mac_device_info *hw, {void __iomem *ioaddr = hw->pcsr;u32 intr_status =readl (ioaddr +GMAC_INT_STATUS ); +u32 intr_mask =readl (ioaddr +GMAC_INT_MASK );int ret =0 ; +/* Discard masked bits */ + intr_status &= ~intr_mask; +/* Not used events (e.g. MMC interrupts) are not handled. */ if ((intr_status &GMAC_INT_STATUS_MMCTIS )) x->mmc_tx_irq_n++;
drivers/net/loopback.c +1 -0
@@ -164,6 +164,7 @@ static void loopback_setup(struct net_device *dev) { dev->mtu =64 *1024 ; dev->hard_header_len =ETH_HLEN ;/* 14 */ + dev->min_header_len =ETH_HLEN ;/* 14 */ dev->addr_len =ETH_ALEN ;/* 6 */ dev->type =ARPHRD_LOOPBACK ;/* 0x0001*/ dev->flags =IFF_LOOPBACK ;
drivers/net/macvtap.c +2 -2
@@ -682,7 +682,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,ssize_t n;if (q->flags &IFF_VNET_HDR ) { - vnet_hdr_len = q->vnet_hdr_sz; + vnet_hdr_len =READ_ONCE (q->vnet_hdr_sz); err = -EINVAL ;if (len < vnet_hdr_len)
@@ -822,7 +822,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,if (q->flags &IFF_VNET_HDR ) {struct virtio_net_hdr vnet_hdr; - vnet_hdr_len = q->vnet_hdr_sz; + vnet_hdr_len =READ_ONCE (q->vnet_hdr_sz);if (iov_iter_count (iter) < vnet_hdr_len)return -EINVAL ;
drivers/net/tun.c +6 -4
@@ -1187,9 +1187,11 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, }if (tun->flags &IFF_VNET_HDR ) { -if (len < tun->vnet_hdr_sz) +int vnet_hdr_sz =READ_ONCE (tun->vnet_hdr_sz); + +if (len < vnet_hdr_sz)return -EINVAL ; - len -= tun->vnet_hdr_sz; + len -= vnet_hdr_sz; n =copy_from_iter (&gso,sizeof (gso), from);if (n !=sizeof (gso))
@@ -1201,7 +1203,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,if (tun16_to_cpu (tun, gso.hdr_len) > len)return -EINVAL ; -iov_iter_advance (from, tun->vnet_hdr_sz -sizeof (gso)); +iov_iter_advance (from, vnet_hdr_sz -sizeof (gso)); }if ((tun->flags &TUN_TYPE_MASK ) ==IFF_TAP ) {
@@ -1348,7 +1350,7 @@ static ssize_t tun_put_user(struct tun_struct *tun, vlan_hlen =VLAN_HLEN ;if (tun->flags &IFF_VNET_HDR ) - vnet_hdr_sz = tun->vnet_hdr_sz; + vnet_hdr_sz =READ_ONCE (tun->vnet_hdr_sz); total = skb->len + vlan_hlen + vnet_hdr_sz;
drivers/net/usb/catc.c +34 -22
90 lines not on this page · raw message
drivers/net/usb/pegasus.c +25 -4
@@ -126,40 +126,61 @@ static void async_ctrl_callback(struct urb *urb)static int get_registers (pegasus_t *pegasus,__u16 indx,__u16 size,void *data) { +u8 *buf;int ret; + buf =kmalloc (size,GFP_NOIO ); +if (!buf) +return -ENOMEM ; + ret =usb_control_msg (pegasus->usb,usb_rcvctrlpipe (pegasus->usb,0 ),PEGASUS_REQ_GET_REGS ,PEGASUS_REQT_READ ,0 , - indx, data, size,1000 ); + indx, buf, size,1000 );if (ret <0 )netif_dbg (pegasus, drv, pegasus->net,"%s returned %d\n" , __func__, ret); +else if (ret <= size) +memcpy (data, buf, ret); +kfree (buf);return ret; } -static int set_registers (pegasus_t *pegasus,__u16 indx,__u16 size,void *data) +static int set_registers (pegasus_t *pegasus,__u16 indx,__u16 size, +const void *data) { +u8 *buf;int ret; + buf =kmemdup (data, size,GFP_NOIO ); +if (!buf) +return -ENOMEM ; + ret =usb_control_msg (pegasus->usb,usb_sndctrlpipe (pegasus->usb,0 ),PEGASUS_REQ_SET_REGS ,PEGASUS_REQT_WRITE ,0 , - indx, data, size,100 ); + indx, buf, size,100 );if (ret <0 )netif_dbg (pegasus, drv, pegasus->net,"%s returned %d\n" , __func__, ret); +kfree (buf);return ret; }static int set_register (pegasus_t *pegasus,__u16 indx,__u8 data) { +u8 *buf;int ret; + buf =kmemdup (&data,1 ,GFP_NOIO ); +if (!buf) +return -ENOMEM ; + ret =usb_control_msg (pegasus->usb,usb_sndctrlpipe (pegasus->usb,0 ),PEGASUS_REQ_SET_REG ,PEGASUS_REQT_WRITE , data, - indx, &data,1 ,1000 ); + indx, buf,1 ,1000 );if (ret <0 )netif_dbg (pegasus, drv, pegasus->net,"%s returned %d\n" , __func__, ret); +kfree (buf);return ret; }
drivers/net/usb/rtl8150.c +27 -7
@@ -155,16 +155,36 @@ static const char driver_name [] = "rtl8150";*/ static int get_registers (rtl8150_t * dev,u16 indx,u16 size,void *data) { -return usb_control_msg (dev->udev,usb_rcvctrlpipe (dev->udev,0 ), -RTL8150_REQ_GET_REGS ,RTL8150_REQT_READ , - indx,0 , data, size,500 ); +void *buf; +int ret; + + buf =kmalloc (size,GFP_NOIO ); +if (!buf) +return -ENOMEM ; + + ret =usb_control_msg (dev->udev,usb_rcvctrlpipe (dev->udev,0 ), +RTL8150_REQ_GET_REGS ,RTL8150_REQT_READ , + indx,0 , buf, size,500 ); +if (ret >0 && ret <= size) +memcpy (data, buf, ret); +kfree (buf); +return ret; } -static int set_registers (rtl8150_t * dev,u16 indx,u16 size,void *data) +static int set_registers (rtl8150_t * dev,u16 indx,u16 size,const void *data) { -return usb_control_msg (dev->udev,usb_sndctrlpipe (dev->udev,0 ), -RTL8150_REQ_SET_REGS ,RTL8150_REQT_WRITE , - indx,0 , data, size,500 ); +void *buf; +int ret; + + buf =kmemdup (data, size,GFP_NOIO ); +if (!buf) +return -ENOMEM ; + + ret =usb_control_msg (dev->udev,usb_sndctrlpipe (dev->udev,0 ), +RTL8150_REQ_SET_REGS ,RTL8150_REQT_WRITE , + indx,0 , buf, size,500 ); +kfree (buf); +return ret; }static void async_set_reg_cb (struct urb *urb)
include/linux/can/core.h +3 -4
@@ -45,10 +45,9 @@ struct can_proto {extern int can_proto_register (const struct can_proto *cp);extern void can_proto_unregister (const struct can_proto *cp); -extern int can_rx_register (struct net_device *dev,canid_t can_id, -canid_t mask, -void (*func)(struct sk_buff *,void *), -void *data,char *ident); +int can_rx_register (struct net_device *dev,canid_t can_id,canid_t mask, +void (*func)(struct sk_buff *,void *), +void *data,char *ident,struct sock *sk); extern void can_rx_unregister(struct net_device *dev, canid_t can_id, canid_t mask,
include/linux/netdevice.h +4 -0
@@ -1508,6 +1508,7 @@ enum netdev_priv_flags {* @mtu: Interface MTU value * @type: Interface hardware type * @hard_header_len: Maximum hardware header length. +* @min_header_len: Minimum hardware header length * * @needed_headroom: Extra headroom the hardware may need, but not in all * cases can this be guaranteed
@@ -1728,6 +1729,7 @@ struct net_device {unsigned int mtu;unsigned short type;unsigned short hard_header_len; +unsigned short min_header_len;unsigned short needed_headroom;unsigned short needed_tailroom;
@@ -2783,6 +2785,8 @@ static inline bool dev_validate_header(const struct net_device *dev, {if (likely (len >= dev->hard_header_len))return true; +if (len < dev->min_header_len) +return false;if (capable (CAP_SYS_RAWIO )) {memset (ll_header + len,0 , dev->hard_header_len - len);
include/net/cipso_ipv4.h +4 -0
@@ -309,6 +309,10 @@ static inline int cipso_v4_validate(const struct sk_buff *skb, }for (opt_iter =6 ; opt_iter < opt_len;) { +if (opt_iter +1 == opt_len) { + err_offset = opt_iter; + goto out; + } tag_len = opt[opt_iter +1 ];if ((tag_len ==0 ) || (tag_len > (opt_len - opt_iter))) { err_offset = opt_iter +1 ;
include/net/ipv6.h +1 -1
@@ -871,7 +871,7 @@ int ip6_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb);* upper-layer output functions */ int ip6_xmit (const struct sock *sk,struct sk_buff *skb,struct flowi6 *fl6, -struct ipv6_txoptions *opt,int tclass); +__u32 mark,struct ipv6_txoptions *opt,int tclass);int ip6_find_1stfragopt (struct sk_buff *skb,u8 **nexthdr);
include/net/lwtunnel.h +4 -1
@@ -176,7 +176,10 @@ static inline int lwtunnel_valid_encap_type(u16 encap_type) }static inline int lwtunnel_valid_encap_type_attr (struct nlattr *attr,int len) { -return -EOPNOTSUPP ; +/* return 0 since we are not walking attr looking for +* RTA_ENCAP_TYPE attribute on nexthops. +*/ +return 0 ; } static inline int lwtunnel_build_state(struct net_device *dev, u16 encap_type,
net/can/af_can.c +10 -2
@@ -445,6 +445,7 @@ static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask,* @func: callback function on filter match * @data: returned parameter for callback function * @ident: string for calling module identification +* @sk: socket pointer (might be NULL) * * Description: * Invokes the callback function with the received sk_buff and the given
@@ -468,7 +469,7 @@ static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask,*/ int can_rx_register (struct net_device *dev,canid_t can_id,canid_t mask,void (*func)(struct sk_buff *,void *),void *data, -char *ident) +char *ident,struct sock *sk) {struct receiver *r;struct hlist_head *rl;
@@ -496,6 +497,7 @@ int can_rx_register(struct net_device *dev, canid_t can_id, canid_t mask, r->func = func; r->data = data; r->ident = ident; + r->sk = sk;hlist_add_head_rcu (&r->list, rl); d->entries++;
@@ -520,8 +522,11 @@ EXPORT_SYMBOL(can_rx_register);static void can_rx_delete_receiver (struct rcu_head *rp) { struct receiver *r = container_of(rp, struct receiver, rcu); +struct sock *sk = r->sk;kmem_cache_free (rcv_cache, r); +if (sk) +sock_put (sk); }/**
@@ -596,8 +601,11 @@ void can_rx_unregister(struct net_device *dev, canid_t can_id, canid_t mask,spin_unlock (&can_rcvlists_lock);/* schedule the receiver item for deletion */ -if (r) +if (r) { +if (r->sk) +sock_hold (r->sk);call_rcu (&r->rcu, can_rx_delete_receiver); + } }EXPORT_SYMBOL (can_rx_unregister);
net/can/af_can.h +2 -1
@@ -50,13 +50,14 @@struct receiver {struct hlist_node list; -struct rcu_head rcu;canid_t can_id;canid_t mask;unsigned long matches;void (*func)(struct sk_buff *,void *);void *data;char *ident; +struct sock *sk; +struct rcu_head rcu; };#define CAN_SFF_RCV_ARRAY_SZ (1 << CAN_SFF_ID_BITS)
net/can/bcm.c +2 -2
@@ -1225,7 +1225,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, err =can_rx_register (dev, op->can_id,REGMASK (op->can_id), bcm_rx_handler, op, -"bcm" ); +"bcm" , sk); op->rx_reg_dev = dev;dev_put (dev);
@@ -1234,7 +1234,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, }else err =can_rx_register (NULL , op->can_id,REGMASK (op->can_id), - bcm_rx_handler, op,"bcm" ); + bcm_rx_handler, op,"bcm" , sk);if (err) {/* this bcm rx op is broken -> remove it */ list_del (&op->list);
net/can/gw.c +1 -1
@@ -442,7 +442,7 @@ static inline int cgw_register_filter(struct cgw_job *gwj) {return can_rx_register (gwj->src.dev, gwj->ccgw.filter.can_id, gwj->ccgw.filter.can_mask, can_can_gw_rcv, - gwj,"gw" ); + gwj,"gw" ,NULL ); }static inline void cgw_unregister_filter (struct cgw_job *gwj)
net/can/raw.c +2 -2
@@ -190,7 +190,7 @@ static int raw_enable_filters(struct net_device *dev, struct sock *sk,for (i =0 ; i < count; i++) { err =can_rx_register (dev, filter[i].can_id, filter[i].can_mask, - raw_rcv, sk,"raw" ); + raw_rcv, sk,"raw" , sk);if (err) {/* clean up successfully registered filters */ while (--i >=0 )
@@ -211,7 +211,7 @@ static int raw_enable_errfilter(struct net_device *dev, struct sock *sk,if (err_mask) err =can_rx_register (dev,0 , err_mask |CAN_ERR_FLAG , - raw_rcv, sk,"raw" ); + raw_rcv, sk,"raw" , sk);return err; }
net/core/dev.c +13 -18
@@ -1696,24 +1696,19 @@ EXPORT_SYMBOL_GPL(net_dec_egress_queue);static struct static_key netstamp_needed__read_mostly ;#ifdef HAVE_JUMP_LABEL -/* We are not allowed to call static_key_slow_dec() from irq context -* If net_disable_timestamp() is called from irq context, defer the -* static_key_slow_dec() calls. -*/ static atomic_t netstamp_needed_deferred; -#endif - -void net_enable_timestamp (void ) +static void netstamp_clear (struct work_struct *work) { -#ifdef HAVE_JUMP_LABEL int deferred =atomic_xchg (&netstamp_needed_deferred,0 ); -if (deferred) { -while (--deferred) -static_key_slow_dec (&netstamp_needed); -return ; - } +while (deferred--) +static_key_slow_dec (&netstamp_needed); +} +static DECLARE_WORK(netstamp_work, netstamp_clear);#endif + +void net_enable_timestamp (void ) +{static_key_slow_inc (&netstamp_needed); }EXPORT_SYMBOL (net_enable_timestamp);
@@ -1721,12 +1716,12 @@ EXPORT_SYMBOL(net_enable_timestamp);void net_disable_timestamp (void ) {#ifdef HAVE_JUMP_LABEL -if (in_interrupt ()) { -atomic_inc (&netstamp_needed_deferred); -return ; - } -#endif +/* net_disable_timestamp() can be called from non process context */ +atomic_inc (&netstamp_needed_deferred); +schedule_work (&netstamp_work); +#else static_key_slow_dec (&netstamp_needed); +#endif }EXPORT_SYMBOL (net_disable_timestamp);
net/dccp/ipv6.c +2 -2
@@ -227,7 +227,7 @@ static int dccp_v6_send_response(const struct sock *sk, struct request_sock *req opt = ireq->ipv6_opt;if (!opt) opt =rcu_dereference (np->opt); - err =ip6_xmit (sk, skb, &fl6, opt, np->tclass); + err =ip6_xmit (sk, skb, &fl6, sk->sk_mark, opt, np->tclass);rcu_read_unlock (); err =net_xmit_eval (err); }
@@ -281,7 +281,7 @@ static void dccp_v6_ctl_send_reset(const struct sock *sk, struct sk_buff *rxskb) dst =ip6_dst_lookup_flow (ctl_sk, &fl6,NULL );if (!IS_ERR (dst)) {skb_dst_set (skb, dst); -ip6_xmit (ctl_sk, skb, &fl6,NULL ,0 ); +ip6_xmit (ctl_sk, skb, &fl6,0 ,NULL ,0 );DCCP_INC_STATS (DCCP_MIB_OUTSEGS );DCCP_INC_STATS (DCCP_MIB_OUTRSTS );return ;
net/dsa/dsa2.c +1 -0
@@ -273,6 +273,7 @@ static int dsa_user_port_apply(struct device_node *port, u32 index,if (err) {dev_warn (ds->dev,"Failed to create slave %d: %d\n" , index, err); + ds->ports[index].netdev =NULL ;return err; }
net/ethernet/eth.c +1 -0
@@ -356,6 +356,7 @@ void ether_setup(struct net_device *dev) dev->header_ops = ð_header_ops; dev->type =ARPHRD_ETHER ; dev->hard_header_len =ETH_HLEN ; + dev->min_header_len =ETH_HLEN ; dev->mtu =ETH_DATA_LEN ; dev->addr_len =ETH_ALEN ; dev->tx_queue_len =1000 ;/* Ethernet wants good queues */
net/ipv4/cipso_ipv4.c +4 -0
@@ -1587,6 +1587,10 @@ int cipso_v4_validate(const struct sk_buff *skb, unsigned char **option) goto validate_return_locked; } +if (opt_iter +1 == opt_len) { + err_offset = opt_iter; + goto validate_return_locked; + } tag_len = tag[1 ];if (tag_len > (opt_len - opt_iter)) { err_offset = opt_iter +1 ;
net/ipv4/igmp.c +1 -0
@@ -1172,6 +1172,7 @@ static void igmpv3_del_delrec(struct in_device *in_dev, struct ip_mc_list *im) psf->sf_crcount = im->crcount; }in_dev_put (pmc->interface); +kfree (pmc); }spin_unlock_bh (&im->lock); }
net/ipv4/ip_output.c +1 -0
@@ -1606,6 +1606,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb, sk->sk_protocol =ip_hdr (skb)->protocol; sk->sk_bound_dev_if = arg->bound_dev_if; sk->sk_sndbuf = sysctl_wmem_default; + sk->sk_mark = fl4.flowi4_mark; err =ip_append_data (sk, &fl4, ip_reply_glue_bits, arg->iov->iov_base, len,0 , &ipc, &rt,MSG_DONTWAIT );if (unlikely (err)) {
net/ipv4/ip_sockglue.c +8 -1
@@ -1215,7 +1215,14 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) pktinfo->ipi_ifindex =0 ; pktinfo->ipi_spec_dst.s_addr =0 ; } -skb_dst_drop (skb); +/* We need to keep the dst for __ip_options_echo() +* We could restrict the test to opt.ts_needtime || opt.srr, +* but the following is good enough as IP options are not often used. +*/ +if (unlikely (IPCB (skb)->opt.optlen)) +skb_dst_force (skb); +else +skb_dst_drop (skb); } int ip_setsockopt(struct sock *sk, int level,
net/ipv4/ping.c +2 -0
@@ -642,6 +642,8 @@ static int ping_v4_push_pending_frames(struct sock *sk, struct pingfakehdr *pfh, {struct sk_buff *skb =skb_peek (&sk->sk_write_queue); +if (!skb) +return 0 ; pfh->wcheck =csum_partial ((char *)&pfh->icmph,sizeof (struct icmphdr ), pfh->wcheck); pfh->icmph.checksum =csum_fold (pfh->wcheck);
net/ipv4/tcp.c +6 -0
@@ -772,6 +772,12 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos, ret = -EAGAIN ;break ; } +/* if __tcp_splice_read() got nothing while we have +* an skb in receive queue, we do not want to loop. +* This might happen with URG data. +*/ +if (!skb_queue_empty (&sk->sk_receive_queue)) +break ;sk_wait_data (sk, &timeo,NULL );if (signal_pending (current)) { ret =sock_intr_errno (timeo);
net/ipv4/tcp_output.c +4 -2
@@ -2436,9 +2436,11 @@ u32 __tcp_select_window(struct sock *sk)int full_space =min_t (int, tp->window_clamp, allowed_space);int window; -if (mss > full_space) +if (unlikely (mss > full_space)) { mss = full_space; - +if (mss <=0 ) +return 0 ; + }if (free_space < (full_space >>1 )) { icsk->icsk_ack.quick =0 ;
net/ipv6/inet6_connection_sock.c +1 -1
@@ -173,7 +173,7 @@ 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,rcu_dereference (np->opt), + res =ip6_xmit (sk, skb, &fl6, sk->sk_mark,rcu_dereference (np->opt), np->tclass);rcu_read_unlock ();return res;
net/ipv6/ip6_gre.c +21 -19
@@ -367,35 +367,37 @@ static void ip6gre_tunnel_uninit(struct net_device *dev)static void ip6gre_err (struct sk_buff *skb,struct inet6_skb_parm *opt, -u8 type,u8 code,int offset,__be32 info) +u8 type,u8 code,int offset,__be32 info) { -const struct ipv6hdr *ipv6h = (const struct ipv6hdr *)skb->data; -__be16 *p = (__be16 *)(skb->data + offset); -int grehlen = offset +4 ; +const struct gre_base_hdr *greh; +const struct ipv6hdr *ipv6h; +int grehlen =sizeof (*greh);struct ip6_tnl *t; +int key_off =0 ;__be16 flags; +__be32 key; - flags = p[0 ]; -if (flags&(GRE_CSUM |GRE_KEY |GRE_SEQ |GRE_ROUTING |GRE_VERSION )) { -if (flags&(GRE_VERSION |GRE_ROUTING )) -return ; -if (flags&GRE_KEY ) { - grehlen +=4 ; -if (flags&GRE_CSUM ) - grehlen +=4 ; - } +if (!pskb_may_pull (skb, offset + grehlen)) +return ; + greh = (const struct gre_base_hdr *)(skb->data + offset); + flags = greh->flags; +if (flags & (GRE_VERSION |GRE_ROUTING )) +return ; +if (flags &GRE_CSUM ) + grehlen +=4 ; +if (flags &GRE_KEY ) { + key_off = grehlen + offset; + grehlen +=4 ; } -/* If only 8 bytes returned, keyed message will be dropped here */ -if (!pskb_may_pull (skb, grehlen)) +if (!pskb_may_pull (skb, offset + grehlen))return ; ipv6h = (const struct ipv6hdr *)skb->data; - p = (__be16 *)(skb->data + offset); + greh = (const struct gre_base_hdr *)(skb->data + offset); + key = key_off ? *(__be32 *)(skb->data + key_off) :0 ; t =ip6gre_tunnel_lookup (skb->dev, &ipv6h->daddr, &ipv6h->saddr, - flags &GRE_KEY ? - *(((__be32 *)p) + (grehlen /4 ) -1 ) :0 , - p[1 ]); + key, greh->protocol);if (!t)return ;
net/ipv6/ip6_output.c +2 -2
@@ -163,7 +163,7 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb)* which are using proper atomic operations or spinlocks. */ int ip6_xmit (const struct sock *sk,struct sk_buff *skb,struct flowi6 *fl6, -struct ipv6_txoptions *opt,int tclass) +__u32 mark,struct ipv6_txoptions *opt,int tclass) {struct net *net =sock_net (sk);const struct ipv6_pinfo *np =inet6_sk (sk);
@@ -230,7 +230,7 @@ int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, skb->protocol =htons (ETH_P_IPV6 ); skb->priority = sk->sk_priority; - skb->mark = sk->sk_mark; + skb->mark = mark; mtu =dst_mtu (dst);if ((skb->len <= mtu) || skb->ignore_df ||skb_is_gso (skb)) {
net/ipv6/ip6_tunnel.c +22 -12
@@ -400,18 +400,19 @@ ip6_tnl_dev_uninit(struct net_device *dev)__u16 ip6_tnl_parse_tlv_enc_lim (struct sk_buff *skb,__u8 *raw) { -const struct ipv6hdr *ipv6h = (const struct ipv6hdr *) raw; -__u8 nexthdr = ipv6h->nexthdr; -__u16 off =sizeof (*ipv6h); +const struct ipv6hdr *ipv6h = (const struct ipv6hdr *)raw; +unsigned int nhoff = raw - skb->data; +unsigned int off = nhoff +sizeof (*ipv6h); +u8 next, nexthdr = ipv6h->nexthdr;while (ipv6_ext_hdr (nexthdr) && nexthdr !=NEXTHDR_NONE ) { -__u16 optlen =0 ;struct ipv6_opt_hdr *hdr; -if (raw + off +sizeof (*hdr) > skb->data && - !pskb_may_pull (skb, raw - skb->data + off +sizeof (*hdr))) +u16 optlen; + +if (!pskb_may_pull (skb, off +sizeof (*hdr)))break ; - hdr = (struct ipv6_opt_hdr *) (raw + off); + hdr = (struct ipv6_opt_hdr *)(skb->data + off);if (nexthdr ==NEXTHDR_FRAGMENT ) {struct frag_hdr *frag_hdr = (struct frag_hdr *) hdr;if (frag_hdr->frag_off)
@@ -422,20 +423,29 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw) }else { optlen =ipv6_optlen (hdr); } +/* cache hdr->nexthdr, since pskb_may_pull() might +* invalidate hdr +*/ + next = hdr->nexthdr;if (nexthdr ==NEXTHDR_DEST ) { -__u16 i = off +2 ; +u16 i =2 ; + +/* Remember : hdr is no longer valid at this point. */ +if (!pskb_may_pull (skb, off + optlen)) +break ; +while (1 ) {struct ipv6_tlv_tnl_enc_lim *tel;/* No more room for encapsulation limit */ -if (i +sizeof (*tel) > off + optlen) +if (i +sizeof (*tel) > optlen)break ; - tel = (struct ipv6_tlv_tnl_enc_lim *) &raw[i]; + tel = (struct ipv6_tlv_tnl_enc_lim *)(skb->data + off + i);/* return index of option if found and valid */ if (tel->type ==IPV6_TLV_TNL_ENCAP_LIMIT && tel->length ==1 ) -return i; +return i + off - nhoff;/* else jump to next option */ if (tel->type) i += tel->length +2 ;
@@ -443,7 +453,7 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw) i++; } } - nexthdr = hdr->nexthdr; + nexthdr = next; off += optlen; }return 0 ;
net/ipv6/mcast.c +30 -20
131 lines not on this page · raw message
net/ipv6/sit.c +1 -0
@@ -1390,6 +1390,7 @@ static int ipip6_tunnel_init(struct net_device *dev) err =dst_cache_init (&tunnel->dst_cache,GFP_KERNEL );if (err) {free_percpu (dev->tstats); + dev->tstats =NULL ;return err; }
net/ipv6/tcp_ipv6.c +15 -13
@@ -467,7 +467,7 @@ static int tcp_v6_send_synack(const struct sock *sk, struct dst_entry *dst, opt = ireq->ipv6_opt;if (!opt) opt =rcu_dereference (np->opt); - err =ip6_xmit (sk, skb, fl6, opt, np->tclass); + err =ip6_xmit (sk, skb, fl6, sk->sk_mark, opt, np->tclass);rcu_read_unlock (); err =net_xmit_eval (err); }
@@ -837,7 +837,7 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32 dst =ip6_dst_lookup_flow (ctl_sk, &fl6,NULL );if (!IS_ERR (dst)) {skb_dst_set (buff, dst); -ip6_xmit (ctl_sk, buff, &fl6,NULL , tclass); +ip6_xmit (ctl_sk, buff, &fl6, fl6.flowi6_mark,NULL , tclass);TCP_INC_STATS (net,TCP_MIB_OUTSEGS );if (rst)TCP_INC_STATS (net,TCP_MIB_OUTRSTS );
@@ -987,6 +987,16 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)return 0 ;/* don't send reset */ } +static void tcp_v6_restore_cb (struct sk_buff *skb) +{ +/* We need to move header back to the beginning if xfrm6_policy_check() +* and tcp_v6_fill_cb() are going to be called again. +* ip6_datagram_recv_specific_ctl() also expects IP6CB to be there. +*/ +memmove (IP6CB (skb), &TCP_SKB_CB (skb)->header.h6, +sizeof (struct inet6_skb_parm )); +} + static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, struct request_sock *req, struct dst_entry *dst,
@@ -1178,8 +1188,10 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff * sk_gfp_mask(sk, GFP_ATOMIC));consume_skb (ireq->pktopts); ireq->pktopts =NULL ; -if (newnp->pktoptions) +if (newnp->pktoptions) { +tcp_v6_restore_cb (newnp->pktoptions);skb_set_owner_r (newnp->pktoptions, newsk); + } } }
@@ -1194,16 +1206,6 @@ static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *return NULL ; } -static void tcp_v6_restore_cb (struct sk_buff *skb) -{ -/* We need to move header back to the beginning if xfrm6_policy_check() -* and tcp_v6_fill_cb() are going to be called again. -* ip6_datagram_recv_specific_ctl() also expects IP6CB to be there. -*/ -memmove (IP6CB (skb), &TCP_SKB_CB (skb)->header.h6, -sizeof (struct inet6_skb_parm )); -} -/* The socket must have it's spinlock held when we get * here, unless it is a TCP_LISTEN socket. *
net/l2tp/l2tp_core.h +1 -0
@@ -273,6 +273,7 @@ int l2tp_xmit_skb(struct l2tp_session *session, struct sk_buff *skb,int l2tp_nl_register_ops (enum l2tp_pwtype pw_type,const struct l2tp_nl_cmd_ops *ops);void l2tp_nl_unregister_ops (enum l2tp_pwtype pw_type); +int l2tp_ioctl (struct sock *sk,int cmd,unsigned long arg);/* Session reference counts. Incremented when code obtains a reference * to a session.
net/l2tp/l2tp_ip.c +26 -1
@@ -11,6 +11,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <asm/ioctls.h> #include <linux/icmp.h> #include <linux/module.h> #include <linux/skbuff.h>
@@ -560,6 +561,30 @@ static int l2tp_ip_recvmsg(struct sock *sk, struct msghdr *msg,return err ? err : copied; } +int l2tp_ioctl (struct sock *sk,int cmd,unsigned long arg) +{ +struct sk_buff *skb; +int amount; + +switch (cmd) { +case SIOCOUTQ : + amount =sk_wmem_alloc_get (sk); +break ; +case SIOCINQ : +spin_lock_bh (&sk->sk_receive_queue.lock); + skb =skb_peek (&sk->sk_receive_queue); + amount = skb ? skb->len :0 ; +spin_unlock_bh (&sk->sk_receive_queue.lock); +break ; + +default : +return -ENOIOCTLCMD ; + } + +return put_user (amount, (int __user *)arg); +} +EXPORT_SYMBOL (l2tp_ioctl); +static struct proto l2tp_ip_prot = { .name ="L2TP/IP" , .owner =THIS_MODULE ,
@@ -568,7 +593,7 @@ static struct proto l2tp_ip_prot = { .bind = l2tp_ip_bind, .connect = l2tp_ip_connect, .disconnect = l2tp_ip_disconnect, - .ioctl = udp_ioctl, + .ioctl = l2tp_ioctl, .destroy = l2tp_ip_destroy_sock, .setsockopt = ip_setsockopt, .getsockopt = ip_getsockopt,
net/l2tp/l2tp_ip6.c +1 -1
@@ -729,7 +729,7 @@ static struct proto l2tp_ip6_prot = { .bind = l2tp_ip6_bind, .connect = l2tp_ip6_connect, .disconnect = l2tp_ip6_disconnect, - .ioctl = udp_ioctl, + .ioctl = l2tp_ioctl, .destroy = l2tp_ip6_destroy_sock, .setsockopt = ipv6_setsockopt, .getsockopt = ipv6_getsockopt,
net/packet/af_packet.c +4 -3
@@ -2813,7 +2813,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)struct virtio_net_hdr vnet_hdr = {0 };int offset =0 ;struct packet_sock *po =pkt_sk (sk); -int hlen, tlen; +int hlen, tlen, linear;int extra_len =0 ;/*
@@ -2874,8 +2874,9 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len) err = -ENOBUFS ; hlen =LL_RESERVED_SPACE (dev); tlen = dev->needed_tailroom; - skb =packet_alloc_skb (sk, hlen + tlen, hlen, len, -__virtio16_to_cpu (vio_le (), vnet_hdr.hdr_len), + linear =__virtio16_to_cpu (vio_le (), vnet_hdr.hdr_len); + linear =max (linear,min_t (int, len, dev->hard_header_len)); + skb =packet_alloc_skb (sk, hlen + tlen, hlen, len, linear, msg->msg_flags &MSG_DONTWAIT , &err);if (skb ==NULL ) goto out_unlock;
net/sched/cls_matchall.c +45 -82
271 lines not on this page · raw message
net/sctp/ipv6.c +2 -1
@@ -222,7 +222,8 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport)SCTP_INC_STATS (sock_net (sk),SCTP_MIB_OUTSCTPPACKS );rcu_read_lock (); - res =ip6_xmit (sk, skb, fl6,rcu_dereference (np->opt), np->tclass); + res =ip6_xmit (sk, skb, fl6, sk->sk_mark,rcu_dereference (np->opt), + np->tclass);rcu_read_unlock ();return res; }
net/sctp/socket.c +2 -1
@@ -7427,7 +7427,8 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,*/ release_sock (sk); current_timeo =schedule_timeout (current_timeo); -BUG_ON (sk != asoc->base.sk); +if (sk != asoc->base.sk) + goto do_error;lock_sock (sk); *timeo_p = current_timeo;