Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
Merge 4.4.126 into 8.x-unified
Browse files Browse the repository at this point in the history
Changes in 4.4.126: (21 commits)
        scsi: sg: don't return bogus Sg_requests
        Revert "genirq: Use irqd_get_trigger_type to compare the trigger type for shared IRQs"
        net: Fix hlist corruptions in inet_evict_bucket()
        dccp: check sk for closed state in dccp_sendmsg()
        ipv6: fix access to non-linear packet in ndisc_fill_redirect_hdr_option()
        l2tp: do not accept arbitrary sockets
        net: ethernet: arc: Fix a potential memory leak if an optional regulator is deferred
        net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface
        net/iucv: Free memory obtained by kzalloc
        netlink: avoid a double skb free in genlmsg_mcast()
        net: Only honor ifindex in IP_PKTINFO if non-0
        skbuff: Fix not waking applications when errors are enqueued
        team: Fix double free in error path
        s390/qeth: free netdevice when removing a card
        s390/qeth: when thread completes, wake up all waiters
        s390/qeth: lock read device while queueing next buffer
        s390/qeth: on channel error, reject further cmd requests
        ieee802154: 6lowpan: fix possible NULL deref in lowpan_device_event()
        net: fec: Fix unbalanced PM runtime calls
        net: systemport: Rewrite __bcm_sysport_tx_reclaim()
        Linux 4.4.126

Signed-off-by: Nathan Chancellor <[email protected]>
  • Loading branch information
nathanchance committed Mar 31, 2018
2 parents 9ec9556 + 8ff8cb8 commit cb887f5
Show file tree
Hide file tree
Showing 21 changed files with 81 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION = 4
PATCHLEVEL = 4
SUBLEVEL = 125
SUBLEVEL = 126
EXTRAVERSION =
NAME = Blurry Fish Butt

Expand Down
6 changes: 4 additions & 2 deletions drivers/net/ethernet/arc/emac_rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ static int emac_rockchip_probe(struct platform_device *pdev)
/* Optional regulator for PHY */
priv->regulator = devm_regulator_get_optional(dev, "phy");
if (IS_ERR(priv->regulator)) {
if (PTR_ERR(priv->regulator) == -EPROBE_DEFER)
return -EPROBE_DEFER;
if (PTR_ERR(priv->regulator) == -EPROBE_DEFER) {
err = -EPROBE_DEFER;
goto out_clk_disable;
}
dev_err(dev, "no regulator found\n");
priv->regulator = NULL;
}
Expand Down
33 changes: 15 additions & 18 deletions drivers/net/ethernet/broadcom/bcmsysport.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,37 +729,33 @@ static unsigned int __bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
struct bcm_sysport_tx_ring *ring)
{
struct net_device *ndev = priv->netdev;
unsigned int c_index, last_c_index, last_tx_cn, num_tx_cbs;
unsigned int pkts_compl = 0, bytes_compl = 0;
unsigned int txbds_processed = 0;
struct bcm_sysport_cb *cb;
unsigned int txbds_ready;
unsigned int c_index;
u32 hw_ind;

/* Compute how many descriptors have been processed since last call */
hw_ind = tdma_readl(priv, TDMA_DESC_RING_PROD_CONS_INDEX(ring->index));
c_index = (hw_ind >> RING_CONS_INDEX_SHIFT) & RING_CONS_INDEX_MASK;
ring->p_index = (hw_ind & RING_PROD_INDEX_MASK);

last_c_index = ring->c_index;
num_tx_cbs = ring->size;

c_index &= (num_tx_cbs - 1);

if (c_index >= last_c_index)
last_tx_cn = c_index - last_c_index;
else
last_tx_cn = num_tx_cbs - last_c_index + c_index;
txbds_ready = (c_index - ring->c_index) & RING_CONS_INDEX_MASK;

netif_dbg(priv, tx_done, ndev,
"ring=%d c_index=%d last_tx_cn=%d last_c_index=%d\n",
ring->index, c_index, last_tx_cn, last_c_index);
"ring=%d old_c_index=%u c_index=%u txbds_ready=%u\n",
ring->index, ring->c_index, c_index, txbds_ready);

