This is the 4.4.94 stable release

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAlnrYxcACgkQONu9yGCS
 aT6VpQ/9GzBA59FGi6ohxZnrUR35+U5Ehuw0IZo4JTUTrlj28QozeV6dBAdgQHLH
 eGcejtzAsD39m7JjmBzkxiBBlCH9nQkq5IaUrJG6q5dYoTCYMLzHwQLgPSbrhbnS
 hCSeHdJ0fevw9tKQELtWlIiG1iOULrWATf4MtpOCHcRmpxxSMRi22yQ4vKD2Vz4y
 TdKb5c8bYjJoEqbtON4wKIiEK1JfyO80E4eZtNK7FXI+XX1WI65pum9/NBiDqB78
 K0sK1t5pSJHvDgMwtOJ7Nxzcwle1cG3xm7NhZhNCfF9OWedCy+ZCc+e48T+TeoF4
 UDHIhEvhOOOf/W3dRBQQj8VElj0zt92I+ivsWxKmheY9JzJdOvq2pTQoPAtLsBMD
 /mChCvMSNEcHTfLYrm6Bjap0e6D10n1oUHX7jgLtq04EcX9Rh2zgYvL9u9QFLjFx
 sAgTp+kmScgj0fi0XgiXJxj8mPc2MpTVmSUjcwAZD+N9Kuafkqbf3ZddZJiGyPfw
 v4ZiAdUAtACdOaIRVPRUcG2fyLfKYqg2bFsif4Z67/0RmNf3C3rJpS9yX+Q36zCo
 f66xbvysN3pRiME0obenrsxBJ0LvIkSVskxV0+5x0UfP5pOdf7jZqqpkr6IFMtLZ
 /o4DYV+Da/qeYZQnmvF0BEvEnnX8GJFIJ+9RSbz9mAWcCWtWxTU=
 =gevA
 -----END PGP SIGNATURE-----

Merge 4.4.94 into android-4.4

Changes in 4.4.94
	percpu: make this_cpu_generic_read() atomic w.r.t. interrupts
	drm/dp/mst: save vcpi with payloads
	MIPS: Fix minimum alignment requirement of IRQ stack
	sctp: potential read out of bounds in sctp_ulpevent_type_enabled()
	bpf/verifier: reject BPF_ALU64|BPF_END
	udpv6: Fix the checksum computation when HW checksum does not apply
	ip6_gre: skb_push ipv6hdr before packing the header in ip6gre_header
	net: emac: Fix napi poll list corruption
	packet: hold bind lock when rebinding to fanout hook
	bpf: one perf event close won't free bpf program attached by another perf event
	isdn/i4l: fetch the ppp_write buffer in one shot
	vti: fix use after free in vti_tunnel_xmit/vti6_tnl_xmit
	l2tp: Avoid schedule while atomic in exit_net
	l2tp: fix race condition in l2tp_tunnel_delete
	tun: bail out from tun_get_user() if the skb is empty
	packet: in packet_do_bind, test fanout with bind_lock held
	packet: only test po->has_vnet_hdr once in packet_snd
	net: Set sk_prot_creator when cloning sockets to the right proto
	tipc: use only positive error codes in messages
	Revert "bsg-lib: don't free job in bsg_prepare_job"
	locking/lockdep: Add nest_lock integrity test
	watchdog: kempld: fix gcc-4.3 build
	irqchip/crossbar: Fix incorrect type of local variables
	mac80211_hwsim: check HWSIM_ATTR_RADIO_NAME length
	mac80211: fix power saving clients handling in iwlwifi
	net/mlx4_en: fix overflow in mlx4_en_init_timestamp()
	netfilter: nf_ct_expect: Change __nf_ct_expect_check() return value.
	iio: adc: xilinx: Fix error handling
	Btrfs: send, fix failure to rename top level inode due to name collision
	f2fs: do not wait for writeback in write_begin
	md/linear: shutup lockdep warnning
	sparc64: Migrate hvcons irq to panicked cpu
	net/mlx4_core: Fix VF overwrite of module param which disables DMFS on new probed PFs
	crypto: xts - Add ECB dependency
	ocfs2/dlmglue: prepare tracking logic to avoid recursive cluster lock
	slub: do not merge cache if slub_debug contains a never-merge flag
	scsi: scsi_dh_emc: return success in clariion_std_inquiry()
	net: mvpp2: release reference to txq_cpu[] entry after unmapping
	i2c: at91: ensure state is restored after suspending
	ceph: clean up unsafe d_parent accesses in build_dentry_path
	uapi: fix linux/rds.h userspace compilation errors
	uapi: fix linux/mroute6.h userspace compilation errors
	target/iscsi: Fix unsolicited data seq_end_offset calculation
	nfsd/callback: Cleanup callback cred on shutdown
	cpufreq: CPPC: add ACPI_PROCESSOR dependency
	Revert "tty: goldfish: Fix a parameter of a call to free_irq"
	Linux 4.4.94

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2017-10-22 08:09:11 +02:00
commit 89074de67a
53 changed files with 355 additions and 111 deletions

View file

@ -1,6 +1,6 @@
VERSION = 4 VERSION = 4
PATCHLEVEL = 4 PATCHLEVEL = 4
SUBLEVEL = 93 SUBLEVEL = 94
EXTRAVERSION = EXTRAVERSION =
NAME = Blurry Fish Butt NAME = Blurry Fish Butt

View file

@ -18,7 +18,7 @@
#include <irq.h> #include <irq.h>
#define IRQ_STACK_SIZE THREAD_SIZE #define IRQ_STACK_SIZE THREAD_SIZE
#define IRQ_STACK_START (IRQ_STACK_SIZE - sizeof(unsigned long)) #define IRQ_STACK_START (IRQ_STACK_SIZE - 16)
extern void *irq_stack[NR_CPUS]; extern void *irq_stack[NR_CPUS];

View file

@ -59,8 +59,11 @@ extern atomic_t dcpage_flushes;
extern atomic_t dcpage_flushes_xcall; extern atomic_t dcpage_flushes_xcall;
extern int sysctl_tsb_ratio; extern int sysctl_tsb_ratio;
#endif
#ifdef CONFIG_SERIAL_SUNHV
void sunhv_migrate_hvcons_irq(int cpu);
#endif
#endif
void sun_do_break(void); void sun_do_break(void);
extern int stop_a_enabled; extern int stop_a_enabled;
extern int scons_pwroff; extern int scons_pwroff;

View file

