Merge branch 'android-4.14-stable' of https://github.com/aosp-mirror/kernel_common into 14.0
This commit is contained in:
2
Makefile
2
Makefile
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
VERSION = 4
|
||||
PATCHLEVEL = 14
|
||||
SUBLEVEL = 332
|
||||
SUBLEVEL = 333
|
||||
EXTRAVERSION =
|
||||
NAME = Petit Gorille
|
||||
|
||||
|
||||
@@ -667,7 +667,7 @@ void ptep_zap_unused(struct mm_struct *mm, unsigned long addr,
|
||||
pte_clear(mm, addr, ptep);
|
||||
}
|
||||
if (reset)
|
||||
pgste_val(pgste) &= ~_PGSTE_GPS_USAGE_MASK;
|
||||
pgste_val(pgste) &= ~(_PGSTE_GPS_USAGE_MASK | _PGSTE_GPS_NODAT);
|
||||
pgste_set_unlock(ptep, pgste);
|
||||
preempt_enable();
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data)
|
||||
}
|
||||
|
||||
for (i = 0; i < p->nchunks; i++) {
|
||||
struct drm_amdgpu_cs_chunk __user **chunk_ptr = NULL;
|
||||
struct drm_amdgpu_cs_chunk __user *chunk_ptr = NULL;
|
||||
struct drm_amdgpu_cs_chunk user_chunk;
|
||||
uint32_t __user *cdata;
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ ACPI_MODULE_NAME(ACPI_POWER_METER_NAME);
|
||||
#define POWER_METER_CAN_NOTIFY (1 << 3)
|
||||
#define POWER_METER_IS_BATTERY (1 << 8)
|
||||
#define UNKNOWN_HYSTERESIS 0xFFFFFFFF
|
||||
#define UNKNOWN_POWER 0xFFFFFFFF
|
||||
|
||||
#define METER_NOTIFY_CONFIG 0x80
|
||||
#define METER_NOTIFY_TRIP 0x81
|
||||
@@ -356,6 +357,9 @@ static ssize_t show_power(struct device *dev,
|
||||
update_meter(resource);
|
||||
mutex_unlock(&resource->lock);
|
||||
|
||||
if (resource->power == UNKNOWN_POWER)
|
||||
return -ENODATA;
|
||||
|
||||
return sprintf(buf, "%llu\n", resource->power * 1000);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ static char version[] =
|
||||
BNXT_RE_DESC " v" ROCE_DRV_MODULE_VERSION "\n";
|
||||
|
||||
MODULE_AUTHOR("Eddie Wai <eddie.wai@broadcom.com>");
|
||||
MODULE_DESCRIPTION(BNXT_RE_DESC " Driver");
|
||||
MODULE_DESCRIPTION(BNXT_RE_DESC);
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
|
||||
/* globals */
|
||||
|
||||
@@ -6844,7 +6844,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)
|
||||
desc_idx, *post_ptr);
|
||||
drop_it_no_recycle:
|
||||
/* Other statistics kept track of by card. */
|
||||
tp->rx_dropped++;
|
||||
tnapi->rx_dropped++;
|
||||
goto next_pkt;
|
||||
}
|
||||
|
||||
@@ -7872,8 +7872,10 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi *tnapi,
|
||||
|
||||
segs = skb_gso_segment(skb, tp->dev->features &
|
||||
~(NETIF_F_TSO | NETIF_F_TSO6));
|
||||
if (IS_ERR(segs) || !segs)
|
||||
if (IS_ERR(segs) || !segs) {
|
||||
tnapi->tx_dropped++;
|
||||
goto tg3_tso_bug_end;
|
||||
}
|
||||
|
||||
do {
|
||||
nskb = segs;
|
||||
@@ -8146,7 +8148,7 @@ dma_error:
|
||||
drop:
|
||||
dev_kfree_skb_any(skb);
|
||||
drop_nofree:
|
||||
tp->tx_dropped++;
|
||||
tnapi->tx_dropped++;
|
||||
return NETDEV_TX_OK;
|
||||
}
|
||||
|
||||
@@ -9325,7 +9327,7 @@ static void __tg3_set_rx_mode(struct net_device *);
|
||||
/* tp->lock is held. */
|
||||
static int tg3_halt(struct tg3 *tp, int kind, bool silent)
|
||||
{
|
||||
int err;
|
||||
int err, i;
|
||||
|
||||
tg3_stop_fw(tp);
|
||||
|
||||
@@ -9346,6 +9348,13 @@ static int tg3_halt(struct tg3 *tp, int kind, bool silent)
|
||||
|
||||
/* And make sure the next sample is new data */
|
||||
memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats));
|
||||
|
||||
for (i = 0; i < TG3_IRQ_MAX_VECS; ++i) {
|
||||
struct tg3_napi *tnapi = &tp->napi[i];
|
||||
|
||||
tnapi->rx_dropped = 0;
|
||||
tnapi->tx_dropped = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
@@ -11889,6 +11898,9 @@ static void tg3_get_nstats(struct tg3 *tp, struct rtnl_link_stats64 *stats)
|
||||
{
|
||||
struct rtnl_link_stats64 *old_stats = &tp->net_stats_prev;
|
||||
struct tg3_hw_stats *hw_stats = tp->hw_stats;
|
||||
unsigned long rx_dropped;
|
||||
unsigned long tx_dropped;
|
||||
int i;
|
||||
|
||||
stats->rx_packets = old_stats->rx_packets +
|
||||
get_stat64(&hw_stats->rx_ucast_packets) +
|
||||
@@ -11935,8 +11947,26 @@ static void tg3_get_nstats(struct tg3 *tp, struct rtnl_link_stats64 *stats)
|
||||
stats->rx_missed_errors = old_stats->rx_missed_errors +
|
||||
get_stat64(&hw_stats->rx_discards);
|
||||
|
||||
stats->rx_dropped = tp->rx_dropped;
|
||||
stats->tx_dropped = tp->tx_dropped;
|
||||
/* Aggregate per-queue counters. The per-queue counters are updated
|
||||
* by a single writer, race-free. The result computed by this loop
|
||||
* might not be 100% accurate (counters can be updated in the middle of
|
||||
* the loop) but the next tg3_get_nstats() will recompute the current
|
||||
* value so it is acceptable.
|
||||
*
|
||||
* Note that these counters wrap around at 4G on 32bit machines.
|
||||
*/
|
||||
rx_dropped = (unsigned long)(old_stats->rx_dropped);
|
||||
tx_dropped = (unsigned long)(old_stats->tx_dropped);
|
||||
|
||||
for (i = 0; i < tp->irq_cnt; i++) {
|
||||
struct tg3_napi *tnapi = &tp->napi[i];
|
||||
|
||||
rx_dropped += tnapi->rx_dropped;
|
||||
tx_dropped += tnapi->tx_dropped;
|
||||
}
|
||||
|
||||
stats->rx_dropped = rx_dropped;
|
||||
stats->tx_dropped = tx_dropped;
|
||||
}
|
||||
|
||||
static int tg3_get_regs_len(struct net_device *dev)
|
||||
|
||||
@@ -3005,6 +3005,7 @@ struct tg3_napi {
|
||||
u16 *rx_rcb_prod_idx;
|
||||
struct tg3_rx_prodring_set prodring;
|
||||
struct tg3_rx_buffer_desc *rx_rcb;
|
||||
unsigned long rx_dropped;
|
||||
|
||||
u32 tx_prod ____cacheline_aligned;
|
||||
u32 tx_cons;
|
||||
@@ -3013,6 +3014,7 @@ struct tg3_napi {
|
||||
u32 prodmbox;
|
||||
struct tg3_tx_buffer_desc *tx_ring;
|
||||
struct tg3_tx_ring_info *tx_buffers;
|
||||
unsigned long tx_dropped;
|
||||
|
||||
dma_addr_t status_mapping;
|
||||
dma_addr_t rx_rcb_mapping;
|
||||
@@ -3206,8 +3208,6 @@ struct tg3 {
|
||||
|
||||
|
||||
/* begin "everything else" cacheline(s) section */
|
||||
unsigned long rx_dropped;
|
||||
unsigned long tx_dropped;
|
||||
struct rtnl_link_stats64 net_stats_prev;
|
||||
struct tg3_ethtool_stats estats_prev;
|
||||
|
||||
|
||||
@@ -70,6 +70,27 @@ static enum mac_mode hns_get_enet_interface(const struct hns_mac_cb *mac_cb)
|
||||
}
|
||||
}
|
||||
|
||||
static u32 hns_mac_link_anti_shake(struct mac_driver *mac_ctrl_drv)
|
||||
{
|
||||
#define HNS_MAC_LINK_WAIT_TIME 5
|
||||
#define HNS_MAC_LINK_WAIT_CNT 40
|
||||
|
||||
u32 link_status = 0;
|
||||
int i;
|
||||
|
||||
if (!mac_ctrl_drv->get_link_status)
|
||||
return link_status;
|
||||
|
||||
for (i = 0; i < HNS_MAC_LINK_WAIT_CNT; i++) {
|
||||
msleep(HNS_MAC_LINK_WAIT_TIME);
|
||||
mac_ctrl_drv->get_link_status(mac_ctrl_drv, &link_status);
|
||||
if (!link_status)
|
||||
break;
|
||||
}
|
||||
|
||||
return link_status;
|
||||
}
|
||||
|
||||
void hns_mac_get_link_status(struct hns_mac_cb *mac_cb, u32 *link_status)
|
||||
{
|
||||
struct mac_driver *mac_ctrl_drv;
|
||||
@@ -87,6 +108,14 @@ void hns_mac_get_link_status(struct hns_mac_cb *mac_cb, u32 *link_status)
|
||||
&sfp_prsnt);
|
||||
if (!ret)
|
||||
*link_status = *link_status && sfp_prsnt;
|
||||
|
||||
/* for FIBER port, it may have a fake link up.
|
||||
* when the link status changes from down to up, we need to do
|
||||
* anti-shake. the anti-shake time is base on tests.
|
||||
* only FIBER port need to do this.
|
||||
*/
|
||||
if (*link_status && !mac_cb->link)
|
||||
*link_status = hns_mac_link_anti_shake(mac_ctrl_drv);
|
||||
}
|
||||
|
||||
mac_cb->link = *link_status;
|
||||
|
||||
@@ -2647,6 +2647,8 @@ enum parport_pc_pci_cards {
|
||||
netmos_9865,
|
||||
quatech_sppxp100,
|
||||
wch_ch382l,
|
||||
brainboxes_uc146,
|
||||
brainboxes_px203,
|
||||
};
|
||||
|
||||
|
||||
@@ -2710,6 +2712,8 @@ static struct parport_pc_pci {
|
||||
/* netmos_9865 */ { 1, { { 0, -1 }, } },
|
||||
/* quatech_sppxp100 */ { 1, { { 0, 1 }, } },
|
||||
/* wch_ch382l */ { 1, { { 2, -1 }, } },
|
||||
/* brainboxes_uc146 */ { 1, { { 3, -1 }, } },
|
||||
/* brainboxes_px203 */ { 1, { { 0, -1 }, } },
|
||||
};
|
||||
|
||||
static const struct pci_device_id parport_pc_pci_tbl[] = {
|
||||
@@ -2801,6 +2805,23 @@ static const struct pci_device_id parport_pc_pci_tbl[] = {
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, quatech_sppxp100 },
|
||||
/* WCH CH382L PCI-E single parallel port card */
|
||||
{ 0x1c00, 0x3050, 0x1c00, 0x3050, 0, 0, wch_ch382l },
|
||||
/* Brainboxes IX-500/550 */
|
||||
{ PCI_VENDOR_ID_INTASHIELD, 0x402a,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_pcie_pport },
|
||||
/* Brainboxes UC-146/UC-157 */
|
||||
{ PCI_VENDOR_ID_INTASHIELD, 0x0be1,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, brainboxes_uc146 },
|
||||
{ PCI_VENDOR_ID_INTASHIELD, 0x0be2,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, brainboxes_uc146 },
|
||||
/* Brainboxes PX-146/PX-257 */
|
||||
{ PCI_VENDOR_ID_INTASHIELD, 0x401c,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_pcie_pport },
|
||||
/* Brainboxes PX-203 */
|
||||
{ PCI_VENDOR_ID_INTASHIELD, 0x4007,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, brainboxes_px203 },
|
||||
/* Brainboxes PX-475 */
|
||||
{ PCI_VENDOR_ID_INTASHIELD, 0x401f,
|
||||
PCI_ANY_ID, PCI_ANY_ID, 0, 0, oxsemi_pcie_pport },
|
||||
{ 0, } /* terminate list */
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, parport_pc_pci_tbl);
|
||||
|
||||
@@ -2690,6 +2690,7 @@ init_wrb_hndl_failed:
|
||||
kfree(pwrb_context->pwrb_handle_base);
|
||||
kfree(pwrb_context->pwrb_handle_basestd);
|
||||
}
|
||||
kfree(phwi_ctxt->be_wrbq);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
||||
@@ -179,6 +179,7 @@ static int __init early_omap8250_setup(struct earlycon_device *device,
|
||||
OF_EARLYCON_DECLARE(omap8250, "ti,omap2-uart", early_omap8250_setup);
|
||||
OF_EARLYCON_DECLARE(omap8250, "ti,omap3-uart", early_omap8250_setup);
|
||||
OF_EARLYCON_DECLARE(omap8250, "ti,omap4-uart", early_omap8250_setup);
|
||||
OF_EARLYCON_DECLARE(omap8250, "ti,am654-uart", early_omap8250_setup);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -699,6 +699,18 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno)
|
||||
case SC16IS7XX_IIR_RTOI_SRC:
|
||||
case SC16IS7XX_IIR_XOFFI_SRC:
|
||||
rxlen = sc16is7xx_port_read(port, SC16IS7XX_RXLVL_REG);
|
||||
|
||||
/*
|
||||
* There is a silicon bug that makes the chip report a
|
||||
* time-out interrupt but no data in the FIFO. This is
|
||||
* described in errata section 18.1.4.
|
||||
*
|
||||
* When this happens, read one byte from the FIFO to
|
||||
* clear the interrupt.
|
||||
*/
|
||||
if (iir == SC16IS7XX_IIR_RTOI_SRC && !rxlen)
|
||||
rxlen = 1;
|
||||
|
||||
if (rxlen)
|
||||
sc16is7xx_handle_rx(port, rxlen, iir);
|
||||
break;
|
||||
|
||||
@@ -513,15 +513,38 @@ int nilfs_sufile_mark_dirty(struct inode *sufile, __u64 segnum)
|
||||
|
||||
down_write(&NILFS_MDT(sufile)->mi_sem);
|
||||
ret = nilfs_sufile_get_segment_usage_block(sufile, segnum, 0, &bh);
|
||||
if (!ret) {
|
||||
mark_buffer_dirty(bh);
|
||||
nilfs_mdt_mark_dirty(sufile);
|
||||
kaddr = kmap_atomic(bh->b_page);
|
||||
su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr);
|
||||
nilfs_segment_usage_set_dirty(su);
|
||||
if (ret)
|
||||
goto out_sem;
|
||||
|
||||
kaddr = kmap_atomic(bh->b_page);
|
||||
su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr);
|
||||
if (unlikely(nilfs_segment_usage_error(su))) {
|
||||
struct the_nilfs *nilfs = sufile->i_sb->s_fs_info;
|
||||
|
||||
kunmap_atomic(kaddr);
|
||||
brelse(bh);
|
||||
if (nilfs_segment_is_active(nilfs, segnum)) {
|
||||
nilfs_error(sufile->i_sb,
|
||||
"active segment %llu is erroneous",
|
||||
(unsigned long long)segnum);
|
||||
} else {
|
||||
/*
|
||||
* Segments marked erroneous are never allocated by
|
||||
* nilfs_sufile_alloc(); only active segments, ie,
|
||||
* the segments indexed by ns_segnum or ns_nextnum,
|
||||
* can be erroneous here.
|
||||
*/
|
||||
WARN_ON_ONCE(1);
|
||||
}
|
||||
ret = -EIO;
|
||||
} else {
|
||||
nilfs_segment_usage_set_dirty(su);
|
||||
kunmap_atomic(kaddr);
|
||||
mark_buffer_dirty(bh);
|
||||
nilfs_mdt_mark_dirty(sufile);
|
||||
brelse(bh);
|
||||
}
|
||||
out_sem:
|
||||
up_write(&NILFS_MDT(sufile)->mi_sem);
|
||||
return ret;
|
||||
}
|
||||
@@ -548,9 +571,14 @@ int nilfs_sufile_set_segment_usage(struct inode *sufile, __u64 segnum,
|
||||
|
||||
kaddr = kmap_atomic(bh->b_page);
|
||||
su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr);
|
||||
WARN_ON(nilfs_segment_usage_error(su));
|
||||
if (modtime)
|
||||
if (modtime) {
|
||||
/*
|
||||
* Check segusage error and set su_lastmod only when updating
|
||||
* this entry with a valid timestamp, not for cancellation.
|
||||
*/
|
||||
WARN_ON_ONCE(nilfs_segment_usage_error(su));
|
||||
su->su_lastmod = cpu_to_le64(modtime);
|
||||
}
|
||||
su->su_nblocks = cpu_to_le32(nblocks);
|
||||
kunmap_atomic(kaddr);
|
||||
|
||||
|
||||
@@ -697,7 +697,11 @@ int init_nilfs(struct the_nilfs *nilfs, struct super_block *sb, char *data)
|
||||
goto failed_sbh;
|
||||
}
|
||||
nilfs_release_super_block(nilfs);
|
||||
sb_set_blocksize(sb, blocksize);
|
||||
if (!sb_set_blocksize(sb, blocksize)) {
|
||||
nilfs_msg(sb, KERN_ERR, "bad blocksize %d", blocksize);
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
err = nilfs_load_super_block(nilfs, sb, blocksize, &sbp);
|
||||
if (err)
|
||||
|
||||
@@ -11,9 +11,12 @@
|
||||
/**
|
||||
* struct genl_multicast_group - generic netlink multicast group
|
||||
* @name: name of the multicast group, names are per-family
|
||||
* @cap_sys_admin: whether %CAP_SYS_ADMIN is required for binding
|
||||
*/
|
||||
struct genl_multicast_group {
|
||||
char name[GENL_NAMSIZ];
|
||||
u8 flags;
|
||||
u8 cap_sys_admin:1;
|
||||
};
|
||||
|
||||
struct genl_ops;
|
||||
|
||||
@@ -2212,8 +2212,11 @@ void trace_buffered_event_enable(void)
|
||||
for_each_tracing_cpu(cpu) {
|
||||
page = alloc_pages_node(cpu_to_node(cpu),
|
||||
GFP_KERNEL | __GFP_NORETRY, 0);
|
||||
if (!page)
|
||||
goto failed;
|
||||
/* This is just an optimization and can handle failures */
|
||||
if (!page) {
|
||||
pr_err("Failed to allocate event buffer\n");
|
||||
break;
|
||||
}
|
||||
|
||||
event = page_address(page);
|
||||
memset(event, 0, sizeof(*event));
|
||||
@@ -2227,10 +2230,6 @@ void trace_buffered_event_enable(void)
|
||||
WARN_ON_ONCE(1);
|
||||
preempt_enable();
|
||||
}
|
||||
|
||||
return;
|
||||
failed:
|
||||
trace_buffered_event_disable();
|
||||
}
|
||||
|
||||
static void enable_trace_buffered_event(void *data)
|
||||
@@ -2265,11 +2264,9 @@ void trace_buffered_event_disable(void)
|
||||
if (--trace_buffered_event_ref)
|
||||
return;
|
||||
|
||||
preempt_disable();
|
||||
/* For each CPU, set the buffer as used. */
|
||||
smp_call_function_many(tracing_buffer_mask,
|
||||
disable_trace_buffered_event, NULL, 1);
|
||||
preempt_enable();
|
||||
on_each_cpu_mask(tracing_buffer_mask, disable_trace_buffered_event,
|
||||
NULL, true);
|
||||
|
||||
/* Wait for all current users to finish */
|
||||
synchronize_rcu();
|
||||
@@ -2278,17 +2275,19 @@ void trace_buffered_event_disable(void)
|
||||
free_page((unsigned long)per_cpu(trace_buffered_event, cpu));
|
||||
per_cpu(trace_buffered_event, cpu) = NULL;
|
||||
}
|
||||
/*
|
||||
* Make sure trace_buffered_event is NULL before clearing
|
||||
* trace_buffered_event_cnt.
|
||||
*/
|
||||
smp_wmb();
|
||||
|
||||
preempt_disable();
|
||||
/* Do the work on each cpu */
|
||||
smp_call_function_many(tracing_buffer_mask,
|
||||
enable_trace_buffered_event, NULL, 1);
|
||||
preempt_enable();
|
||||
/*
|
||||
* Wait for all CPUs that potentially started checking if they can use
|
||||
* their event buffer only after the previous synchronize_rcu() call and
|
||||
* they still read a valid pointer from trace_buffered_event. It must be
|
||||
* ensured they don't see cleared trace_buffered_event_cnt else they
|
||||
* could wrongly decide to use the pointed-to buffer which is now freed.
|
||||
*/
|
||||
synchronize_rcu();
|
||||
|
||||
/* For each CPU, relinquish the buffer */
|
||||
on_each_cpu_mask(tracing_buffer_mask, enable_trace_buffered_event, NULL,
|
||||
true);
|
||||
}
|
||||
|
||||
static struct ring_buffer *temp_buffer;
|
||||
@@ -5263,8 +5262,7 @@ static int __tracing_resize_ring_buffer(struct trace_array *tr,
|
||||
return ret;
|
||||
|
||||
#ifdef CONFIG_TRACER_MAX_TRACE
|
||||
if (!(tr->flags & TRACE_ARRAY_FL_GLOBAL) ||
|
||||
!tr->current_trace->use_max_tr)
|
||||
if (!tr->current_trace->use_max_tr)
|
||||
goto out;
|
||||
|
||||
ret = ring_buffer_resize(tr->max_buffer.buffer, size, cpu);
|
||||
|
||||
@@ -122,7 +122,7 @@ out:
|
||||
}
|
||||
|
||||
static const struct genl_multicast_group dropmon_mcgrps[] = {
|
||||
{ .name = "events", },
|
||||
{ .name = "events", .cap_sys_admin = 1 },
|
||||
};
|
||||
|
||||
static void send_dm_alert(struct work_struct *work)
|
||||
@@ -370,10 +370,12 @@ static const struct genl_ops dropmon_ops[] = {
|
||||
{
|
||||
.cmd = NET_DM_CMD_START,
|
||||
.doit = net_dm_cmd_trace,
|
||||
.flags = GENL_ADMIN_PERM,
|
||||
},
|
||||
{
|
||||
.cmd = NET_DM_CMD_STOP,
|
||||
.doit = net_dm_cmd_trace,
|
||||
.flags = GENL_ADMIN_PERM,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -3633,8 +3633,12 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
|
||||
* then we can probably ignore it.
|
||||
*/
|
||||
if (before(ack, prior_snd_una)) {
|
||||
u32 max_window;
|
||||
|
||||
/* do not accept ACK for bytes we never sent. */
|
||||
max_window = min_t(u64, tp->max_window, tp->bytes_acked);
|
||||
/* RFC 5961 5.2 [Blind Data Injection Attack].[Mitigation] */
|
||||
if (before(ack, prior_snd_una - tp->max_window)) {
|
||||
if (before(ack, prior_snd_una - max_window)) {
|
||||
if (!(flag & FLAG_NO_CHALLENGE_ACK))
|
||||
tcp_send_challenge_ack(sk, skb);
|
||||
return -1;
|
||||
|
||||
@@ -1001,7 +1001,6 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
netlink_lock_table();
|
||||
if (nlk->netlink_bind && groups) {
|
||||
int group;
|
||||
|
||||
@@ -1013,13 +1012,14 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
|
||||
if (!err)
|
||||
continue;
|
||||
netlink_undo_bind(group, groups, sk);
|
||||
goto unlock;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
/* No need for barriers here as we return to user-space without
|
||||
* using any of the bound attributes.
|
||||
*/
|
||||
netlink_lock_table();
|
||||
if (!bound) {
|
||||
err = nladdr->nl_pid ?
|
||||
netlink_insert(sk, nladdr->nl_pid) :
|
||||
|
||||
@@ -961,11 +961,46 @@ static struct genl_family genl_ctrl __ro_after_init = {
|
||||
.netnsok = true,
|
||||
};
|
||||
|
||||
static int genl_bind(struct net *net, int group)
|
||||
{
|
||||
const struct genl_family *family;
|
||||
unsigned int id;
|
||||
int ret = 0;
|
||||
|
||||
genl_lock_all();
|
||||
|
||||
idr_for_each_entry(&genl_fam_idr, family, id) {
|
||||
const struct genl_multicast_group *grp;
|
||||
int i;
|
||||
|
||||
if (family->n_mcgrps == 0)
|
||||
continue;
|
||||
|
||||
i = group - family->mcgrp_offset;
|
||||
if (i < 0 || i >= family->n_mcgrps)
|
||||
continue;
|
||||
|
||||
grp = &family->mcgrps[i];
|
||||
if ((grp->flags & GENL_UNS_ADMIN_PERM) &&
|
||||
!ns_capable(net->user_ns, CAP_NET_ADMIN))
|
||||
ret = -EPERM;
|
||||
if (grp->cap_sys_admin &&
|
||||
!ns_capable(net->user_ns, CAP_SYS_ADMIN))
|
||||
ret = -EPERM;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
genl_unlock_all();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __net_init genl_pernet_init(struct net *net)
|
||||
{
|
||||
struct netlink_kernel_cfg cfg = {
|
||||
.input = genl_rcv,
|
||||
.flags = NL_CFG_F_NONROOT_RECV,
|
||||
.bind = genl_bind,
|
||||
};
|
||||
|
||||
/* we'll bump the group number right afterwards */
|
||||
|
||||
@@ -4272,7 +4272,7 @@ static void packet_mm_open(struct vm_area_struct *vma)
|
||||
struct sock *sk = sock->sk;
|
||||
|
||||
if (sk)
|
||||
atomic_inc(&pkt_sk(sk)->mapped);
|
||||
atomic_long_inc(&pkt_sk(sk)->mapped);
|
||||
}
|
||||
|
||||
static void packet_mm_close(struct vm_area_struct *vma)
|
||||
@@ -4282,7 +4282,7 @@ static void packet_mm_close(struct vm_area_struct *vma)
|
||||
struct sock *sk = sock->sk;
|
||||
|
||||
if (sk)
|
||||
atomic_dec(&pkt_sk(sk)->mapped);
|
||||
atomic_long_dec(&pkt_sk(sk)->mapped);
|
||||
}
|
||||
|
||||
static const struct vm_operations_struct packet_mmap_ops = {
|
||||
@@ -4377,7 +4377,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
|
||||
|
||||
err = -EBUSY;
|
||||
if (!closing) {
|
||||
if (atomic_read(&po->mapped))
|
||||
if (atomic_long_read(&po->mapped))
|
||||
goto out;
|
||||
if (packet_read_pending(rb))
|
||||
goto out;
|
||||
@@ -4480,7 +4480,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
|
||||
|
||||
err = -EBUSY;
|
||||
mutex_lock(&po->pg_vec_lock);
|
||||
if (closing || atomic_read(&po->mapped) == 0) {
|
||||
if (closing || atomic_long_read(&po->mapped) == 0) {
|
||||
err = 0;
|
||||
spin_lock_bh(&rb_queue->lock);
|
||||
swap(rb->pg_vec, pg_vec);
|
||||
@@ -4498,9 +4498,9 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
|
||||
po->prot_hook.func = (po->rx_ring.pg_vec) ?
|
||||
tpacket_rcv : packet_rcv;
|
||||
skb_queue_purge(rb_queue);
|
||||
if (atomic_read(&po->mapped))
|
||||
pr_err("packet_mmap: vma is busy: %d\n",
|
||||
atomic_read(&po->mapped));
|
||||
if (atomic_long_read(&po->mapped))
|
||||
pr_err("packet_mmap: vma is busy: %ld\n",
|
||||
atomic_long_read(&po->mapped));
|
||||
}
|
||||
mutex_unlock(&po->pg_vec_lock);
|
||||
|
||||
@@ -4578,7 +4578,7 @@ static int packet_mmap(struct file *file, struct socket *sock,
|
||||
}
|
||||
}
|
||||
|
||||
atomic_inc(&po->mapped);
|
||||
atomic_long_inc(&po->mapped);
|
||||
vma->vm_ops = &packet_mmap_ops;
|
||||
err = 0;
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ struct packet_sock {
|
||||
__be16 num;
|
||||
struct packet_rollover *rollover;
|
||||
struct packet_mclist *mclist;
|
||||
atomic_t mapped;
|
||||
atomic_long_t mapped;
|
||||
enum tpacket_versions tp_version;
|
||||
unsigned int tp_hdrlen;
|
||||
unsigned int tp_reserve;
|
||||
|
||||
@@ -31,7 +31,8 @@ enum psample_nl_multicast_groups {
|
||||
|
||||
static const struct genl_multicast_group psample_nl_mcgrps[] = {
|
||||
[PSAMPLE_NL_MCGRP_CONFIG] = { .name = PSAMPLE_NL_MCGRP_CONFIG_NAME },
|
||||
[PSAMPLE_NL_MCGRP_SAMPLE] = { .name = PSAMPLE_NL_MCGRP_SAMPLE_NAME },
|
||||
[PSAMPLE_NL_MCGRP_SAMPLE] = { .name = PSAMPLE_NL_MCGRP_SAMPLE_NAME,
|
||||
.flags = GENL_UNS_ADMIN_PERM },
|
||||
};
|
||||
|
||||
static struct genl_family psample_nl_family __ro_after_init;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -266,6 +266,7 @@ static char *snd_pcm_state_names[] = {
|
||||
STATE(DRAINING),
|
||||
STATE(PAUSED),
|
||||
STATE(SUSPENDED),
|
||||
STATE(DISCONNECTED),
|
||||
};
|
||||
|
||||
static char *snd_pcm_access_names[] = {
|
||||
|
||||
Reference in New Issue
Block a user