while (last_tx_cn-- > 0) {
cb = ring->cbs + last_c_index;
while (txbds_processed < txbds_ready) {
cb = &ring->cbs[ring->clean_index];
bcm_sysport_tx_reclaim_one(priv, cb, &bytes_compl, &pkts_compl);

ring->desc_count++;
last_c_index++;
last_c_index &= (num_tx_cbs - 1);
txbds_processed++;

if (likely(ring->clean_index < ring->size - 1))
ring->clean_index++;
else
ring->clean_index = 0;
}

ring->c_index = c_index;
Expand Down Expand Up @@ -1229,6 +1225,7 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv,
netif_napi_add(priv->netdev, &ring->napi, bcm_sysport_tx_poll, 64);
ring->index = index;
ring->size = size;
ring->clean_index = 0;
ring->alloc_size = ring->size;
ring->desc_cpu = p;
ring->desc_count = ring->size;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/bcmsysport.h
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ struct bcm_sysport_tx_ring {
unsigned int desc_count; /* Number of descriptors */
unsigned int curr_desc; /* Current descriptor */
unsigned int c_index; /* Last consumer index */
unsigned int p_index; /* Current producer index */
unsigned int clean_index; /* Current clean index */
struct bcm_sysport_cb *cbs; /* Transmit control blocks */
struct dma_desc *desc_cpu; /* CPU view of the descriptor */
struct bcm_sysport_priv *priv; /* private context backpointer */
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3539,6 +3539,8 @@ fec_drv_remove(struct platform_device *pdev)
fec_enet_mii_remove(fep);
if (fep->reg_phy)
regulator_disable(fep->reg_phy);
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
of_node_put(fep->phy_node);
free_netdev(ndev);

Expand Down
3 changes: 2 additions & 1 deletion drivers/net/ethernet/ti/cpsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,8 @@ static void _cpsw_adjust_link(struct cpsw_slave *slave,
/* set speed_in input in case RMII mode is used in 100Mbps */
if (phy->speed == 100)
mac_control |= BIT(15);
else if (phy->speed == 10)
/* in band mode only works in 10Mbps RGMII mode */
else if ((phy->speed == 10) && phy_interface_is_rgmii(phy))
mac_control |= BIT(18); /* In Band mode */

if (priv->rx_pause)
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/team/team.c
Original file line number Diff line number Diff line change
Expand Up @@ -2380,7 +2380,7 @@ static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq,
if (!nlh) {
err = __send_and_alloc_skb(&skb, team, portid, send_func);
if (err)
goto errout;
return err;
goto send_done;
}

Expand Down Expand Up @@ -2660,7 +2660,7 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq,
if (!nlh) {
err = __send_and_alloc_skb(&skb, team, portid, send_func);
if (err)
goto errout;
return err;
goto send_done;
}

Expand Down
21 changes: 15 additions & 6 deletions drivers/s390/net/qeth_core_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,7 @@ static inline int qeth_is_cq(struct qeth_card *card, unsigned int queue)
queue == card->qdio.no_in_queues - 1;
}


static int qeth_issue_next_read(struct qeth_card *card)
static int __qeth_issue_next_read(struct qeth_card *card)
{
int rc;
struct qeth_cmd_buffer *iob;
Expand Down Expand Up @@ -549,6 +548,17 @@ static int qeth_issue_next_read(struct qeth_card *card)
return rc;
}

static int qeth_issue_next_read(struct qeth_card *card)
{
int ret;

spin_lock_irq(get_ccwdev_lock(CARD_RDEV(card)));
ret = __qeth_issue_next_read(card);
spin_unlock_irq(get_ccwdev_lock(CARD_RDEV(card)));

return ret;
}

static struct qeth_reply *qeth_alloc_reply(struct qeth_card *card)
{
struct qeth_reply *reply;
Expand Down Expand Up @@ -952,7 +962,7 @@ void qeth_clear_thread_running_bit(struct qeth_card *card, unsigned long thread)
spin_lock_irqsave(&card->thread_mask_lock, flags);
card->thread_running_mask &= ~thread;
spin_unlock_irqrestore(&card->thread_mask_lock, flags);
wake_up(&card->wait_q);
wake_up_all(&card->wait_q);
}
EXPORT_SYMBOL_GPL(qeth_clear_thread_running_bit);

Expand Down Expand Up @@ -1156,6 +1166,7 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm,
}
rc = qeth_get_problem(cdev, irb);
if (rc) {
card->read_or_write_problem = 1;
qeth_clear_ipacmd_list(card);
qeth_schedule_recovery(card);
goto out;
Expand All @@ -1174,7 +1185,7 @@ static void qeth_irq(struct ccw_device *cdev, unsigned long intparm,
return;
if (channel == &card->read &&
channel->state == CH_STATE_UP)
qeth_issue_next_read(card);
__qeth_issue_next_read(card);

iob = channel->iob;
index = channel->buf_no;
Expand Down Expand Up @@ -4969,8 +4980,6 @@ static void qeth_core_free_card(struct qeth_card *card)
QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *));
qeth_clean_channel(&card->read);
qeth_clean_channel(&card->write);
if (card->dev)
free_netdev(card->dev);
kfree(card->ip_tbd_list);
qeth_free_qdio_buffers(card);
unregister_service_level(&card->qeth_service_level);
Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/net/qeth_l2_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,8 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev)
qeth_l2_set_offline(cgdev);