@ -1443,8 +1443,12 @@ void smp_send_stop(void)
int cpu; int cpu;
if (tlb_type == hypervisor) { if (tlb_type == hypervisor) {
int this_cpu = smp_processor_id();
#ifdef CONFIG_SERIAL_SUNHV
sunhv_migrate_hvcons_irq(this_cpu);
#endif
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
if (cpu == smp_processor_id()) if (cpu == this_cpu)
continue; continue;
#ifdef CONFIG_SUN_LDOMS #ifdef CONFIG_SUN_LDOMS
if (ldom_domaining_enabled) { if (ldom_domaining_enabled) {

View file

@ -147,6 +147,7 @@ static int bsg_create_job(struct device *dev, struct request *req)
failjob_rls_rqst_payload: failjob_rls_rqst_payload:
kfree(job->request_payload.sg_list); kfree(job->request_payload.sg_list);
failjob_rls_job: failjob_rls_job:
kfree(job);
return -ENOMEM; return -ENOMEM;
} }

View file

@ -361,6 +361,7 @@ config CRYPTO_XTS
select CRYPTO_BLKCIPHER select CRYPTO_BLKCIPHER
select CRYPTO_MANAGER select CRYPTO_MANAGER
select CRYPTO_GF128MUL select CRYPTO_GF128MUL
select CRYPTO_ECB
help help
XTS: IEEE1619/D16 narrow block cipher use with aes-xts-plain, XTS: IEEE1619/D16 narrow block cipher use with aes-xts-plain,
key size 256, 384 or 512 bits. This implementation currently key size 256, 384 or 512 bits. This implementation currently

View file

@ -241,7 +241,7 @@ config ARM_PXA2xx_CPUFREQ
config ACPI_CPPC_CPUFREQ config ACPI_CPPC_CPUFREQ
tristate "CPUFreq driver based on the ACPI CPPC spec" tristate "CPUFreq driver based on the ACPI CPPC spec"
depends on ACPI depends on ACPI_PROCESSOR
select ACPI_CPPC_LIB select ACPI_CPPC_LIB
default n default n
help help

View file

@ -1802,6 +1802,7 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr)
return -EINVAL; return -EINVAL;
} }
req_payload.num_slots = mgr->proposed_vcpis[i]->num_slots; req_payload.num_slots = mgr->proposed_vcpis[i]->num_slots;
req_payload.vcpi = mgr->proposed_vcpis[i]->vcpi;
} else { } else {
port = NULL; port = NULL;
req_payload.num_slots = 0; req_payload.num_slots = 0;
@ -1817,6 +1818,7 @@ int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr)
if (req_payload.num_slots) { if (req_payload.num_slots) {
drm_dp_create_payload_step1(mgr, mgr->proposed_vcpis[i]->vcpi, &req_payload); drm_dp_create_payload_step1(mgr, mgr->proposed_vcpis[i]->vcpi, &req_payload);
mgr->payloads[i].num_slots = req_payload.num_slots; mgr->payloads[i].num_slots = req_payload.num_slots;
mgr->payloads[i].vcpi = req_payload.vcpi;
} else if (mgr->payloads[i].num_slots) { } else if (mgr->payloads[i].num_slots) {
mgr->payloads[i].num_slots = 0; mgr->payloads[i].num_slots = 0;
drm_dp_destroy_payload_step1(mgr, port, mgr->payloads[i].vcpi, &mgr->payloads[i]); drm_dp_destroy_payload_step1(mgr, port, mgr->payloads[i].vcpi, &mgr->payloads[i]);

View file

@ -1131,6 +1131,7 @@ static int at91_twi_suspend_noirq(struct device *dev)
static int at91_twi_resume_noirq(struct device *dev) static int at91_twi_resume_noirq(struct device *dev)
{ {
struct at91_twi_dev *twi_dev = dev_get_drvdata(dev);
int ret; int ret;
if (!pm_runtime_status_suspended(dev)) { if (!pm_runtime_status_suspended(dev)) {
@ -1142,6 +1143,8 @@ static int at91_twi_resume_noirq(struct device *dev)
pm_runtime_mark_last_busy(dev); pm_runtime_mark_last_busy(dev);
pm_request_autosuspend(dev); pm_request_autosuspend(dev);
at91_init_twi_bus(twi_dev);
return 0; return 0;
} }

View file

@ -1208,7 +1208,7 @@ static int xadc_probe(struct platform_device *pdev)
ret = xadc->ops->setup(pdev, indio_dev, irq); ret = xadc->ops->setup(pdev, indio_dev, irq);
if (ret) if (ret)
goto err_free_samplerate_trigger; goto err_clk_disable_unprepare;
ret = request_irq(irq, xadc->ops->interrupt_handler, 0, ret = request_irq(irq, xadc->ops->interrupt_handler, 0,
dev_name(&pdev->dev), indio_dev); dev_name(&pdev->dev), indio_dev);
@ -1268,6 +1268,8 @@ static int xadc_probe(struct platform_device *pdev)
err_free_irq: err_free_irq:
free_irq(irq, indio_dev); free_irq(irq, indio_dev);
err_clk_disable_unprepare:
clk_disable_unprepare(xadc->clk);
err_free_samplerate_trigger: err_free_samplerate_trigger:
if (xadc->ops->flags & XADC_FLAGS_BUFFERED) if (xadc->ops->flags & XADC_FLAGS_BUFFERED)
iio_trigger_free(xadc->samplerate_trigger); iio_trigger_free(xadc->samplerate_trigger);
@ -1277,8 +1279,6 @@ err_free_convst_trigger:
err_triggered_buffer_cleanup: err_triggered_buffer_cleanup:
if (xadc->ops->flags & XADC_FLAGS_BUFFERED) if (xadc->ops->flags & XADC_FLAGS_BUFFERED)
iio_triggered_buffer_cleanup(indio_dev); iio_triggered_buffer_cleanup(indio_dev);
err_clk_disable_unprepare:
clk_disable_unprepare(xadc->clk);
err_device_free: err_device_free:
kfree(indio_dev->channels); kfree(indio_dev->channels);

View file

@ -198,7 +198,8 @@ static const struct irq_domain_ops crossbar_domain_ops = {
static int __init crossbar_of_init(struct device_node *node) static int __init crossbar_of_init(struct device_node *node)
{ {
int i, size, max = 0, reserved = 0, entry; int i, size, reserved = 0;
u32 max = 0, entry;
const __be32 *irqsr; const __be32 *irqsr;
int ret = -ENOMEM; int ret = -ENOMEM;

View file

@ -828,7 +828,6 @@ isdn_ppp_write(int min, struct file *file, const char __user *buf, int count)
isdn_net_local *lp; isdn_net_local *lp;
struct ippp_struct *is; struct ippp_struct *is;
int proto; int proto;
unsigned char protobuf[4];
is = file->private_data; is = file->private_data;
@ -842,24 +841,28 @@ isdn_ppp_write(int min, struct file *file, const char __user *buf, int count)
if (!lp) if (!lp)
printk(KERN_DEBUG "isdn_ppp_write: lp == NULL\n"); printk(KERN_DEBUG "isdn_ppp_write: lp == NULL\n");
else { else {
if (lp->isdn_device < 0 || lp->isdn_channel < 0) {
unsigned char protobuf[4];
/* /*
* Don't reset huptimer for * Don't reset huptimer for
* LCP packets. (Echo requests). * LCP packets. (Echo requests).
*/ */
if (copy_from_user(protobuf, buf, 4)) if (copy_from_user(protobuf, buf, 4))
return -EFAULT; return -EFAULT;
proto = PPP_PROTOCOL(protobuf); proto = PPP_PROTOCOL(protobuf);
if (proto != PPP_LCP) if (proto != PPP_LCP)
lp->huptimer = 0; lp->huptimer = 0;
if (lp->isdn_device < 0 || lp->isdn_channel < 0)
return 0; return 0;
}
if ((dev->drv[lp->isdn_device]->flags & DRV_FLAG_RUNNING) && if ((dev->drv[lp->isdn_device]->flags & DRV_FLAG_RUNNING) &&
lp->dialstate == 0 && lp->dialstate == 0 &&
(lp->flags & ISDN_NET_CONNECTED)) { (lp->flags & ISDN_NET_CONNECTED)) {
unsigned short hl; unsigned short hl;
struct sk_buff *skb; struct sk_buff *skb;
unsigned char *cpy_buf;
/* /*
* we need to reserve enough space in front of * we need to reserve enough space in front of
* sk_buff. old call to dev_alloc_skb only reserved * sk_buff. old call to dev_alloc_skb only reserved
@ -872,11 +875,21 @@ isdn_ppp_write(int min, struct file *file, const char __user *buf, int count)
return count; return count;
} }
skb_reserve(skb, hl); skb_reserve(skb, hl);
if (copy_from_user(skb_put(skb, count), buf, count)) cpy_buf = skb_put(skb, count);
if (copy_from_user(cpy_buf, buf, count))
{ {
kfree_skb(skb); kfree_skb(skb);
return -EFAULT; return -EFAULT;
} }
/*
* Don't reset huptimer for
* LCP packets. (Echo requests).
*/
proto = PPP_PROTOCOL(cpy_buf);
if (proto != PPP_LCP)
lp->huptimer = 0;
if (is->debug & 0x40) { if (is->debug & 0x40) {
printk(KERN_DEBUG "ppp xmit: len %d\n", (int) skb->len); printk(KERN_DEBUG "ppp xmit: len %d\n", (int) skb->len);
isdn_ppp_frame_log("xmit", skb->data, skb->len, 32, is->unit, lp->ppp_slot); isdn_ppp_frame_log("xmit", skb->data, skb->len, 32, is->unit, lp->ppp_slot);

View file

@ -223,7 +223,8 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
* oldconf until no one uses it anymore. * oldconf until no one uses it anymore.
*/ */
mddev_suspend(mddev); mddev_suspend(mddev);
oldconf = rcu_dereference(mddev->private); oldconf = rcu_dereference_protected(mddev->private,
lockdep_is_held(&mddev->reconfig_mutex));
mddev->raid_disks++; mddev->raid_disks++;
WARN_ONCE(mddev->raid_disks != newconf->raid_disks, WARN_ONCE(mddev->raid_disks != newconf->raid_disks,
"copied raid_disks doesn't match mddev->raid_disks"); "copied raid_disks doesn't match mddev->raid_disks");

View file

@ -402,7 +402,7 @@ static int mal_poll(struct napi_struct *napi, int budget)
unsigned long flags; unsigned long flags;
MAL_DBG2(mal, "poll(%d)" NL, budget); MAL_DBG2(mal, "poll(%d)" NL, budget);
again:
/* Process TX skbs */ /* Process TX skbs */
list_for_each(l, &mal->poll_list) { list_for_each(l, &mal->poll_list) {
struct mal_commac *mc = struct mal_commac *mc =
@ -451,7 +451,6 @@ static int mal_poll(struct napi_struct *napi, int budget)
spin_lock_irqsave(&mal->lock, flags); spin_lock_irqsave(&mal->lock, flags);
mal_disable_eob_irq(mal); mal_disable_eob_irq(mal);
spin_unlock_irqrestore(&mal->lock, flags); spin_unlock_irqrestore(&mal->lock, flags);
goto again;
} }
mc->ops->poll_tx(mc->dev); mc->ops->poll_tx(mc->dev);
} }

View file

@ -4415,13 +4415,12 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port,
struct mvpp2_txq_pcpu_buf *tx_buf = struct mvpp2_txq_pcpu_buf *tx_buf =
txq_pcpu->buffs + txq_pcpu->txq_get_index; txq_pcpu->buffs + txq_pcpu->txq_get_index;
mvpp2_txq_inc_get(txq_pcpu);
dma_unmap_single(port->dev->dev.parent, tx_buf->phys, dma_unmap_single(port->dev->dev.parent, tx_buf->phys,
tx_buf->size, DMA_TO_DEVICE); tx_buf->size, DMA_TO_DEVICE);
if (!tx_buf->skb) if (tx_buf->skb)
continue;
dev_kfree_skb_any(tx_buf->skb); dev_kfree_skb_any(tx_buf->skb);
mvpp2_txq_inc_get(txq_pcpu);
} }
} }

View file

@ -88,10 +88,17 @@ void mlx4_en_remove_timestamp(struct mlx4_en_dev *mdev)
} }
} }
#define MLX4_EN_WRAP_AROUND_SEC 10UL
/* By scheduling the overflow check every 5 seconds, we have a reasonably
* good chance we wont miss a wrap around.
* TOTO: Use a timer instead of a work queue to increase the guarantee.
*/
#define MLX4_EN_OVERFLOW_PERIOD (MLX4_EN_WRAP_AROUND_SEC * HZ / 2)
void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev) void mlx4_en_ptp_overflow_check(struct mlx4_en_dev *mdev)
{ {
bool timeout = time_is_before_jiffies(mdev->last_overflow_check + bool timeout = time_is_before_jiffies(mdev->last_overflow_check +
mdev->overflow_period); MLX4_EN_OVERFLOW_PERIOD);
unsigned long flags; unsigned long flags;
if (timeout) { if (timeout) {
@ -236,7 +243,6 @@ static const struct ptp_clock_info mlx4_en_ptp_clock_info = {
.enable = mlx4_en_phc_enable, .enable = mlx4_en_phc_enable,
}; };
#define MLX4_EN_WRAP_AROUND_SEC 10ULL
/* This function calculates the max shift that enables the user range /* This function calculates the max shift that enables the user range
* of MLX4_EN_WRAP_AROUND_SEC values in the cycles register. * of MLX4_EN_WRAP_AROUND_SEC values in the cycles register.
@ -258,7 +264,6 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev)
{ {
struct mlx4_dev *dev = mdev->dev; struct mlx4_dev *dev = mdev->dev;
unsigned long flags; unsigned long flags;
u64 ns, zero = 0;
/* mlx4_en_init_timestamp is called for each netdev. /* mlx4_en_init_timestamp is called for each netdev.
* mdev->ptp_clock is common for all ports, skip initialization if * mdev->ptp_clock is common for all ports, skip initialization if
@ -282,13 +287,6 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev)
ktime_to_ns(ktime_get_real())); ktime_to_ns(ktime_get_real()));
write_unlock_irqrestore(&mdev->clock_lock, flags); write_unlock_irqrestore(&mdev->clock_lock, flags);
/* Calculate period in seconds to call the overflow watchdog - to make
* sure counter is checked at least once every wrap around.
*/
ns = cyclecounter_cyc2ns(&mdev->cycles, mdev->cycles.mask, zero, &zero);
do_div(ns, NSEC_PER_SEC / 2 / HZ);
mdev->overflow_period = ns;
/* Configure the PHC */ /* Configure the PHC */
mdev->ptp_clock_info = mlx4_en_ptp_clock_info; mdev->ptp_clock_info = mlx4_en_ptp_clock_info;
snprintf(mdev->ptp_clock_info.name, 16, "mlx4 ptp"); snprintf(mdev->ptp_clock_info.name, 16, "mlx4 ptp");

View file

@ -791,8 +791,6 @@ static int mlx4_slave_cap(struct mlx4_dev *dev)
return -ENOSYS; return -ENOSYS;
} }
mlx4_log_num_mgm_entry_size = hca_param.log_mc_entry_sz;
dev->caps.hca_core_clock = hca_param.hca_core_clock; dev->caps.hca_core_clock = hca_param.hca_core_clock;
memset(&dev_cap, 0, sizeof(dev_cap)); memset(&dev_cap, 0, sizeof(dev_cap));

View file

@ -409,7 +409,6 @@ struct mlx4_en_dev {
struct cyclecounter cycles; struct cyclecounter cycles;
struct timecounter clock; struct timecounter clock;
unsigned long last_overflow_check; unsigned long last_overflow_check;
unsigned long overflow_period;
struct ptp_clock *ptp_clock; struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_clock_info; struct ptp_clock_info ptp_clock_info;
struct notifier_block nb; struct notifier_block nb;

View file

@ -1192,11 +1192,13 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
switch (tun->flags & TUN_TYPE_MASK) { switch (tun->flags & TUN_TYPE_MASK) {
case IFF_TUN: case IFF_TUN:
if (tun->flags & IFF_NO_PI) { if (tun->flags & IFF_NO_PI) {
switch (skb->data[0] & 0xf0) { u8 ip_version = skb->len ? (skb->data[0] >> 4) : 0;
case 0x40:
switch (ip_version) {
case 4:
pi.proto = htons(ETH_P_IP); pi.proto = htons(ETH_P_IP);
break; break;
case 0x60: case 6:
pi.proto = htons(ETH_P_IPV6); pi.proto = htons(ETH_P_IPV6);
break; break;
default: default:

View file

@ -2884,6 +2884,7 @@ static int hwsim_register_received_nl(struct sk_buff *skb_2,
static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info) static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
{ {
struct hwsim_new_radio_params param = { 0 }; struct hwsim_new_radio_params param = { 0 };
const char *hwname = NULL;
param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG]; param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG];
param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE]; param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE];
@ -2897,8 +2898,14 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
if (info->attrs[HWSIM_ATTR_NO_VIF]) if (info->attrs[HWSIM_ATTR_NO_VIF])
param.no_vif = true; param.no_vif = true;
if (info->attrs[HWSIM_ATTR_RADIO_NAME]) if (info->attrs[HWSIM_ATTR_RADIO_NAME]) {
param.hwname = nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]); hwname = kasprintf(GFP_KERNEL, "%.*s",
nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]),
(char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]));
if (!hwname)
return -ENOMEM;
param.hwname = hwname;
}
if (info->attrs[HWSIM_ATTR_USE_CHANCTX]) if (info->attrs[HWSIM_ATTR_USE_CHANCTX])
param.use_chanctx = true; param.use_chanctx = true;
@ -2926,11 +2933,15 @@ static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
s64 idx = -1; s64 idx = -1;
const char *hwname = NULL; const char *hwname = NULL;
if (info->attrs[HWSIM_ATTR_RADIO_ID]) if (info->attrs[HWSIM_ATTR_RADIO_ID]) {
idx = nla_get_u32(info->attrs[HWSIM_ATTR_RADIO_ID]); idx = nla_get_u32(info->attrs[HWSIM_ATTR_RADIO_ID]);
else if (info->attrs[HWSIM_ATTR_RADIO_NAME]) } else if (info->attrs[HWSIM_ATTR_RADIO_NAME]) {
hwname = (void *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]); hwname = kasprintf(GFP_KERNEL, "%.*s",
else nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]),
(char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]));
if (!hwname)
return -ENOMEM;
} else
return -EINVAL; return -EINVAL;
spin_lock_bh(&hwsim_radio_lock); spin_lock_bh(&hwsim_radio_lock);
@ -2939,7 +2950,8 @@ static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
if (data->idx != idx) if (data->idx != idx)
continue; continue;
} else { } else {
if (strcmp(hwname, wiphy_name(data->hw->wiphy))) if (!hwname ||
strcmp(hwname, wiphy_name(data->hw->wiphy)))
continue; continue;
} }
@ -2947,10 +2959,12 @@ static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
spin_unlock_bh(&hwsim_radio_lock); spin_unlock_bh(&hwsim_radio_lock);
mac80211_hwsim_del_radio(data, wiphy_name(data->hw->wiphy), mac80211_hwsim_del_radio(data, wiphy_name(data->hw->wiphy),
info); info);
kfree(hwname);
return 0; return 0;
} }
spin_unlock_bh(&hwsim_radio_lock); spin_unlock_bh(&hwsim_radio_lock);
kfree(hwname);
return -ENODEV; return -ENODEV;
} }

