Skip to content

Commit

Permalink
Merge 4.14.103 into android-4.14
Browse files Browse the repository at this point in the history
Changes in 4.14.103
	dsa: mv88e6xxx: Ensure all pending interrupts are handled prior to exit
	net: fix IPv6 prefix route residue
	net: ipv4: use a dedicated counter for icmp_v4 redirect packets
	vsock: cope with memory allocation failure at socket creation time
	vxlan: test dev->flags & IFF_UP before calling netif_rx()
	hwmon: (lm80) Fix missing unlock on error in set_fan_div()
	mlxsw: __mlxsw_sp_port_headroom_set(): Fix a use of local variable
	net: crypto set sk to NULL when af_alg_release.
	net: Fix for_each_netdev_feature on Big endian
	net: phy: xgmiitorgmii: Support generic PHY status read
	net: stmmac: Fix a race in EEE enable callback
	net: stmmac: handle endianness in dwmac4_get_timestamp
	sky2: Increase D3 delay again
	vhost: correctly check the return value of translate_desc() in log_used()
	net: Add header for usage of fls64()
	tcp: tcp_v4_err() should be more careful
	net: Do not allocate page fragments that are not skb aligned
	tcp: clear icsk_backoff in tcp_write_queue_purge()
	sunrpc: fix 4 more call sites that were using stack memory with a scatterlist
	net/x25: do not hold the cpu too long in x25_new_lci()
	mISDN: fix a race in dev_expire_timer()
	ax25: fix possible use-after-free
	Linux 4.14.103

Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
gregkh committed Feb 23, 2019
2 parents 01709c9 + c793fa3 commit 6bdf39b
Show file tree
Hide file tree
Showing 28 changed files with 180 additions and 73 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
VERSION = 4
PATCHLEVEL = 14
SUBLEVEL = 102
SUBLEVEL = 103
EXTRAVERSION =
NAME = Petit Gorille

Expand Down
4 changes: 3 additions & 1 deletion crypto/af_alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ static void alg_do_release(const struct af_alg_type *type, void *private)

int af_alg_release(struct socket *sock)
{
if (sock->sk)
if (sock->sk) {
sock_put(sock->sk);
sock->sk = NULL;
}
return 0;
}
EXPORT_SYMBOL_GPL(af_alg_release);
Expand Down
4 changes: 3 additions & 1 deletion drivers/hwmon/lm80.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,10 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
}

rv = lm80_read_value(client, LM80_REG_FANDIV);
if (rv < 0)
if (rv < 0) {
mutex_unlock(&data->update_lock);
return rv;
}
reg = (rv & ~(3 << (2 * (nr + 1))))
| (data->fan_div[nr] << (2 * (nr + 1)));
lm80_write_value(client, LM80_REG_FANDIV, reg);
Expand Down
2 changes: 1 addition & 1 deletion drivers/isdn/mISDN/timerdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ dev_expire_timer(unsigned long data)
spin_lock_irqsave(&timer->dev->lock, flags);
if (timer->id >= 0)
list_move_tail(&timer->list, &timer->dev->expired);
spin_unlock_irqrestore(&timer->dev->lock, flags);
wake_up_interruptible(&timer->dev->wait);
spin_unlock_irqrestore(&timer->dev->lock, flags);
}

static int
Expand Down
28 changes: 22 additions & 6 deletions drivers/net/dsa/mv88e6xxx/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_fn(int irq, void *dev_id)
unsigned int sub_irq;
unsigned int n;
u16 reg;
u16 ctl1;
int err;

mutex_lock(&chip->reg_lock);
Expand All @@ -267,13 +268,28 @@ static irqreturn_t mv88e6xxx_g1_irq_thread_fn(int irq, void *dev_id)
if (err)
goto out;