if (card->dev) {
netif_napi_del(&card->napi);
unregister_netdev(card->dev);
free_netdev(card->dev);
card->dev = NULL;
}
return;
Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/net/qeth_l3_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3243,8 +3243,8 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev)
qeth_l3_set_offline(cgdev);

if (card->dev) {
netif_napi_del(&card->napi);
unregister_netdev(card->dev);
free_netdev(card->dev);
card->dev = NULL;
}

Expand Down
5 changes: 3 additions & 2 deletions drivers/scsi/sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2075,11 +2075,12 @@ sg_get_rq_mark(Sg_fd * sfp, int pack_id)
if ((1 == resp->done) && (!resp->sg_io_owned) &&
((-1 == pack_id) || (resp->header.pack_id == pack_id))) {
resp->done = 2; /* guard against other readers */
break;
write_unlock_irqrestore(&sfp->rq_list_lock, iflags);
return resp;
}
}
write_unlock_irqrestore(&sfp->rq_list_lock, iflags);
return resp;
return NULL;
}

/* always adds to end of list */
Expand Down
4 changes: 1 addition & 3 deletions kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -1244,10 +1244,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
* set the trigger type must match. Also all must
* agree on ONESHOT.
*/
unsigned int oldtype = irqd_get_trigger_type(&desc->irq_data);

if (!((old->flags & new->flags) & IRQF_SHARED) ||
(oldtype != (new->flags & IRQF_TRIGGER_MASK)) ||
((old->flags ^ new->flags) & IRQF_TRIGGER_MASK) ||
((old->flags ^ new->flags) & IRQF_ONESHOT))
goto mismatch;

Expand Down
2 changes: 1 addition & 1 deletion net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -3597,7 +3597,7 @@ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)

skb_queue_tail(&sk->sk_error_queue, skb);
if (!sock_flag(sk, SOCK_DEAD))
sk->sk_data_ready(sk);
sk->sk_error_report(sk);
return 0;
}
EXPORT_SYMBOL(sock_queue_err_skb);
Expand Down
5 changes: 5 additions & 0 deletions net/dccp/proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,11 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (skb == NULL)
goto out_release;

if (sk->sk_state == DCCP_CLOSED) {
rc = -ENOTCONN;
goto out_discard;
}