View file

@ -456,7 +456,7 @@ static int clariion_prep_fn(struct scsi_device *sdev, struct request *req)
static int clariion_std_inquiry(struct scsi_device *sdev, static int clariion_std_inquiry(struct scsi_device *sdev,
struct clariion_dh_data *csdev) struct clariion_dh_data *csdev)
{ {
int err; int err = SCSI_DH_OK;
char *sp_model; char *sp_model;
err = send_inquiry_cmd(sdev, 0, csdev); err = send_inquiry_cmd(sdev, 0, csdev);

View file

@ -44,10 +44,8 @@ void iscsit_set_dataout_sequence_values(
*/ */
if (cmd->unsolicited_data) { if (cmd->unsolicited_data) {
cmd->seq_start_offset = cmd->write_data_done; cmd->seq_start_offset = cmd->write_data_done;
cmd->seq_end_offset = (cmd->write_data_done + cmd->seq_end_offset = min(cmd->se_cmd.data_length,
((cmd->se_cmd.data_length > conn->sess->sess_ops->FirstBurstLength);
conn->sess->sess_ops->FirstBurstLength) ?
conn->sess->sess_ops->FirstBurstLength : cmd->se_cmd.data_length));
return; return;
} }

View file

@ -300,7 +300,7 @@ static int goldfish_tty_probe(struct platform_device *pdev)
return 0; return 0;
err_tty_register_device_failed: err_tty_register_device_failed:
free_irq(irq, qtty); free_irq(irq, pdev);
err_request_irq_failed: err_request_irq_failed:
goldfish_tty_current_line_count--; goldfish_tty_current_line_count--;
if (goldfish_tty_current_line_count == 0) if (goldfish_tty_current_line_count == 0)

View file

@ -398,6 +398,12 @@ static struct uart_driver sunhv_reg = {
static struct uart_port *sunhv_port; static struct uart_port *sunhv_port;
void sunhv_migrate_hvcons_irq(int cpu)
{
/* Migrate hvcons irq to param cpu */
irq_force_affinity(sunhv_port->irq, cpumask_of(cpu));
}
/* Copy 's' into the con_write_page, decoding "\n" into /* Copy 's' into the con_write_page, decoding "\n" into
* "\r\n" along the way. We have to return two lengths * "\r\n" along the way. We have to return two lengths
* because the caller needs to know how much to advance * because the caller needs to know how much to advance

View file

@ -140,12 +140,19 @@ static int kempld_wdt_set_stage_timeout(struct kempld_wdt_data *wdt_data,
unsigned int timeout) unsigned int timeout)
{ {
struct kempld_device_data *pld = wdt_data->pld; struct kempld_device_data *pld = wdt_data->pld;
u32 prescaler = kempld_prescaler[PRESCALER_21]; u32 prescaler;
u64 stage_timeout64; u64 stage_timeout64;
u32 stage_timeout; u32 stage_timeout;
u32 remainder; u32 remainder;
u8 stage_cfg; u8 stage_cfg;
#if GCC_VERSION < 40400
/* work around a bug compiling do_div() */
prescaler = READ_ONCE(kempld_prescaler[PRESCALER_21]);
#else
prescaler = kempld_prescaler[PRESCALER_21];
#endif
if (!stage) if (!stage)
return -EINVAL; return -EINVAL;

View file

@ -1648,6 +1648,9 @@ static int is_inode_existent(struct send_ctx *sctx, u64 ino, u64 gen)
{ {
int ret; int ret;
if (ino == BTRFS_FIRST_FREE_OBJECTID)
return 1;
ret = get_cur_inode_state(sctx, ino, gen); ret = get_cur_inode_state(sctx, ino, gen);
if (ret < 0) if (ret < 0)
goto out; goto out;
@ -1833,7 +1836,7 @@ static int will_overwrite_ref(struct send_ctx *sctx, u64 dir, u64 dir_gen,
* not delted and then re-created, if it was then we have no overwrite * not delted and then re-created, if it was then we have no overwrite
* and we can just unlink this entry. * and we can just unlink this entry.
*/ */
if (sctx->parent_root) { if (sctx->parent_root && dir != BTRFS_FIRST_FREE_OBJECTID) {
ret = get_inode_info(sctx->parent_root, dir, NULL, &gen, NULL, ret = get_inode_info(sctx->parent_root, dir, NULL, &gen, NULL,
NULL, NULL, NULL); NULL, NULL, NULL);
if (ret < 0 && ret != -ENOENT) if (ret < 0 && ret != -ENOENT)

View file

@ -1845,13 +1845,18 @@ static int build_dentry_path(struct dentry *dentry,
int *pfreepath) int *pfreepath)
{ {
char *path; char *path;
struct inode *dir;
if (ceph_snap(d_inode(dentry->d_parent)) == CEPH_NOSNAP) { rcu_read_lock();
*pino = ceph_ino(d_inode(dentry->d_parent)); dir = d_inode_rcu(dentry->d_parent);
if (dir && ceph_snap(dir) == CEPH_NOSNAP) {
*pino = ceph_ino(dir);
rcu_read_unlock();
*ppath = dentry->d_name.name; *ppath = dentry->d_name.name;
*ppathlen = dentry->d_name.len; *ppathlen = dentry->d_name.len;
return 0; return 0;
} }
rcu_read_unlock();
path = ceph_mdsc_build_path(dentry, ppathlen, pino, 1); path = ceph_mdsc_build_path(dentry, ppathlen, pino, 1);
if (IS_ERR(path)) if (IS_ERR(path))
return PTR_ERR(path); return PTR_ERR(path);

View file

@ -696,6 +696,14 @@ int set_callback_cred(void)
return 0; return 0;
} }
void cleanup_callback_cred(void)
{
if (callback_cred) {
put_rpccred(callback_cred);
callback_cred = NULL;
}
}
static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc_clnt *client, struct nfsd4_session *ses) static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc_clnt *client, struct nfsd4_session *ses)
{ {
if (clp->cl_minorversion == 0) { if (clp->cl_minorversion == 0) {

View file

@ -6792,23 +6792,24 @@ nfs4_state_start(void)
ret = set_callback_cred(); ret = set_callback_cred();
if (ret) if (ret)
return -ENOMEM; return ret;
laundry_wq = alloc_workqueue("%s", WQ_UNBOUND, 0, "nfsd4"); laundry_wq = alloc_workqueue("%s", WQ_UNBOUND, 0, "nfsd4");
if (laundry_wq == NULL) { if (laundry_wq == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_recovery; goto out_cleanup_cred;
} }
ret = nfsd4_create_callback_queue(); ret = nfsd4_create_callback_queue();
if (ret) if (ret)
goto out_free_laundry; goto out_free_laundry;
set_max_delegations(); set_max_delegations();
return 0; return 0;
out_free_laundry: out_free_laundry:
destroy_workqueue(laundry_wq); destroy_workqueue(laundry_wq);
out_recovery: out_cleanup_cred:
cleanup_callback_cred();
return ret; return ret;
} }
@ -6847,6 +6848,7 @@ nfs4_state_shutdown(void)
{ {
destroy_workqueue(laundry_wq); destroy_workqueue(laundry_wq);
nfsd4_destroy_callback_queue(); nfsd4_destroy_callback_queue();
cleanup_callback_cred();
} }
static void static void

View file

@ -595,6 +595,7 @@ extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir,
extern __be32 nfs4_check_open_reclaim(clientid_t *clid, extern __be32 nfs4_check_open_reclaim(clientid_t *clid,
struct nfsd4_compound_state *cstate, struct nfsd_net *nn); struct nfsd4_compound_state *cstate, struct nfsd_net *nn);
extern int set_callback_cred(void); extern int set_callback_cred(void);
extern void cleanup_callback_cred(void);
extern void nfsd4_probe_callback(struct nfs4_client *clp); extern void nfsd4_probe_callback(struct nfs4_client *clp);
extern void nfsd4_probe_callback_sync(struct nfs4_client *clp); extern void nfsd4_probe_callback_sync(struct nfs4_client *clp);
extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *); extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *);

View file

@ -531,6 +531,7 @@ void ocfs2_lock_res_init_once(struct ocfs2_lock_res *res)
init_waitqueue_head(&res->l_event); init_waitqueue_head(&res->l_event);
INIT_LIST_HEAD(&res->l_blocked_list); INIT_LIST_HEAD(&res->l_blocked_list);
INIT_LIST_HEAD(&res->l_mask_waiters); INIT_LIST_HEAD(&res->l_mask_waiters);
INIT_LIST_HEAD(&res->l_holders);
} }
void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res, void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
@ -748,6 +749,50 @@ void ocfs2_lock_res_free(struct ocfs2_lock_res *res)
res->l_flags = 0UL; res->l_flags = 0UL;
} }
/*
* Keep a list of processes who have interest in a lockres.
* Note: this is now only uesed for check recursive cluster locking.
*/
static inline void ocfs2_add_holder(struct ocfs2_lock_res *lockres,
struct ocfs2_lock_holder *oh)
{
INIT_LIST_HEAD(&oh->oh_list);
oh->oh_owner_pid = get_pid(task_pid(current));
spin_lock(&lockres->l_lock);
list_add_tail(&oh->oh_list, &lockres->l_holders);
spin_unlock(&lockres->l_lock);
}
static inline void ocfs2_remove_holder(struct ocfs2_lock_res *lockres,
struct ocfs2_lock_holder *oh)
{
spin_lock(&lockres->l_lock);
list_del(&oh->oh_list);
spin_unlock(&lockres->l_lock);
put_pid(oh->oh_owner_pid);
}
static inline int ocfs2_is_locked_by_me(struct ocfs2_lock_res *lockres)
{
struct ocfs2_lock_holder *oh;
struct pid *pid;
/* look in the list of holders for one with the current task as owner */
spin_lock(&lockres->l_lock);
pid = task_pid(current);
list_for_each_entry(oh, &lockres->l_holders, oh_list) {
if (oh->oh_owner_pid == pid) {
spin_unlock(&lockres->l_lock);
return 1;
}
}
spin_unlock(&lockres->l_lock);
return 0;
}
static inline void ocfs2_inc_holders(struct ocfs2_lock_res *lockres, static inline void ocfs2_inc_holders(struct ocfs2_lock_res *lockres,
int level) int level)
{ {
@ -2343,8 +2388,9 @@ int ocfs2_inode_lock_full_nested(struct inode *inode,
goto getbh; goto getbh;
} }
if (ocfs2_mount_local(osb)) if ((arg_flags & OCFS2_META_LOCK_GETBH) ||
goto local; ocfs2_mount_local(osb))
goto update;
if (!(arg_flags & OCFS2_META_LOCK_RECOVERY)) if (!(arg_flags & OCFS2_META_LOCK_RECOVERY))
ocfs2_wait_for_recovery(osb); ocfs2_wait_for_recovery(osb);
@ -2373,7 +2419,7 @@ int ocfs2_inode_lock_full_nested(struct inode *inode,
if (!(arg_flags & OCFS2_META_LOCK_RECOVERY)) if (!(arg_flags & OCFS2_META_LOCK_RECOVERY))
ocfs2_wait_for_recovery(osb); ocfs2_wait_for_recovery(osb);
local: update:
/* /*
* We only see this flag if we're being called from * We only see this flag if we're being called from
* ocfs2_read_locked_inode(). It means we're locking an inode * ocfs2_read_locked_inode(). It means we're locking an inode
@ -2515,6 +2561,59 @@ void ocfs2_inode_unlock(struct inode *inode,
ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
} }
/*
* This _tracker variantes are introduced to deal with the recursive cluster
* locking issue. The idea is to keep track of a lock holder on the stack of
* the current process. If there's a lock holder on the stack, we know the
* task context is already protected by cluster locking. Currently, they're
* used in some VFS entry routines.
*
* return < 0 on error, return == 0 if there's no lock holder on the stack
* before this call, return == 1 if this call would be a recursive locking.
*/
int ocfs2_inode_lock_tracker(struct inode *inode,
struct buffer_head **ret_bh,
int ex,
struct ocfs2_lock_holder *oh)
{
int status;
int arg_flags = 0, has_locked;
struct ocfs2_lock_res *lockres;
lockres = &OCFS2_I(inode)->ip_inode_lockres;
has_locked = ocfs2_is_locked_by_me(lockres);
/* Just get buffer head if the cluster lock has been taken */
if (has_locked)
arg_flags = OCFS2_META_LOCK_GETBH;
if (likely(!has_locked || ret_bh)) {
status = ocfs2_inode_lock_full(inode, ret_bh, ex, arg_flags);
if (status < 0) {
if (status != -ENOENT)
mlog_errno(status);
return status;
}
}
if (!has_locked)
ocfs2_add_holder(lockres, oh);
return has_locked;
}
void ocfs2_inode_unlock_tracker(struct inode *inode,
int ex,
struct ocfs2_lock_holder *oh,
int had_lock)
{
struct ocfs2_lock_res *lockres;
lockres = &OCFS2_I(inode)->ip_inode_lockres;
if (!had_lock) {
ocfs2_remove_holder(lockres, oh);
ocfs2_inode_unlock(inode, ex);
}
}
int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno) int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno)
{ {
struct ocfs2_lock_res *lockres; struct ocfs2_lock_res *lockres;

View file

@ -70,6 +70,11 @@ struct ocfs2_orphan_scan_lvb {
__be32 lvb_os_seqno; __be32 lvb_os_seqno;
}; };
struct ocfs2_lock_holder {
struct list_head oh_list;
struct pid *oh_owner_pid;
};
/* ocfs2_inode_lock_full() 'arg_flags' flags */ /* ocfs2_inode_lock_full() 'arg_flags' flags */
/* don't wait on recovery. */ /* don't wait on recovery. */
#define OCFS2_META_LOCK_RECOVERY (0x01) #define OCFS2_META_LOCK_RECOVERY (0x01)
@ -77,6 +82,8 @@ struct ocfs2_orphan_scan_lvb {
#define OCFS2_META_LOCK_NOQUEUE (0x02) #define OCFS2_META_LOCK_NOQUEUE (0x02)
/* don't block waiting for the downconvert thread, instead return -EAGAIN */ /* don't block waiting for the downconvert thread, instead return -EAGAIN */
#define OCFS2_LOCK_NONBLOCK (0x04) #define OCFS2_LOCK_NONBLOCK (0x04)
/* just get back disk inode bh if we've got cluster lock. */
#define OCFS2_META_LOCK_GETBH (0x08)
/* Locking subclasses of inode cluster lock */ /* Locking subclasses of inode cluster lock */
enum { enum {
@ -170,4 +177,15 @@ void ocfs2_put_dlm_debug(struct ocfs2_dlm_debug *dlm_debug);
/* To set the locking protocol on module initialization */ /* To set the locking protocol on module initialization */
void ocfs2_set_locking_protocol(void); void ocfs2_set_locking_protocol(void);
/* The _tracker pair is used to avoid cluster recursive locking */
int ocfs2_inode_lock_tracker(struct inode *inode,
struct buffer_head **ret_bh,
int ex,
struct ocfs2_lock_holder *oh);
void ocfs2_inode_unlock_tracker(struct inode *inode,
int ex,
struct ocfs2_lock_holder *oh,
int had_lock);
#endif /* DLMGLUE_H */ #endif /* DLMGLUE_H */

View file

@ -172,6 +172,7 @@ struct ocfs2_lock_res {
struct list_head l_blocked_list; struct list_head l_blocked_list;
struct list_head l_mask_waiters; struct list_head l_mask_waiters;
struct list_head l_holders;
unsigned long l_flags; unsigned long l_flags;
char l_name[OCFS2_LOCK_ID_MAX_LEN]; char l_name[OCFS2_LOCK_ID_MAX_LEN];

View file

@ -105,15 +105,35 @@ do { \
(__ret); \ (__ret); \
}) })
#define this_cpu_generic_read(pcp) \ #define __this_cpu_generic_read_nopreempt(pcp) \
({ \ ({ \
typeof(pcp) __ret; \ typeof(pcp) __ret; \
preempt_disable(); \ preempt_disable(); \
__ret = *this_cpu_ptr(&(pcp)); \ __ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \
preempt_enable(); \ preempt_enable(); \
__ret; \ __ret; \
}) })
#define __this_cpu_generic_read_noirq(pcp) \
({ \
typeof(pcp) __ret; \
unsigned long __flags; \
raw_local_irq_save(__flags); \
__ret = *raw_cpu_ptr(&(pcp)); \
raw_local_irq_restore(__flags); \
__ret; \
})
#define this_cpu_generic_read(pcp) \
({ \
typeof(pcp) __ret; \
if (__native_word(pcp)) \
__ret = __this_cpu_generic_read_nopreempt(pcp); \
else \
__ret = __this_cpu_generic_read_noirq(pcp); \
__ret; \
})
#define this_cpu_generic_to_op(pcp, val, op) \ #define this_cpu_generic_to_op(pcp, val, op) \
do { \ do { \
unsigned long __flags; \ unsigned long __flags; \

View file

@ -301,6 +301,7 @@ struct trace_event_call {
int perf_refcount; int perf_refcount;
struct hlist_head __percpu *perf_events; struct hlist_head __percpu *perf_events;
struct bpf_prog *prog; struct bpf_prog *prog;
struct perf_event *bpf_prog_owner;
int (*perf_perm)(struct trace_event_call *, int (*perf_perm)(struct trace_event_call *,
struct perf_event *); struct perf_event *);

View file

@ -141,8 +141,12 @@ __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event);
static inline int sctp_ulpevent_type_enabled(__u16 sn_type, static inline int sctp_ulpevent_type_enabled(__u16 sn_type,
struct sctp_event_subscribe *mask) struct sctp_event_subscribe *mask)
{ {
int offset = sn_type - SCTP_SN_TYPE_BASE;
char *amask = (char *) mask; char *amask = (char *) mask;
return amask[sn_type - SCTP_SN_TYPE_BASE];
if (offset >= sizeof(struct sctp_event_subscribe))
return 0;
return amask[offset];
} }
/* Given an event subscription, is this event enabled? */ /* Given an event subscription, is this event enabled? */

View file

@ -3,6 +3,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/sockios.h> #include <linux/sockios.h>
#include <linux/in6.h> /* For struct sockaddr_in6. */
/* /*
* Based on the MROUTING 3.5 defines primarily to keep * Based on the MROUTING 3.5 defines primarily to keep

View file

@ -35,6 +35,7 @@
#define _LINUX_RDS_H #define _LINUX_RDS_H
#include <linux/types.h> #include <linux/types.h>
#include <linux/socket.h> /* For __kernel_sockaddr_storage. */
#define RDS_IB_ABI_VERSION 0x301 #define RDS_IB_ABI_VERSION 0x301
@ -223,7 +224,7 @@ struct rds_get_mr_args {
}; };
struct rds_get_mr_for_dest_args { struct rds_get_mr_for_dest_args {
struct sockaddr_storage dest_addr; struct __kernel_sockaddr_storage dest_addr;
struct rds_iovec vec; struct rds_iovec vec;
uint64_t cookie_addr; uint64_t cookie_addr;
uint64_t flags; uint64_t flags;

View file

@ -1044,7 +1044,8 @@ static int check_alu_op(struct verifier_env *env, struct bpf_insn *insn)
} }
} else { } else {
if (insn->src_reg != BPF_REG_0 || insn->off != 0 || if (insn->src_reg != BPF_REG_0 || insn->off != 0 ||
(insn->imm != 16 && insn->imm != 32 && insn->imm != 64)) { (insn->imm != 16 && insn->imm != 32 && insn->imm != 64) ||
BPF_CLASS(insn->code) == BPF_ALU64) {
verbose("BPF_END uses reserved fields\n"); verbose("BPF_END uses reserved fields\n");
return -EINVAL; return -EINVAL;
} }

View file

@ -7113,6 +7113,7 @@ static int perf_event_set_bpf_prog(struct perf_event *event, u32 prog_fd)
} }
event->tp_event->prog = prog; event->tp_event->prog = prog;
event->tp_event->bpf_prog_owner = event;
return 0; return 0;
} }
@ -7125,7 +7126,7 @@ static void perf_event_free_bpf_prog(struct perf_event *event)
return; return;
prog = event->tp_event->prog; prog = event->tp_event->prog;
if (prog) { if (prog && event->tp_event->bpf_prog_owner == event) {
event->tp_event->prog = NULL; event->tp_event->prog = NULL;
bpf_prog_put_rcu(prog); bpf_prog_put_rcu(prog);
} }

View file

@ -3128,10 +3128,17 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
if (depth) { if (depth) {
hlock = curr->held_locks + depth - 1; hlock = curr->held_locks + depth - 1;
if (hlock->class_idx == class_idx && nest_lock) { if (hlock->class_idx == class_idx && nest_lock) {
if (hlock->references) if (hlock->references) {
/*
* Check: unsigned int references:12, overflow.
*/
if (DEBUG_LOCKS_WARN_ON(hlock->references == (1 << 12)-1))
return 0;
hlock->references++; hlock->references++;
else } else {
hlock->references = 2; hlock->references = 2;
}
return 1; return 1;
} }

View file

@ -250,7 +250,7 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
{ {
struct kmem_cache *s; struct kmem_cache *s;
if (slab_nomerge || (flags & SLAB_NEVER_MERGE)) if (slab_nomerge)
return NULL; return NULL;
if (ctor) if (ctor)
@ -261,6 +261,9 @@ struct kmem_cache *find_mergeable(size_t size, size_t align,
size = ALIGN(size, align); size = ALIGN(size, align);
flags = kmem_cache_flags(size, flags, name, NULL); flags = kmem_cache_flags(size, flags, name, NULL);
if (flags & SLAB_NEVER_MERGE)
return NULL;
list_for_each_entry_reverse(s, &slab_caches, list) { list_for_each_entry_reverse(s, &slab_caches, list) {
if (slab_unmergeable(s)) if (slab_unmergeable(s))
continue; continue;

View file

@ -1516,6 +1516,8 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
sock_copy(newsk, sk); sock_copy(newsk, sk);
newsk->sk_prot_creator = sk->sk_prot;
/* SANITY */ /* SANITY */
if (likely(newsk->sk_net_refcnt)) if (likely(newsk->sk_net_refcnt))
get_net(sock_net(newsk)); get_net(sock_net(newsk));

View file

@ -156,6 +156,7 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,
struct ip_tunnel_parm *parms = &tunnel->parms; struct ip_tunnel_parm *parms = &tunnel->parms;
struct dst_entry *dst = skb_dst(skb); struct dst_entry *dst = skb_dst(skb);
struct net_device *tdev; /* Device to other host */ struct net_device *tdev; /* Device to other host */
int pkt_len = skb->len;
int err; int err;
if (!dst) { if (!dst) {
@ -199,7 +200,7 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,
err = dst_output(tunnel->net, skb->sk, skb); err = dst_output(tunnel->net, skb->sk, skb);
if (net_xmit_eval(err) == 0) if (net_xmit_eval(err) == 0)
err = skb->len; err = pkt_len;
iptunnel_xmit_stats(err, &dev->stats, dev->tstats); iptunnel_xmit_stats(err, &dev->stats, dev->tstats);
return NETDEV_TX_OK; return NETDEV_TX_OK;

View file

@ -1177,22 +1177,23 @@ static int ip6gre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
} }
static int ip6gre_header(struct sk_buff *skb, struct net_device *dev, static int ip6gre_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, unsigned short type, const void *daddr,
const void *daddr, const void *saddr, unsigned int len) const void *saddr, unsigned int len)
{ {
struct ip6_tnl *t = netdev_priv(dev); struct ip6_tnl *t = netdev_priv(dev);
struct ipv6hdr *ipv6h = (struct ipv6hdr *)skb_push(skb, t->hlen); struct ipv6hdr *ipv6h;
__be16 *p = (__be16 *)(ipv6h+1); __be16 *p;
ip6_flow_hdr(ipv6h, 0, ipv6h = (struct ipv6hdr *)skb_push(skb, t->hlen + sizeof(*ipv6h));
ip6_make_flowlabel(dev_net(dev), skb, ip6_flow_hdr(ipv6h, 0, ip6_make_flowlabel(dev_net(dev), skb,
t->fl.u.ip6.flowlabel, true, t->fl.u.ip6.flowlabel,
&t->fl.u.ip6)); true, &t->fl.u.ip6));
ipv6h->hop_limit = t->parms.hop_limit; ipv6h->hop_limit = t->parms.hop_limit;
ipv6h->nexthdr = NEXTHDR_GRE; ipv6h->nexthdr = NEXTHDR_GRE;
ipv6h->saddr = t->parms.laddr; ipv6h->saddr = t->parms.laddr;
ipv6h->daddr = t->parms.raddr; ipv6h->daddr = t->parms.raddr;
p = (__be16 *)(ipv6h + 1);
p[0] = t->parms.o_flags; p[0] = t->parms.o_flags;
p[1] = htons(type); p[1] = htons(type);

View file

@ -434,6 +434,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
struct dst_entry *dst = skb_dst(skb); struct dst_entry *dst = skb_dst(skb);
struct net_device *tdev; struct net_device *tdev;
struct xfrm_state *x; struct xfrm_state *x;
int pkt_len = skb->len;
int err = -1; int err = -1;
int mtu; int mtu;
@ -487,7 +488,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
u64_stats_update_begin(&tstats->syncp); u64_stats_update_begin(&tstats->syncp);
tstats->tx_bytes += skb->len; tstats->tx_bytes += pkt_len;
tstats->tx_packets++; tstats->tx_packets++;
u64_stats_update_end(&tstats->syncp); u64_stats_update_end(&tstats->syncp);
} else { } else {

View file

@ -1007,6 +1007,7 @@ static void udp6_hwcsum_outgoing(struct sock *sk, struct sk_buff *skb,
*/ */
offset = skb_transport_offset(skb); offset = skb_transport_offset(skb);
skb->csum = skb_checksum(skb, offset, skb->len - offset, 0); skb->csum = skb_checksum(skb, offset, skb->len - offset, 0);
csum = skb->csum;
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;

View file

@ -1321,6 +1321,9 @@ static void l2tp_tunnel_del_work(struct work_struct *work)
struct sock *sk = NULL; struct sock *sk = NULL;
tunnel = container_of(work, struct l2tp_tunnel, del_work); tunnel = container_of(work, struct l2tp_tunnel, del_work);
l2tp_tunnel_closeall(tunnel);
sk = l2tp_tunnel_sock_lookup(tunnel); sk = l2tp_tunnel_sock_lookup(tunnel);
if (!sk) if (!sk)
goto out; goto out;
@ -1640,15 +1643,12 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_create);
/* This function is used by the netlink TUNNEL_DELETE command. /* This function is used by the netlink TUNNEL_DELETE command.
*/ */
int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel) void l2tp_tunnel_delete(struct l2tp_tunnel *tunnel)
{ {
if (!test_and_set_bit(0, &tunnel->dead)) {
l2tp_tunnel_inc_refcount(tunnel); l2tp_tunnel_inc_refcount(tunnel);
l2tp_tunnel_closeall(tunnel); queue_work(l2tp_wq, &tunnel->del_work);
if (false == queue_work(l2tp_wq, &tunnel->del_work)) {
l2tp_tunnel_dec_refcount(tunnel);
return 1;
} }
return 0;
} }
EXPORT_SYMBOL_GPL(l2tp_tunnel_delete); EXPORT_SYMBOL_GPL(l2tp_tunnel_delete);

View file

@ -169,6 +169,9 @@ struct l2tp_tunnel_cfg {
struct l2tp_tunnel { struct l2tp_tunnel {
int magic; /* Should be L2TP_TUNNEL_MAGIC */ int magic; /* Should be L2TP_TUNNEL_MAGIC */
unsigned long dead;
struct rcu_head rcu; struct rcu_head rcu;
rwlock_t hlist_lock; /* protect session_hlist */ rwlock_t hlist_lock; /* protect session_hlist */
struct hlist_head session_hlist[L2TP_HASH_SIZE]; struct hlist_head session_hlist[L2TP_HASH_SIZE];
@ -253,7 +256,7 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id,
u32 peer_tunnel_id, struct l2tp_tunnel_cfg *cfg, u32 peer_tunnel_id, struct l2tp_tunnel_cfg *cfg,
struct l2tp_tunnel **tunnelp); struct l2tp_tunnel **tunnelp);
void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel); void l2tp_tunnel_closeall(struct l2tp_tunnel *tunnel);
int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel); void l2tp_tunnel_delete(struct l2tp_tunnel *tunnel);
struct l2tp_session *l2tp_session_create(int priv_size, struct l2tp_session *l2tp_session_create(int priv_size,
struct l2tp_tunnel *tunnel, struct l2tp_tunnel *tunnel,
u32 session_id, u32 peer_session_id, u32 session_id, u32 peer_session_id,

View file

@ -661,7 +661,7 @@ static void __sta_info_recalc_tim(struct sta_info *sta, bool ignore_pending)
} }
/* No need to do anything if the driver does all */ /* No need to do anything if the driver does all */
if (ieee80211_hw_check(&local->hw, AP_LINK_PS)) if (ieee80211_hw_check(&local->hw, AP_LINK_PS) && !local->ops->set_tim)
return; return;
if (sta->dead) if (sta->dead)

View file

@ -395,7 +395,7 @@ static inline int __nf_ct_expect_check(struct nf_conntrack_expect *expect)
struct net *net = nf_ct_exp_net(expect); struct net *net = nf_ct_exp_net(expect);
struct hlist_node *next; struct hlist_node *next;
unsigned int h; unsigned int h;
int ret = 1; int ret = 0;
if (!master_help) { if (!master_help) {
ret = -ESHUTDOWN; ret = -ESHUTDOWN;
@ -445,7 +445,7 @@ int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
spin_lock_bh(&nf_conntrack_expect_lock); spin_lock_bh(&nf_conntrack_expect_lock);
ret = __nf_ct_expect_check(expect); ret = __nf_ct_expect_check(expect);
if (ret <= 0) if (ret < 0)
goto out; goto out;
ret = nf_ct_expect_insert(expect); ret = nf_ct_expect_insert(expect);

View file

@ -1652,10 +1652,6 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
mutex_lock(&fanout_mutex); mutex_lock(&fanout_mutex);
err = -EINVAL;
if (!po->running)
goto out;
err = -EALREADY; err = -EALREADY;
if (po->fanout) if (po->fanout)
goto out; goto out;
@ -1704,7 +1700,10 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
list_add(&match->list, &fanout_list); list_add(&match->list, &fanout_list);
} }
err = -EINVAL; err = -EINVAL;
if (match->type == type &&
spin_lock(&po->bind_lock);
if (po->running &&
match->type == type &&
match->prot_hook.type == po->prot_hook.type && match->prot_hook.type == po->prot_hook.type &&
match->prot_hook.dev == po->prot_hook.dev) { match->prot_hook.dev == po->prot_hook.dev) {
err = -ENOSPC; err = -ENOSPC;
@ -1716,6 +1715,13 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
err = 0; err = 0;
} }
} }
spin_unlock(&po->bind_lock);
if (err && !atomic_read(&match->sk_ref)) {
list_del(&match->list);
kfree(match);
}
out: out:
if (err && rollover) { if (err && rollover) {
kfree(rollover); kfree(rollover);
@ -2650,6 +2656,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
int vnet_hdr_len; int vnet_hdr_len;
struct packet_sock *po = pkt_sk(sk); struct packet_sock *po = pkt_sk(sk);
unsigned short gso_type = 0; unsigned short gso_type = 0;
bool has_vnet_hdr = false;
int hlen, tlen, linear; int hlen, tlen, linear;
int extra_len = 0; int extra_len = 0;
ssize_t n; ssize_t n;
@ -2737,6 +2744,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
goto out_unlock; goto out_unlock;
} }
has_vnet_hdr = true;
} }
if (unlikely(sock_flag(sk, SOCK_NOFCS))) { if (unlikely(sock_flag(sk, SOCK_NOFCS))) {
@ -2796,7 +2804,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
packet_pick_tx_queue(dev, skb); packet_pick_tx_queue(dev, skb);
if (po->has_vnet_hdr) { if (has_vnet_hdr) {
if (vnet_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { if (vnet_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) {
u16 s = __virtio16_to_cpu(vio_le(), vnet_hdr.csum_start); u16 s = __virtio16_to_cpu(vio_le(), vnet_hdr.csum_start);
u16 o = __virtio16_to_cpu(vio_le(), vnet_hdr.csum_offset); u16 o = __virtio16_to_cpu(vio_le(), vnet_hdr.csum_offset);
@ -2938,13 +2946,15 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex,
int ret = 0; int ret = 0;
bool unlisted = false; bool unlisted = false;
if (po->fanout)
return -EINVAL;
lock_sock(sk); lock_sock(sk);
spin_lock(&po->bind_lock); spin_lock(&po->bind_lock);
rcu_read_lock(); rcu_read_lock();
if (po->fanout) {
ret = -EINVAL;
goto out_unlock;
}
if (name) { if (name) {
dev = dev_get_by_name_rcu(sock_net(sk), name); dev = dev_get_by_name_rcu(sock_net(sk), name);
if (!dev) { if (!dev) {

View file

@ -541,7 +541,7 @@ bool tipc_msg_lookup_dest(struct net *net, struct sk_buff *skb, int *err)
return false; return false;
if (msg_errcode(msg)) if (msg_errcode(msg))
return false; return false;
*err = -TIPC_ERR_NO_NAME; *err = TIPC_ERR_NO_NAME;
if (skb_linearize(skb)) if (skb_linearize(skb))
return false; return false;
msg = buf_msg(skb); msg = buf_msg(skb);