for (n = 0; n < chip->g1_irq.nirqs; ++n) {
if (reg & (1 << n)) {
sub_irq = irq_find_mapping(chip->g1_irq.domain, n);
handle_nested_irq(sub_irq);
++nhandled;
do {
for (n = 0; n < chip->g1_irq.nirqs; ++n) {
if (reg & (1 << n)) {
sub_irq = irq_find_mapping(chip->g1_irq.domain,
n);
handle_nested_irq(sub_irq);
++nhandled;
}
}
}

mutex_lock(&chip->reg_lock);
err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &ctl1);
if (err)
goto unlock;
err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &reg);
unlock:
mutex_unlock(&chip->reg_lock);
if (err)
goto out;
ctl1 &= GENMASK(chip->g1_irq.nirqs, 0);
} while (reg & ctl1);

out:
return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/marvell/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -5087,7 +5087,7 @@ static int sky2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
INIT_WORK(&hw->restart_work, sky2_restart);

pci_set_drvdata(pdev, hw);
pdev->d3_delay = 200;
pdev->d3_delay = 300;

return 0;

Expand Down
12 changes: 7 additions & 5 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum.c
Original file line number Diff line number Diff line change
Expand Up @@ -1161,8 +1161,9 @@ int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu,
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
bool configure = false;
bool pfc = false;
u16 thres_cells;
u16 delay_cells;
bool lossy;
u16 thres;

for (j = 0; j < IEEE_8021QAZ_MAX_TCS; j++) {
if (prio_tc[j] == i) {
Expand All @@ -1176,10 +1177,11 @@ int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu,
continue;

lossy = !(pfc || pause_en);
thres = mlxsw_sp_pg_buf_threshold_get(mlxsw_sp, mtu);
delay = mlxsw_sp_pg_buf_delay_get(mlxsw_sp, mtu, delay, pfc,
pause_en);
mlxsw_sp_pg_buf_pack(pbmc_pl, i, thres + delay, thres, lossy);
thres_cells = mlxsw_sp_pg_buf_threshold_get(mlxsw_sp, mtu);
delay_cells = mlxsw_sp_pg_buf_delay_get(mlxsw_sp, mtu, delay,
pfc, pause_en);
mlxsw_sp_pg_buf_pack(pbmc_pl, i, thres_cells + delay_cells,
thres_cells, lossy);
}

return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(pbmc), pbmc_pl);
Expand Down
9 changes: 6 additions & 3 deletions drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,18 @@ static inline u64 dwmac4_get_timestamp(void *desc, u32 ats)
static int dwmac4_rx_check_timestamp(void *desc)
{
struct dma_desc *p = (struct dma_desc *)desc;
unsigned int rdes0 = le32_to_cpu(p->des0);
unsigned int rdes1 = le32_to_cpu(p->des1);
unsigned int rdes3 = le32_to_cpu(p->des3);
u32 own, ctxt;
int ret = 1;

own = p->des3 & RDES3_OWN;
ctxt = ((p->des3 & RDES3_CONTEXT_DESCRIPTOR)
own = rdes3 & RDES3_OWN;
ctxt = ((rdes3 & RDES3_CONTEXT_DESCRIPTOR)
>> RDES3_CONTEXT_DESCRIPTOR_SHIFT);

if (likely(!own && ctxt)) {
if ((p->des0 == 0xffffffff) && (p->des1 == 0xffffffff))
if ((rdes0 == 0xffffffff) && (rdes1 == 0xffffffff))
/* Corrupted value */
ret = -EINVAL;
else
Expand Down
22 changes: 12 additions & 10 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,25 +675,27 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev,
struct ethtool_eee *edata)
{
struct stmmac_priv *priv = netdev_priv(dev);
int ret;

priv->eee_enabled = edata->eee_enabled;

if (!priv->eee_enabled)
if (!edata->eee_enabled) {
stmmac_disable_eee_mode(priv);
else {
} else {
/* We are asking for enabling the EEE but it is safe
* to verify all by invoking the eee_init function.
* In case of failure it will return an error.
*/
priv->eee_enabled = stmmac_eee_init(priv);
if (!priv->eee_enabled)
edata->eee_enabled = stmmac_eee_init(priv);
if (!edata->eee_enabled)
return -EOPNOTSUPP;

/* Do not change tx_lpi_timer in case of failure */
priv->tx_lpi_timer = edata->tx_lpi_timer;
}

return phy_ethtool_set_eee(dev->phydev, edata);
ret = phy_ethtool_set_eee(dev->phydev, edata);
if (ret)
return ret;

priv->eee_enabled = edata->eee_enabled;
priv->tx_lpi_timer = edata->tx_lpi_timer;
return 0;
}

static u32 stmmac_usec2riwt(u32 usec, struct stmmac_priv *priv)
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/phy/xilinx_gmii2rgmii.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev)
u16 val = 0;
int err;

err = priv->phy_drv->read_status(phydev);
if (priv->phy_drv->read_status)
err = priv->phy_drv->read_status(phydev);
else
err = genphy_read_status(phydev);
if (err < 0)
return err;

Expand Down
14 changes: 11 additions & 3 deletions drivers/net/vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2002,7 +2002,7 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
struct pcpu_sw_netstats *tx_stats, *rx_stats;
union vxlan_addr loopback;
union vxlan_addr *remote_ip = &dst_vxlan->default_dst.remote_ip;
struct net_device *dev = skb->dev;
struct net_device *dev;
int len = skb->len;

tx_stats = this_cpu_ptr(src_vxlan->dev->tstats);
Expand All @@ -2022,9 +2022,15 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
#endif
}

rcu_read_lock();
dev = skb->dev;
if (unlikely(!(dev->flags & IFF_UP))) {
kfree_skb(skb);
goto drop;
}

if (dst_vxlan->cfg.flags & VXLAN_F_LEARN)
vxlan_snoop(skb->dev, &loopback, eth_hdr(skb)->h_source, 0,
vni);
vxlan_snoop(dev, &loopback, eth_hdr(skb)->h_source, 0, vni);

u64_stats_update_begin(&tx_stats->syncp);
tx_stats->tx_packets++;
Expand All @@ -2037,8 +2043,10 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
rx_stats->rx_bytes += len;
u64_stats_update_end(&rx_stats->syncp);
} else {
drop:
dev->stats.rx_dropped++;
}
rcu_read_unlock();
}