skb_reserve(skb, sk->sk_prot->max_header);
rc = memcpy_from_msg(skb_put(skb, len), msg, len);
if (rc != 0)
Expand Down
12 changes: 8 additions & 4 deletions net/ieee802154/6lowpan/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,13 @@ static inline void lowpan_netlink_fini(void)
static int lowpan_device_event(struct notifier_block *unused,
unsigned long event, void *ptr)
{
struct net_device *wdev = netdev_notifier_info_to_dev(ptr);
struct net_device *ndev = netdev_notifier_info_to_dev(ptr);
struct wpan_dev *wpan_dev;

if (wdev->type != ARPHRD_IEEE802154)
if (ndev->type != ARPHRD_IEEE802154)
return NOTIFY_DONE;
wpan_dev = ndev->ieee802154_ptr;
if (!wpan_dev)
goto out;

switch (event) {
Expand All @@ -217,8 +221,8 @@ static int lowpan_device_event(struct notifier_block *unused,
* also delete possible lowpan interfaces which belongs
* to the wpan interface.
*/
if (wdev->ieee802154_ptr->lowpan_dev)
lowpan_dellink(wdev->ieee802154_ptr->lowpan_dev, NULL);
if (wpan_dev->lowpan_dev)
lowpan_dellink(wpan_dev->lowpan_dev, NULL);
break;
default:
break;
Expand Down
3 changes: 3 additions & 0 deletions net/ipv4/inet_fragment.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ static void inet_frag_secret_rebuild(struct inet_frags *f)

static bool inet_fragq_should_evict(const struct inet_frag_queue *q)
{
if (!hlist_unhashed(&q->list_evictor))
return false;

return q->net->low_thresh == 0 ||
frag_mem_limit(q->net) >= q->net->low_thresh;
}
Expand Down
6 changes: 4 additions & 2 deletions net/ipv4/ip_sockglue.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc,
src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg);
if (!ipv6_addr_v4mapped(&src_info->ipi6_addr))
return -EINVAL;
ipc->oif = src_info->ipi6_ifindex;
if (src_info->ipi6_ifindex)
ipc->oif = src_info->ipi6_ifindex;
ipc->addr = src_info->ipi6_addr.s6_addr32[3];
continue;
}
Expand All @@ -264,7 +265,8 @@ int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc,
if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct in_pktinfo)))
return -EINVAL;
info = (struct in_pktinfo *)CMSG_DATA(cmsg);
ipc->oif = info->ipi_ifindex;
if (info->ipi_ifindex)
ipc->oif = info->ipi_ifindex;
ipc->addr = info->ipi_spec_dst.s_addr;
break;
}
Expand Down
3 changes: 2 additions & 1 deletion net/ipv6/ndisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1480,7 +1480,8 @@ static void ndisc_fill_redirect_hdr_option(struct sk_buff *skb,
*(opt++) = (rd_len >> 3);
opt += 6;

memcpy(opt, ipv6_hdr(orig_skb), rd_len - 8);
skb_copy_bits(orig_skb, skb_network_offset(orig_skb), opt,
rd_len - 8);
}

void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
Expand Down
4 changes: 3 additions & 1 deletion net/iucv/af_iucv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2381,9 +2381,11 @@ static int afiucv_iucv_init(void)
af_iucv_dev->driver = &af_iucv_driver;
err = device_register(af_iucv_dev);
if (err)
goto out_driver;
goto out_iucv_dev;
return 0;

out_iucv_dev:
put_device(af_iucv_dev);
out_driver:
driver_unregister(&af_iucv_driver);
out_iucv:
Expand Down
8 changes: 6 additions & 2 deletions net/l2tp/l2tp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,17 +1518,21 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32
encap = cfg->encap;

/* Quick sanity checks */
err = -EPROTONOSUPPORT;
if (sk->sk_type != SOCK_DGRAM) {
pr_debug("tunl %hu: fd %d wrong socket type\n",
tunnel_id, fd);
goto err;
}
switch (encap) {
case L2TP_ENCAPTYPE_UDP:
err = -EPROTONOSUPPORT;
if (sk->sk_protocol != IPPROTO_UDP) {
pr_err("tunl %hu: fd %d wrong protocol, got %d, expected %d\n",
tunnel_id, fd, sk->sk_protocol, IPPROTO_UDP);
goto err;
}
break;
case L2TP_ENCAPTYPE_IP:
err = -EPROTONOSUPPORT;
if (sk->sk_protocol != IPPROTO_L2TP) {
pr_err("tunl %hu: fd %d wrong protocol, got %d, expected %d\n",
tunnel_id, fd, sk->sk_protocol, IPPROTO_L2TP);
Expand Down
2 changes: 1 addition & 1 deletion net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ static int genlmsg_mcast(struct sk_buff *skb, u32 portid, unsigned long group,
if (!err)
delivered = true;
else if (err != -ESRCH)
goto error;
return err;
return delivered ? 0 : -ESRCH;
error:
kfree_skb(skb);
Expand Down

0 comments on commit cb887f5

Please sign in to comment.