static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,
Expand Down
2 changes: 1 addition & 1 deletion drivers/vhost/vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,7 @@ static int log_used(struct vhost_virtqueue *vq, u64 used_offset, u64 len)

ret = translate_desc(vq, (uintptr_t)vq->used + used_offset,
len, iov, 64, VHOST_ACCESS_WO);
if (ret)
if (ret < 0)
return ret;

for (i = 0; i < ret; i++) {
Expand Down
24 changes: 22 additions & 2 deletions include/linux/netdev_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#define _LINUX_NETDEV_FEATURES_H

#include <linux/types.h>
#include <linux/bitops.h>
#include <asm/byteorder.h>

typedef u64 netdev_features_t;

Expand Down Expand Up @@ -143,8 +145,26 @@ enum {
#define NETIF_F_HW_ESP_TX_CSUM __NETIF_F(HW_ESP_TX_CSUM)
#define NETIF_F_RX_UDP_TUNNEL_PORT __NETIF_F(RX_UDP_TUNNEL_PORT)

#define for_each_netdev_feature(mask_addr, bit) \
for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT)
/* Finds the next feature with the highest number of the range of start till 0.
*/
static inline int find_next_netdev_feature(u64 feature, unsigned long start)
{
/* like BITMAP_LAST_WORD_MASK() for u64
* this sets the most significant 64 - start to 0.
*/
feature &= ~0ULL >> (-start & ((sizeof(feature) * 8) - 1));

return fls64(feature) - 1;
}

/* This goes for the MSB to the LSB through the set feature bits,
* mask_addr should be a u64 and bit an int
*/
#define for_each_netdev_feature(mask_addr, bit) \
for ((bit) = find_next_netdev_feature((mask_addr), \
NETDEV_FEATURE_COUNT); \
(bit) >= 0; \
(bit) = find_next_netdev_feature((mask_addr), (bit) - 1))

/* Features valid for ethtool to change */
/* = all defined minus driver/device-class-related */
Expand Down
12 changes: 12 additions & 0 deletions include/net/ax25.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,18 @@ static inline void ax25_hold_route(ax25_route *ax25_rt)

void __ax25_put_route(ax25_route *ax25_rt);

extern rwlock_t ax25_route_lock;

static inline void ax25_route_lock_use(void)
{
read_lock(&ax25_route_lock);
}

static inline void ax25_route_lock_unuse(void)
{
read_unlock(&ax25_route_lock);
}

static inline void ax25_put_route(ax25_route *ax25_rt)
{
if (refcount_dec_and_test(&ax25_rt->refcount))
Expand Down
1 change: 1 addition & 0 deletions include/net/inetpeer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct inet_peer {

u32 metrics[RTAX_MAX];
u32 rate_tokens; /* rate limiting for ICMP */
u32 n_redirects;
unsigned long rate_last;
/*
* Once inet_peer is queued for deletion (refcnt == 0), following field
Expand Down
1 change: 1 addition & 0 deletions include/net/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1623,6 +1623,7 @@ static inline void tcp_write_queue_purge(struct sock *sk)
tcp_clear_all_retrans_hints(tcp_sk(sk));
tcp_init_send_head(sk);
tcp_sk(sk)->packets_out = 0;
inet_csk(sk)->icsk_backoff = 0;
}

static inline struct sk_buff *tcp_write_queue_head(const struct sock *sk)
Expand Down
4 changes: 2 additions & 2 deletions net/ax25/ax25_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ netdev_tx_t ax25_ip_xmit(struct sk_buff *skb)
dst = (ax25_address *)(bp + 1);
src = (ax25_address *)(bp + 8);

ax25_route_lock_use();
route = ax25_get_route(dst, NULL);
if (route) {
digipeat = route->digipeat;
Expand Down Expand Up @@ -206,9 +207,8 @@ netdev_tx_t ax25_ip_xmit(struct sk_buff *skb)
ax25_queue_xmit(skb, dev);

put:
if (route)
ax25_put_route(route);

ax25_route_lock_unuse();
return NETDEV_TX_OK;
}

Expand Down
19 changes: 8 additions & 11 deletions net/ax25/ax25_route.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <linux/export.h>

static ax25_route *ax25_route_list;
static DEFINE_RWLOCK(ax25_route_lock);
DEFINE_RWLOCK(ax25_route_lock);

void ax25_rt_device_down(struct net_device *dev)
{
Expand Down Expand Up @@ -349,14 +349,14 @@ const struct file_operations ax25_route_fops = {
* Find AX.25 route
*
* Only routes with a reference count of zero can be destroyed.
* Must be called with ax25_route_lock read locked.
*/
ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev)
{
ax25_route *ax25_spe_rt = NULL;
ax25_route *ax25_def_rt = NULL;
ax25_route *ax25_rt;

read_lock(&ax25_route_lock);
/*
* Bind to the physical interface we heard them on, or the default
* route if none is found;
Expand All @@ -379,11 +379,6 @@ ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev)
if (ax25_spe_rt != NULL)
ax25_rt = ax25_spe_rt;

if (ax25_rt != NULL)
ax25_hold_route(ax25_rt);

read_unlock(&ax25_route_lock);

return ax25_rt;
}

Expand Down Expand Up @@ -414,9 +409,12 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr)
ax25_route *ax25_rt;
int err = 0;

if ((ax25_rt = ax25_get_route(addr, NULL)) == NULL)
ax25_route_lock_use();
ax25_rt = ax25_get_route(addr, NULL);
if (!ax25_rt) {
ax25_route_lock_unuse();
return -EHOSTUNREACH;

}
if ((ax25->ax25_dev = ax25_dev_ax25dev(ax25_rt->dev)) == NULL) {
err = -EHOSTUNREACH;
goto put;
Expand Down Expand Up @@ -451,8 +449,7 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr)
}

put:
ax25_put_route(ax25_rt);

ax25_route_lock_unuse();
return err;
}

Expand Down
Loading

0 comments on commit 6bdf39b

Please sign in to comment.