3.2.69-rc1 review
Subsystems (3)
PATCH 168/221 x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Lippers-Hollmann <[email protected]>
commit 80313b3078fcd2ca51970880d90757f05879a193 upstream.
The ASRock Q1900DC-ITX mainboard (Baytrail-D) hangs randomly in both BIOS and UEFI mode while rebooting unless reboot=pci is used. Add a quirk to reboot via the pci method.
The problem is very intermittent and hard to debug, it might succeed rebooting just fine 40 times in a row - but fails half a dozen times the next day. It seems to be slightly less common in BIOS CSM mode than native UEFI (with the CSM disabled), but it does happen in either mode. Since I've started testing this patch in late january, rebooting has been 100% reliable.
Most of the time it already hangs during POST, but occasionally it might even make it through the bootloader and the kernel might even start booting, but then hangs before the mode switch. The same symptoms occur with grub-efi, gummiboot and grub-pc, just as well as (at least) kernel 3.16-3.19 and 4.0-rc6 (I haven't tried older kernels than 3.16). Upgrading to the most current mainboard firmware of the ASRock Q1900DC-ITX, version 1.20, does not improve the situation.
( Searching the web seems to suggest that other Bay Trail-D mainboards
might be affected as well. )
--
---
arch/x86/kernel/reboot.c +9 -0
@@ -412,6 +412,15 @@ static struct dmi_system_id __initdata p DMI_MATCH(DMI_PRODUCT_NAME, "iMac9,1"), }, }, +/* ASRock */ + {/* Handle problems with rebooting on ASRock Q1900DC-ITX */ + .callback = set_pci_reboot, + .ident = "ASRock Q1900DC-ITX", + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"ASRock" ), + DMI_MATCH(DMI_BOARD_NAME, "Q1900DC-ITX"), + }, + }, /* Certec */ { /* Handle problems with rebooting on Certec BPC600 */ .callback = set_pci_reboot,
PATCH 169/221 mac80211: fix RX A-MPDU session reorder timer deletion
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 788211d81bfdf9b6a547d0530f206ba6ee76b107 upstream.
There's an issue with the way the RX A-MPDU reorder timer is deleted that can cause a kernel crash like this:
* tid_rx is removed - call_rcu(ieee80211_free_tid_rx)
* station is destroyed
* reorder timer fires before ieee80211_free_tid_rx() runs, accessing the station, thus potentially crashing due to the use-after-free
The station deletion is protected by synchronize_net(), but that isn't enough -- ieee80211_free_tid_rx() need not have run when that returns (it deletes the timer.) We could use rcu_barrier() instead of synchronize_net(), but that's much more expensive.
Instead, to fix this, add a field tracking that the session is being deleted. In this case, the only re-arming of the timer happens with the reorder spinlock held, so make that code not rearm it if the session is being deleted and also delete the timer after setting that field. This ensures the timer cannot fire after ___ieee80211_stop_rx_ba_session() returns, which fixes the problem.
--- net/mac80211/agg-rx.c | 8 ++++++-- net/mac80211/rx.c | 7 ++++--- net/mac80211/sta_info.h | 2 ++ 3 files changed, 12 insertions(+), 5 deletions(-)
net/mac80211/agg-rx.c +6 -2
@@ -49,8 +49,6 @@ static void ieee80211_free_tid_rx(struct container_of(h, struct tid_ampdu_rx, rcu_head);int i; -del_timer_sync (&tid_rx->reorder_timer); -for (i =0 ; i < tid_rx->buf_size; i++)dev_kfree_skb (tid_rx->reorder_buf[i]);kfree (tid_rx->reorder_buf);
@@ -91,6 +89,12 @@ void ___ieee80211_stop_rx_ba_session(strdel_timer_sync (&tid_rx->session_timer); +/* make sure ieee80211_sta_reorder_release() doesn't re-arm the timer */ +spin_lock_bh (&tid_rx->reorder_lock); + tid_rx->removed = true; +spin_unlock_bh (&tid_rx->reorder_lock); +del_timer_sync (&tid_rx->reorder_timer); +call_rcu (&tid_rx->rcu_head, ieee80211_free_tid_rx); }
net/mac80211/rx.c +4 -3
@@ -670,9 +670,10 @@ static void ieee80211_sta_reorder_releas set_release_timer: -mod_timer (&tid_agg_rx->reorder_timer, - tid_agg_rx->reorder_time[j] +1 + -HT_RX_REORDER_BUF_TIMEOUT ); +if (!tid_agg_rx->removed) +mod_timer (&tid_agg_rx->reorder_timer, + tid_agg_rx->reorder_time[j] +1 + +HT_RX_REORDER_BUF_TIMEOUT ); }else {del_timer (&tid_agg_rx->reorder_timer); }
net/mac80211/sta_info.h +2 -0
@@ -138,6 +138,7 @@ struct tid_ampdu_tx {* @dialog_token: dialog token for aggregation session * @rcu_head: RCU head used for freeing this struct * @reorder_lock: serializes access to reorder buffer, see below. +* @removed: this session is removed (but might have been found due to RCU) * * This structure's lifetime is managed by RCU, assignments to * the array holding it must hold the aggregation mutex.
@@ -160,6 +161,7 @@ struct tid_ampdu_rx {u16 buf_size;u16 timeout;u8 dialog_token; +bool removed; };/**
PATCH 170/221 IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Shachar Raindel <[email protected]>
commit 8494057ab5e40df590ef6ef7d66324d3ae33356b upstream.
Properly verify that the resulting page aligned end address is larger than both the start address and the length of the memory area requested.
Both the start and length arguments for ib_umem_get are controlled by the user. A misbehaving user can provide values which will cause an integer overflow when calculating the page aligned end address.
This overflow can cause also miscalculation of the number of pages mapped, and additional logic issues.
Addresses: CVE-2014-8159
--- drivers/infiniband/core/umem.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/infiniband/core/umem.c +8 -0
@@ -94,6 +94,14 @@ struct ib_umem *ib_umem_get(struct ib_ucif (dmasync)dma_set_attr (DMA_ATTR_WRITE_BARRIER , &attrs); +/* +* If the combination of the addr and size requested for this memory +* region causes an integer overflow, return error. +*/ +if ((PAGE_ALIGN (addr + size) <= size) || + (PAGE_ALIGN (addr + size) <= addr)) +return ERR_PTR (-EINVAL ); +if (!can_do_mlock ())return ERR_PTR (-EPERM );
PATCH 171/221 xen-netfront: transmit fully GSO-sized packets
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Davies <[email protected]>
commit 0c36820e2ab7d943ab1188230fdf2149826d33c0 upstream.
xen-netfront limits transmitted skbs to be at most 44 segments in size. However, GSO permits up to 65536 bytes, which means a maximum of 45 segments of 1448 bytes each. This slight reduction in the size of packets means a slight loss in efficiency.
Since c/s 9ecd1a75d, xen-netfront sets gso_max_size to
XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER,
where XEN_NETIF_MAX_TX_SIZE is 65535 bytes.
The calculation used by tcp_tso_autosize (and also tcp_xmit_size_goal since c/s 6c09fa09d) in determining when to split an skb into two is
sk->sk_gso_max_size - 1 - MAX_TCP_HEADER.
So the maximum permitted size of an skb is calculated to be
(XEN_NETIF_MAX_TX_SIZE - MAX_TCP_HEADER) - 1 - MAX_TCP_HEADER.
Intuitively, this looks like the wrong formula -- we don't need two TCP headers. Instead, there is no need to deviate from the default gso_max_size of 65536 as this already accommodates the size of the header.
Currently, the largest skb transmitted by netfront is 63712 bytes (44 segments of 1448 bytes each), as observed via tcpdump. This patch makes netfront send skbs of up to 65160 bytes (45 segments of 1448 bytes each).
Similarly, the maximum allowable mtu does not need to subtract MAX_TCP_HEADER as it relates to the size of the whole packet, including the header.
--- drivers/net/xen-netfront.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/xen-netfront.c +1 -4
@@ -1053,8 +1053,7 @@ err:static int xennet_change_mtu (struct net_device *dev,int mtu) { -int max =xennet_can_sg (dev) ? -XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER :ETH_DATA_LEN ; +int max =xennet_can_sg (dev) ?XEN_NETIF_MAX_TX_SIZE :ETH_DATA_LEN ;if (mtu > max)return -EINVAL ;
@@ -1329,8 +1328,6 @@ static struct net_device * __devinit xenSET_ETHTOOL_OPS (netdev, &xennet_ethtool_ops);SET_NETDEV_DEV (netdev, &dev->dev); -netif_set_gso_max_size (netdev,XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER ); - np->netdev = netdev;netif_carrier_off (netdev);
PATCH 172/221 be2iscsi: Fix kernel panic when device initialization fails
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: John Soni Jose <[email protected]>
commit 2e7cee027b26cbe7e6685a7a14bd2850bfe55d33 upstream.
Kernel panic was happening as iscsi_host_remove() was called on
a host which was not yet added.
--- drivers/scsi/be2iscsi/be_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/be2iscsi/be_main.c +1 -1
@@ -4397,9 +4397,9 @@ free_port: hba_free:if (phba->msix_enabled)pci_disable_msix (phba->pcidev); -iscsi_host_remove (phba->shost);pci_dev_put (phba->pcidev);iscsi_host_free (phba->shost); +pci_set_drvdata (pcidev,NULL ); disable_pci:pci_disable_device (pcidev);return ret;
PATCH 173/221 Defer processing of REQ_PREEMPT requests for blocked devices
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit bba0bdd7ad4713d82338bcd9b72d57e9335a664b upstream.
SCSI transport drivers and SCSI LLDs block a SCSI device if the transport layer is not operational. This means that in this state no requests should be processed, even if the REQ_PREEMPT flag has been set. This patch avoids that a rescan shortly after a cable pull sporadically triggers the following kernel oops:
BUG: unable to handle kernel paging request at ffffc9001a6bc084 IP: [<ffffffffa04e08f2>] mlx4_ib_post_send+0xd2/0xb30 [mlx4_ib] Process rescan-scsi-bus (pid: 9241, threadinfo ffff88053484a000, task ffff880534aae100) Call Trace: [<ffffffffa0718135>] srp_post_send+0x65/0x70 [ib_srp] [<ffffffffa071b9df>] srp_queuecommand+0x1cf/0x3e0 [ib_srp] [<ffffffffa0001ff1>] scsi_dispatch_cmd+0x101/0x280 [scsi_mod] [<ffffffffa0009ad1>] scsi_request_fn+0x411/0x4d0 [scsi_mod] [<ffffffff81223b37>] __blk_run_queue+0x27/0x30 [<ffffffff8122a8d2>] blk_execute_rq_nowait+0x82/0x110 [<ffffffff8122a9c2>] blk_execute_rq+0x62/0xf0 [<ffffffffa000b0e8>] scsi_execute+0xe8/0x190 [scsi_mod] [<ffffffffa000b2f3>] scsi_execute_req+0xa3/0x130 [scsi_mod] [<ffffffffa000c1aa>] scsi_probe_lun+0x17a/0x450 [scsi_mod] [<ffffffffa000ce86>] scsi_probe_and_add_lun+0x156/0x480 [scsi_mod] [<ffffffffa000dc2f>] __scsi_scan_target+0xdf/0x1f0 [scsi_mod] [<ffffffffa000dfa3>] scsi_scan_host_selected+0x183/0x1c0 [scsi_mod] [<ffffffffa000edfb>] scsi_scan+0xdb/0xe0 [scsi_mod] [<ffffffffa000ee13>] store_scan+0x13/0x20 [scsi_mod] [<ffffffff811c8d9b>] sysfs_write_file+0xcb/0x160 [<ffffffff811589de>] vfs_write+0xce/0x140 [<ffffffff81158b53>] sys_write+0x53/0xa0 [<ffffffff81464592>] system_call_fastpath+0x16/0x1b [<00007f611c9d9300>] 0x7f611c9d92ff
--- drivers/scsi/scsi_lib.c | 4 +++- include/linux/blk_types.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/scsi_lib.c +3 -1
@@ -1206,9 +1206,11 @@ int scsi_prep_state_check(struct scsi_de "rejecting I/O to dead device\n"); ret =BLKPREP_KILL ;break ; -case SDEV_QUIESCE :case SDEV_BLOCK :case SDEV_CREATED_BLOCK : + ret =BLKPREP_DEFER ; +break ; +case SDEV_QUIESCE :/* * If the devices is blocked we defer normal commands. */
include/linux/blk_types.h +3 -1
@@ -144,7 +144,9 @@ enum rq_flag_bits { __REQ_ELVPRIV,/* elevator private data attached */ __REQ_FAILED,/* set if the request failed */ __REQ_QUIET,/* don't worry about errors */ - __REQ_PREEMPT,/* set for "ide_preempt" requests */ + __REQ_PREEMPT,/* set for "ide_preempt" requests and also +for requests for which the SCSI "quiesce" +state must be ignored. */ __REQ_ALLOCED,/* request came from our alloc pool */ __REQ_COPY_USER,/* contains copies of user pages */ __REQ_FLUSH_SEQ, /* request for flush sequence */
PATCH 174/221 ocfs2: _really_ sync the right range
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 64b4e2526d1cf6e6a4db6213d6e2b6e6ab59479a upstream.
"ocfs2 syncs the wrong range" had been broken; prior to it the code was doing the wrong thing in case of O_APPEND, all right, but _after_ it we were syncing the wrong range in 100% cases. *ppos, aka iocb->ki_pos is incremented prior to that point, so we are always doing sync on the area _after_ the one we'd written to.
Spotted by Joseph Qi <[email protected]> back in January; unfortunately, I'd missed his mail back then ;-/
--- fs/ocfs2/file.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
fs/ocfs2/file.c +10 -4
@@ -2387,10 +2387,14 @@ out_dio:/* buffered aio wouldn't have proper lock coverage today */ BUG_ON (ret == -EIOCBQUEUED && !(file->f_flags &O_DIRECT )); +if (unlikely (written <=0 )) + goto no_sync; +if (((file->f_flags &O_DSYNC ) && !direct_io) ||IS_SYNC (inode) || ((file->f_flags &O_DIRECT ) && !direct_io)) { - ret =filemap_fdatawrite_range (file->f_mapping, *ppos, - *ppos + count -1 ); + ret =filemap_fdatawrite_range (file->f_mapping, + iocb->ki_pos - written, + iocb->ki_pos -1 );if (ret <0 ) written = ret;
@@ -2403,10 +2407,12 @@ out_dio: }if (!ret) - ret =filemap_fdatawait_range (file->f_mapping, *ppos, - *ppos + count -1 ); + ret =filemap_fdatawait_range (file->f_mapping, + iocb->ki_pos - written, + iocb->ki_pos -1 ); } +no_sync:/* * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io * function pointer which is called when o_direct io completes so that
PATCH 175/221 ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Dmitry M. Fedin" <[email protected]>
commit 3dc8523fa7412e731441c01fb33f003eb3cfece1 upstream.
Adds an entry for Creative USB X-Fi to the rc_config array in mixer_quirks.c to allow use of volume knob on the device. Adds support for newer X-Fi Pro card, known as "Model No. SB1095" with USB ID "041e:3237"
--- sound/usb/mixer_quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/mixer_quirks.c +1 -0
@@ -64,6 +64,7 @@ static const struct rc_config { { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */ { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */ { USB_ID(0x041e, 0x30df), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ + { USB_ID(0x041e, 0x3237), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ };
PATCH 176/221 netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Vagin <[email protected]>
commit 223b02d923ecd7c84cf9780bb3686f455d279279 upstream.
"len" contains sizeof(nf_ct_ext) and size of extensions. In a worst case it can contain all extensions. Bellow you can find sizes for all types of extensions. Their sum is definitely bigger than 256.
nf_ct_ext_types[0]->len = 24
nf_ct_ext_types[1]->len = 32
nf_ct_ext_types[2]->len = 24
nf_ct_ext_types[3]->len = 32
nf_ct_ext_types[4]->len = 152
nf_ct_ext_types[5]->len = 2
nf_ct_ext_types[6]->len = 16
nf_ct_ext_types[7]->len = 8
I have seen "len" up to 280 and my host has crashes w/o this patch.
The right way to fix this problem is reducing the size of the ecache extension (4) and Florian is going to do this, but these changes will be quite large to be appropriate for a stable tree.
--- include/net/netfilter/nf_conntrack_extend.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/net/netfilter/nf_conntrack_extend.h +2 -2
@@ -33,8 +33,8 @@ enum nf_ct_ext_id {/* Extensions: optional stuff which isn't permanently in struct. */ struct nf_ct_ext {struct rcu_head rcu; -u8 offset[NF_CT_EXT_NUM ]; -u8 len; +u16 offset[NF_CT_EXT_NUM ]; +u16 len;char data[0 ]; };
PATCH 177/221 net: llc: use correct size for sysctl timeout entries
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <[email protected]>
commit 6b8d9117ccb4f81b1244aafa7bc70ef8fa45fc49 upstream.
The timeout entries are sizeof(int) rather than sizeof(long), which means that when they were getting read we'd also leak kernel memory to userspace along with the timeout values.
--- net/llc/sysctl_net_llc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/llc/sysctl_net_llc.c +4 -4
@@ -17,28 +17,28 @@ static struct ctl_table llc2_timeout_tab { .procname = "ack", .data = &sysctl_llc2_ack_timeout, - .maxlen = sizeof(long), + .maxlen = sizeof(sysctl_llc2_ack_timeout), .mode = 0644, .proc_handler = proc_dointvec_jiffies, }, { .procname = "busy", .data = &sysctl_llc2_busy_timeout, - .maxlen = sizeof(long), + .maxlen = sizeof(sysctl_llc2_busy_timeout), .mode = 0644, .proc_handler = proc_dointvec_jiffies, }, { .procname = "p", .data = &sysctl_llc2_p_timeout, - .maxlen = sizeof(long), + .maxlen = sizeof(sysctl_llc2_p_timeout), .mode = 0644, .proc_handler = proc_dointvec_jiffies, }, { .procname = "rej", .data = &sysctl_llc2_rej_timeout, - .maxlen = sizeof(long), + .maxlen = sizeof(sysctl_llc2_rej_timeout), .mode = 0644, .proc_handler = proc_dointvec_jiffies, },
PATCH 178/221 net: rds: use correct size for max unacked packets and bytes
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sasha Levin <[email protected]>
commit db27ebb111e9f69efece08e4cb6a34ff980f8896 upstream.
Max unacked packets/bytes is an int while sizeof(long) was used in the sysctl table.
This means that when they were getting read we'd also leak kernel memory to userspace along with the timeout values.
--- net/rds/sysctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/rds/sysctl.c +2 -2
@@ -71,14 +71,14 @@ static struct ctl_table rds_sysctl_rds_table[] = { { .procname = "max_unacked_packets", .data = &rds_sysctl_max_unacked_packets, - .maxlen = sizeof(unsigned long), + .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { .procname = "max_unacked_bytes", .data = &rds_sysctl_max_unacked_bytes, - .maxlen = sizeof(unsigned long), + .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, },
PATCH 179/221 ipv6: Don't reduce hop limit for an interface
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "D.S. Ljungmark" <[email protected]>
commit 6fd99094de2b83d1d4c8457f2c83483b2828e75a upstream.
A local route may have a lower hop_limit set than global routes do.
RFC 3756, Section 4.2.7, "Parameter Spoofing"
Quoted 8 lines
1. The attacker includes a Current Hop Limit of one or another small number which the attacker knows will cause legitimate packets to be dropped before they reach their destination.
As an example, one possible approach to mitigate this threat is to ignore very small hop limits. The nodes could implement a configurable minimum hop limit, and ignore attempts to set it below said limit.
--- net/ipv6/ndisc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/ipv6/ndisc.c +8 -1
@@ -1277,7 +1277,14 @@ static void ndisc_router_discovery(struc rt->rt6i_expires = jiffies + (HZ * lifetime);if (ra_msg->icmph.icmp6_hop_limit) { - in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; +/* Only set hop_limit on the interface if it is higher than +* the current hop_limit. +*/ +if (in6_dev->cnf.hop_limit < ra_msg->icmph.icmp6_hop_limit) { + in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; + }else { +ND_PRINTK2 (KERN_WARNING "RA: Got route advertisement with lower hop_limit than current\n" ); + }if (rt)dst_metric_set (&rt->dst,RTAX_HOPLIMIT , ra_msg->icmph.icmp6_hop_limit);
PATCH 180/221 fs: take i_mutex during prepare_binprm for set[ug]id executables
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 8b01fc86b9f425899f8a3a8fc1c47d73c2c20543 upstream.
This prevents a race between chown() and execve(), where chowning a setuid-user binary to root would momentarily make the binary setuid root.
This patch was mostly written by Linus Torvalds.
[bwh: Backported to 3.2:
- Drop the task_no_new_privs() and user namespace checks
- Open-code file_inode()
- s/READ_ONCE/ACCESS_ONCE/
- Adjust context]
---
fs/exec.c +40 -25
@@ -1282,6 +1282,45 @@ int check_unsafe_exec(struct linux_binprreturn res; } +static void bprm_fill_uid (struct linux_binprm *bprm) +{ +struct inode *inode; +unsigned int mode; +uid_t uid; +gid_t gid; + +/* clear any previous set[ug]id data from a previous binary */ + bprm->cred->euid =current_euid (); + bprm->cred->egid =current_egid (); + +if (bprm->file->f_path.mnt->mnt_flags &MNT_NOSUID ) +return ; + + inode = bprm->file->f_path.dentry->d_inode; + mode =ACCESS_ONCE (inode->i_mode); +if (!(mode & (S_ISUID |S_ISGID ))) +return ; + +/* Be careful if suid/sgid is set */ +mutex_lock (&inode->i_mutex); + +/* reload atomically mode/uid/gid now that lock held */ + mode = inode->i_mode; + uid = inode->i_uid; + gid = inode->i_gid; +mutex_unlock (&inode->i_mutex); + +if (mode &S_ISUID ) { + bprm->per_clear |=PER_CLEAR_ON_SETID ; + bprm->cred->euid = uid; + } + +if ((mode & (S_ISGID |S_IXGRP )) == (S_ISGID |S_IXGRP )) { + bprm->per_clear |=PER_CLEAR_ON_SETID ; + bprm->cred->egid = gid; + } +} +/* * Fill the binprm structure from the inode. * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes
@@ -1290,36 +1329,12 @@ int check_unsafe_exec(struct linux_binpr*/ int prepare_binprm (struct linux_binprm *bprm) { -umode_t mode; -struct inode * inode = bprm->file->f_path.dentry->d_inode;int retval; - mode = inode->i_mode;if (bprm->file->f_op ==NULL )return -EACCES ; -/* clear any previous set[ug]id data from a previous binary */ - bprm->cred->euid =current_euid (); - bprm->cred->egid =current_egid (); - -if (!(bprm->file->f_path.mnt->mnt_flags &MNT_NOSUID )) { -/* Set-uid? */ -if (mode &S_ISUID ) { - bprm->per_clear |=PER_CLEAR_ON_SETID ; - bprm->cred->euid = inode->i_uid; - } - -/* Set-gid? */ -/* -* If setgid is set but no group execute bit then this -* is a candidate for mandatory locking, not a setgid -* executable. -*/ -if ((mode & (S_ISGID |S_IXGRP )) == (S_ISGID |S_IXGRP )) { - bprm->per_clear |=PER_CLEAR_ON_SETID ; - bprm->cred->egid = inode->i_gid; - } - } +bprm_fill_uid (bprm);/* fill in binprm security blob */ retval =security_bprm_set_creds (bprm);
PATCH 181/221 ipv4: Missing sk_nulls_node_init() in ping_unhash().
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "David S. Miller" <[email protected]>
commit a134f083e79fb4c3d0a925691e732c56911b4326 upstream.
If we don't do that, then the poison value is left in the ->pprev backlink.
This can cause crashes if we do a disconnect, followed by a connect().
--- net/ipv4/ping.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/ping.c +1 -0
@@ -139,6 +139,7 @@ static void ping_v4_unhash(struct sock *if (sk_hashed (sk)) {write_lock_bh (&ping_table.lock);hlist_nulls_del (&sk->sk_nulls_node); +sk_nulls_node_init (&sk->sk_nulls_node);sock_put (sk); isk->inet_num = isk->inet_sport =0 ;sock_prot_inuse_add (sock_net (sk), sk->sk_prot,-1 );
PATCH 182/221 net:socket: set msg_namelen to 0 if msg_name is passed as NULL in msghdr struct from userland.
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ani Sinha <[email protected]>
commit 6a2a2b3ae0759843b22c929881cc184b00cc63ff upstream.
Linux manpage for recvmsg and sendmsg calls does not explicitly mention setting msg_namelen to 0 when msg_name passed set as NULL. When developers don't set msg_namelen member in msghdr, it might contain garbage value which will fail the validation check and sendmsg and recvmsg calls from kernel will return EINVAL. This will break old binaries and any code for which there is no access to source code.
To fix this, we set msg_namelen to 0 when msg_name is passed as NULL from userland.
--- net/socket.c | 3 +++ 1 file changed, 3 insertions(+)
net/socket.c +3 -0
@@ -1885,6 +1885,9 @@ static int copy_msghdr_from_user(structif (copy_from_user (kmsg, umsg,sizeof (struct msghdr )))return -EFAULT ; +if (kmsg->msg_name ==NULL ) + kmsg->msg_namelen =0 ; +if (kmsg->msg_namelen <0 )return -EINVAL ;
PATCH 183/221 NFSv4: Minor cleanups for nfs4_handle_exception and nfs4_async_handle_error
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 14977489ffdb80d4caf5a184ba41b23b02fbacd9 upstream.
[bwh: This is not merely a cleanup but also fixes a regression introduced by
commit 3114ea7a24d3 ("NFSv4: Return the delegation if the server returns NFS4ERR_OPENMODE"), backported in 3.2.14]
--- fs/nfs/nfs4proc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/nfs/nfs4proc.c +5 -5
@@ -267,7 +267,7 @@ static int nfs4_handle_exception(structcase 0 :return 0 ;case -NFS4ERR_OPENMODE : -if (nfs_have_delegation (inode,FMODE_READ )) { +if (inode &&nfs_have_delegation (inode,FMODE_READ )) {nfs_inode_return_delegation (inode); exception->retry =1 ;return 0 ;
@@ -279,10 +279,9 @@ static int nfs4_handle_exception(structcase -NFS4ERR_DELEG_REVOKED :case -NFS4ERR_ADMIN_REVOKED :case -NFS4ERR_BAD_STATEID : -if (state !=NULL ) -nfs_remove_bad_delegation (state->inode);if (state ==NULL )break ; +nfs_remove_bad_delegation (state->inode);nfs4_schedule_stateid_recovery (server, state); goto wait_on_recovery;case -NFS4ERR_EXPIRED :
@@ -3746,8 +3745,9 @@ nfs4_async_handle_error(struct rpc_taskcase -NFS4ERR_DELEG_REVOKED :case -NFS4ERR_ADMIN_REVOKED :case -NFS4ERR_BAD_STATEID : -if (state !=NULL ) -nfs_remove_bad_delegation (state->inode); +if (state ==NULL ) +break ; +nfs_remove_bad_delegation (state->inode);case -NFS4ERR_OPENMODE :if (state ==NULL )break ;
PATCH 184/221 jfs: fix readdir regression
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dave Kleikamp <[email protected]>
Upstream commit 44512449, "jfs: fix readdir cookie incompatibility with NFSv4", was backported incorrectly into the stable trees which used the filldir callback (rather than dir_emit). The position is being incorrectly passed to filldir for the . and .. entries.
The still-maintained stable trees that need to be fixed are 3.2.y, 3.4.y and 3.10.y.
https://bugzilla.kernel.org/show_bug.cgi?id=94741
--- fs/jfs/jfs_dtree.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/jfs/jfs_dtree.c +2 -2
@@ -3103,7 +3103,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)* self "." */ filp->f_pos =1 ; -if (filldir (dirent,"." ,1 ,0 , ip->i_ino, +if (filldir (dirent,"." ,1 ,1 , ip->i_ino,DT_DIR ))return 0 ; }
@@ -3111,7 +3111,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)* parent ".." */ filp->f_pos =2 ; -if (filldir (dirent,".." ,2 ,1 ,PARENT (ip),DT_DIR )) +if (filldir (dirent,".." ,2 ,2 ,PARENT (ip),DT_DIR ))return 0 ;/*
PATCH 185/221 ip: zero sockaddr returned on error queue
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
[ Upstream commit f812116b174e59a350acc8e4856213a166a91222 ]
The sockaddr is returned in IP(V6)_RECVERR as part of errhdr. That structure is defined and allocated on the stack as
struct {
struct sock_extended_err ee;
struct sockaddr_in(6) offender;
} errhdr;The second part is only initialized for certain SO_EE_ORIGIN values. Always initialize it completely.
An MTU exceeded error on a SOCK_RAW/IPPROTO_RAW is one example that would return uninitialized bytes.
----
Also verified that there is no padding between errhdr.ee and errhdr.offender that could leak additional kernel data.
--- net/ipv4/ip_sockglue.c | 8 ++------ net/ipv6/datagram.c | 10 +++------- 2 files changed, 5 insertions(+), 13 deletions(-)
net/ipv4/ip_sockglue.c +2 -6
@@ -416,15 +416,11 @@ int ip_recv_error(struct sock *sk, strucmemcpy (&errhdr.ee, &serr->ee,sizeof (struct sock_extended_err )); sin = &errhdr.offender; - sin->sin_family =AF_UNSPEC ; +memset (sin,0 ,sizeof (*sin));if (serr->ee.ee_origin ==SO_EE_ORIGIN_ICMP ) { -struct inet_sock *inet =inet_sk (sk); - sin->sin_family =AF_INET ; sin->sin_addr.s_addr =ip_hdr (skb)->saddr; - sin->sin_port =0 ; -memset (&sin->sin_zero,0 ,sizeof (sin->sin_zero)); -if (inet->cmsg_flags) +if (inet_sk (sk)->cmsg_flags)ip_cmsg_recv (msg, skb); }
net/ipv6/datagram.c +3 -7
@@ -371,12 +371,10 @@ int ipv6_recv_error(struct sock *sk, strmemcpy (&errhdr.ee, &serr->ee,sizeof (struct sock_extended_err )); sin = &errhdr.offender; - sin->sin6_family =AF_UNSPEC ; +memset (sin,0 ,sizeof (*sin)); +if (serr->ee.ee_origin !=SO_EE_ORIGIN_LOCAL ) { sin->sin6_family =AF_INET6 ; - sin->sin6_flowinfo =0 ; - sin->sin6_port =0 ; - sin->sin6_scope_id =0 ;if (skb->protocol ==htons (ETH_P_IPV6 )) {ipv6_addr_copy (&sin->sin6_addr, &ipv6_hdr (skb)->saddr);if (np->rxopt.all)
@@ -384,11 +382,9 @@ int ipv6_recv_error(struct sock *sk, strif (ipv6_addr_type (&sin->sin6_addr) &IPV6_ADDR_LINKLOCAL ) sin->sin6_scope_id =IP6CB (skb)->iif; }else { -struct inet_sock *inet =inet_sk (sk); -ipv6_addr_set_v4mapped (ip_hdr (skb)->saddr, &sin->sin6_addr); -if (inet->cmsg_flags) +if (inet_sk (sk)->cmsg_flags)ip_cmsg_recv (msg, skb); } }
PATCH 186/221 net: rps: fix cpu unplug
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit ac64da0b83d82abe62f78b3d0e21cca31aea24fa ]
softnet_data.input_pkt_queue is protected by a spinlock that we must hold when transferring packets from victim queue to an active one. This is because other cpus could still be trying to enqueue packets into victim queue.
A second problem is that when we transfert the NAPI poll_list from victim to current cpu, we absolutely need to special case the percpu backlog, because we do not want to add complex locking to protect process_queue : Only owner cpu is allowed to manipulate it, unless cpu is offline.
Based on initial patch from Prasad Sodagudi & Subash Abhinov Kasiviswanathan.
This version is better because we do not slow down packet processing, only make migration safer.
--- net/core/dev.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
net/core/dev.c +15 -5
@@ -6338,10 +6338,20 @@ static int dev_cpu_callback(struct notif oldsd->output_queue =NULL ; oldsd->output_queue_tailp = &oldsd->output_queue; } -/* Append NAPI poll list from offline CPU. */ -if (!list_empty (&oldsd->poll_list)) { -list_splice_init (&oldsd->poll_list, &sd->poll_list); -raise_softirq_irqoff (NET_RX_SOFTIRQ ); +/* Append NAPI poll list from offline CPU, with one exception : +* process_backlog() must be called by cpu owning percpu backlog. +* We properly handle process_queue & input_pkt_queue later. +*/ +while (!list_empty (&oldsd->poll_list)) { +struct napi_struct *napi =list_first_entry (&oldsd->poll_list, + struct napi_struct, + poll_list); + +list_del_init (&napi->poll_list); +if (napi->poll == process_backlog) + napi->state =0 ; +else +____napi_schedule (sd, napi); }raise_softirq_irqoff (NET_TX_SOFTIRQ );
@@ -6352,7 +6362,7 @@ static int dev_cpu_callback(struct notifnetif_rx (skb);input_queue_head_incr (oldsd); } -while ((skb =__skb_dequeue (&oldsd->input_pkt_queue))) { +while ((skb =skb_dequeue (&oldsd->input_pkt_queue))) {netif_rx (skb);input_queue_head_incr (oldsd); }
PATCH 187/221 ipv6: stop sending PTB packets for MTU < 1280
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hagen Paul Pfeifer <[email protected]>
[ Upstream commit 9d289715eb5c252ae15bd547cb252ca547a3c4f2 ]
Reduce the attack vector and stop generating IPv6 Fragment Header for paths with an MTU smaller than the minimum required IPv6 MTU size (1280 byte) - called atomic fragments.
See IETF I-D "Deprecating the Generation of IPv6 Atomic Fragments" [1] for more information and how this "feature" can be misused.
[1] https://tools.ietf.org/html/draft-ietf-6man-deprecate-atomfrag-generation-00
--- net/ipv6/route.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/ipv6/route.c +2 -5
@@ -1018,12 +1018,9 @@ static void ip6_rt_update_pmtu(struct dsif (mtu <dst_mtu (dst) && rt6->rt6i_dst.plen ==128 ) { rt6->rt6i_flags |=RTF_MODIFIED ; -if (mtu <IPV6_MIN_MTU ) { -u32 features =dst_metric (dst,RTAX_FEATURES ); +if (mtu <IPV6_MIN_MTU ) mtu =IPV6_MIN_MTU ; - features |=RTAX_FEATURE_ALLFRAG ; -dst_metric_set (dst,RTAX_FEATURES , features); - } +dst_metric_set (dst,RTAX_MTU , mtu); } }
PATCH 188/221 netxen: fix netxen_nic_poll() logic
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 6088beef3f7517717bd21d90b379714dd0837079 ]
NAPI poll logic now enforces that a poller returns exactly the budget when it wants to be called again.
If a driver limits TX completion, it has to return budget as well when the limit is hit, not the number of received packets.
--- drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +4 -1
@@ -2277,7 +2277,10 @@ static int netxen_nic_poll(struct napi_s work_done =netxen_process_rcv_ring (sds_ring, budget); -if ((work_done < budget) && tx_complete) { +if (!tx_complete) + work_done = budget; + +if (work_done < budget) {napi_complete (&sds_ring->napi);if (test_bit (__NX_DEV_UP, &adapter->state))netxen_nic_enable_int (sds_ring);
PATCH 189/221 ping: Fix race in free in receive path
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
[ Upstream commit fc752f1f43c1c038a2c6ae58cc739ebb5953ccb0 ]
An exception is seen in ICMP ping receive path where the skb destructor sock_rfree() tries to access a freed socket. This happens because ping_rcv() releases socket reference with sock_put() and this internally frees up the socket. Later icmp_rcv() will try to free the skb and as part of this, skb destructor is called and which leads to a kernel panic as the socket is freed already in ping_rcv().
-->|exception
-007|sk_mem_uncharge -007|sock_rfree -008|skb_release_head_state -009|skb_release_all -009|__kfree_skb -010|kfree_skb -011|icmp_rcv -012|ip_local_deliver_finish
Fix this incorrect free by cloning this skb and processing this cloned skb instead.
This patch was suggested by Eric Dumazet
--- net/ipv4/ping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv4/ping.c +4 -1
@@ -717,8 +717,11 @@ void ping_rcv(struct sk_buff *skb) sk =ping_v4_lookup (net, saddr, daddr,ntohs (icmph->un.echo.id), skb->dev->ifindex);if (sk !=NULL ) { +struct sk_buff *skb2 =skb_clone (skb,GFP_ATOMIC ); +pr_debug ("rcv on socket %p\n" , sk); -ping_queue_rcv_skb (sk,skb_get (skb)); +if (skb2) +ping_queue_rcv_skb (sk, skb2);sock_put (sk);return ; }
PATCH 190/221 ppp: deflate: never return len larger than output buffer
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit e2a4800e75780ccf4e6c2487f82b688ba736eb18 ]
When we've run out of space in the output buffer to store more data, we will call zlib_deflate with a NULL output buffer until we've consumed remaining input.
When this happens, olen contains the size the output buffer would have consumed iff we'd have had enough room.
This can later cause skb_over_panic when ppp_generic skb_put()s the returned length.
--- drivers/net/ppp/ppp_deflate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ppp/ppp_deflate.c +1 -1
@@ -268,7 +268,7 @@ static int z_compress(void *arg, unsigne/* * See if we managed to reduce the size of the packet. */ -if (olen < isize) { +if (olen < isize && olen <= osize) { state->stats.comp_bytes += olen; state->stats.comp_packets++; }else {
PATCH 191/221 rtnetlink: call ->dellink on failure when ->newlink exists
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: WANG Cong <[email protected]>
[ Upstream commit 7afb8886a05be68e376655539a064ec672de8a8e ]
Ignacy reported that when eth0 is down and add a vlan device on top of it like:
ip link add link eth0 name eth0.1 up type vlan id 1
We will get a refcount leak:
unregister_netdevice: waiting for eth0.1 to become free. Usage count = 2
The problem is when rtnl_configure_link() fails in rtnl_newlink(), we simply call unregister_device(), but for stacked device like vlan, we almost do nothing when we unregister the upper device, more work is done when we unregister the lower device, so call its ->dellink().
--- net/core/rtnetlink.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
net/core/rtnetlink.c +10 -2
@@ -1860,8 +1860,16 @@ replay: goto out; err =rtnl_configure_link (dev, ifm); -if (err <0 ) -unregister_netdevice (dev); +if (err <0 ) { +if (ops->newlink) { +LIST_HEAD (list_kill); + + ops->dellink (dev, &list_kill); +unregister_netdevice_many (&list_kill); + }else { +unregister_netdevice (dev); + } + } out:put_net (dest_net);return err;
PATCH 192/221 gen_stats.c: Duplicate xstats buffer for later use
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ignacy Gawędzki <[email protected]>
[ Upstream commit 1c4cff0cf55011792125b6041bc4e9713e46240f ]
The gnet_stats_copy_app() function gets called, more often than not, with its second argument a pointer to an automatic variable in the caller's stack. Therefore, to avoid copying garbage afterwards when calling gnet_stats_finish_copy(), this data is better copied to a dynamically allocated memory that gets freed after use.
[[email protected]: remove a useless kfree()]
--- net/core/gen_stats.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
net/core/gen_stats.c +14 -1
@@ -31,6 +31,9 @@ gnet_stats_copy(struct gnet_dump *d, intreturn 0 ; nla_put_failure: +kfree (d->xstats); + d->xstats =NULL ; + d->xstats_len =0 ;spin_unlock_bh (d->lock);return -1 ; }
@@ -204,7 +207,9 @@ int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) { if (d->compat_xstats) { - d->xstats = st; + d->xstats = kmemdup(st, len, GFP_ATOMIC); +if (!d->xstats) + goto err_out; d->xstats_len = len; }
@@ -212,6 +217,11 @@ gnet_stats_copy_app(struct gnet_dump *d,return gnet_stats_copy (d,TCA_STATS_APP , st, len);return 0 ; + +err_out: + d->xstats_len =0 ; +spin_unlock_bh (d->lock); +return -1 ; }EXPORT_SYMBOL (gnet_stats_copy_app);
@@ -244,6 +254,9 @@ gnet_stats_finish_copy(struct gnet_dumpreturn -1 ; } +kfree (d->xstats); + d->xstats =NULL ; + d->xstats_len =0 ;spin_unlock_bh (d->lock);return 0 ; }
PATCH 193/221 ipv4: ip_check_defrag should not assume that skb_network_offset is zero
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Drozdov <[email protected]>
[ Upstream commit 3e32e733d1bbb3f227259dc782ef01d5706bdae0 ]
ip_check_defrag() may be used by af_packet to defragment outgoing packets. skb_network_offset() of af_packet's outgoing packets is not zero.
--- net/ipv4/ip_fragment.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/ipv4/ip_fragment.c +7 -4
@@ -692,27 +692,30 @@ EXPORT_SYMBOL(ip_defrag);struct sk_buff *ip_check_defrag (struct sk_buff *skb,u32 user) {struct iphdr iph; +int netoff;u32 len;if (skb->protocol !=htons (ETH_P_IP ))return skb; -if (skb_copy_bits (skb,0 , &iph,sizeof (iph)) <0 ) + netoff =skb_network_offset (skb); + +if (skb_copy_bits (skb, netoff, &iph,sizeof (iph)) <0 )return skb;if (iph.ihl <5 || iph.version !=4 )return skb; len =ntohs (iph.tot_len); -if (skb->len < len || len < (iph.ihl *4 )) +if (skb->len < netoff + len || len < (iph.ihl *4 ))return skb;if (ip_is_fragment (&iph)) { skb =skb_share_check (skb,GFP_ATOMIC );if (skb) { -if (!pskb_may_pull (skb, iph.ihl*4 )) +if (!pskb_may_pull (skb, netoff + iph.ihl *4 ))return skb; -if (pskb_trim_rcsum (skb, len)) +if (pskb_trim_rcsum (skb, netoff + len))return skb;memset (IPCB (skb),0 ,sizeof (struct inet_skb_parm ));if (ip_defrag (skb, user))
PATCH 194/221 ematch: Fix auto-loading of ematch modules.
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ignacy Gawędzki <[email protected]>
[ Upstream commit 34eea79e2664b314cab6a30fc582fdfa7a1bb1df ]
In tcf_em_validate(), after calling request_module() to load the kind-specific module, set em->ops to NULL before returning -EAGAIN, so that module_put() is not called again by tcf_em_tree_destroy().
--- net/sched/ematch.c | 1 + 1 file changed, 1 insertion(+)
net/sched/ematch.c +1 -0
@@ -227,6 +227,7 @@ static int tcf_em_validate(struct tcf_pr* to replay the request. */ module_put (em->ops->owner); + em->ops =NULL ; err = -EAGAIN; }#endif
PATCH 195/221 net: reject creation of netdev names with colons
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Thode <[email protected]>
[ Upstream commit a4176a9391868bfa87705bcd2e3b49e9b9dd2996 ]
colons are used as a separator in netdev device lookup in dev_ioctl.c
Specific functions are SIOCGIFTXQLEN SIOCETHTOOL SIOCSIFNAME
--- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
@@ -859,7 +859,7 @@ int dev_valid_name(const char *name)return 0 ;while (*name) { -if (*name =='/' ||isspace (*name)) +if (*name =='/' || *name ==':' ||isspace (*name))return 0 ; name++; }
PATCH 196/221 macvtap: limit head length of skb allocated
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
commit 16a3fa28630331e28208872fa5341ce210b901c7 upstream.
We currently use hdr_len as a hint of head length which is advertised by guest. But when guest advertise a very big value, it can lead to an 64K+ allocating of kmalloc() which has a very high possibility of failure when host memory is fragmented or under heavy stress. The huge hdr_len also reduce the effect of zerocopy or even disable if a gso skb is linearized in guest.
To solves those issues, this patch introduces an upper limit (PAGE_SIZE) of the head, which guarantees an order 0 allocation each time.
--- drivers/net/macvtap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/macvtap.c +7 -1
@@ -672,6 +672,7 @@ static ssize_t macvtap_get_user(struct m const struct iovec *iv, unsigned long total_len, size_t count, int noblock) { + int good_linear = SKB_MAX_HEAD(NET_IP_ALIGN);struct sk_buff *skb;struct macvlan_dev *vlan;unsigned long len = total_len;
@@ -714,6 +715,8 @@ static ssize_t macvtap_get_user(struct mif (m && m->msg_control &&sock_flag (&q->sk,SOCK_ZEROCOPY )) { copylen = vnet_hdr.hdr_len ? vnet_hdr.hdr_len :GOODCOPY_LEN ; +if (copylen > good_linear) + copylen = good_linear; linear = copylen;if (iov_pages (iv, vnet_hdr_len + copylen, count) <=MAX_SKB_FRAGS )
@@ -722,7 +725,10 @@ static ssize_t macvtap_get_user(struct mif (!zerocopy) { copylen = len; - linear = vnet_hdr.hdr_len; +if (vnet_hdr.hdr_len > good_linear) + linear = good_linear; +else + linear = vnet_hdr.hdr_len; } skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen,
PATCH 197/221 macvtap: make sure neighbour code can push ethernet header
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 2f1d8b9e8afa5a833d96afcd23abcb8cdf8d83ab ]
Brian reported crashes using IPv6 traffic with macvtap/veth combo.
I tracked the crashes in neigh_hh_output()
-> memcpy(skb->data - HH_DATA_MOD, hh->hh_data, HH_DATA_MOD);
Neighbour code assumes headroom to push Ethernet header is at least 16 bytes.
It appears macvtap has only 14 bytes available on arches where NET_IP_ALIGN is 0 (like x86)
Effect is a corruption of 2 bytes right before skb->head, and possible crashes if accessing non existing memory.
This fix should also increase IPv4 performance, as paranoid code in ip_finish_output2() wont have to call skb_realloc_headroom()
--- drivers/net/macvtap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/macvtap.c +5 -2
@@ -667,12 +667,15 @@ static unsigned long iov_pages(const strreturn pages; } +/* Neighbour code has some assumptions on HH_DATA_MOD alignment */ +#define MACVTAP_RESERVE HH_DATA_OFF(ETH_HLEN) +/* Get packet from user space buffer */ static ssize_t macvtap_get_user (struct macvtap_queue *q,struct msghdr *m,const struct iovec *iv,unsigned long total_len,size_t count,int noblock) { -int good_linear =SKB_MAX_HEAD (NET_IP_ALIGN ); +int good_linear =SKB_MAX_HEAD (MACVTAP_RESERVE );struct sk_buff *skb;struct macvlan_dev *vlan;unsigned long len = total_len;
@@ -731,7 +734,7 @@ static ssize_t macvtap_get_user(struct m linear = vnet_hdr.hdr_len; } - skb =macvtap_alloc_skb (&q->sk,NET_IP_ALIGN , copylen, + skb =macvtap_alloc_skb (&q->sk,MACVTAP_RESERVE , copylen, linear, noblock, &err);if (!skb) goto err;
PATCH 198/221 usb: plusb: Add support for National Instruments host-to-host cable
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Shelton <[email protected]>
[ Upstream commit 42c972a1f390e3bc51ca1e434b7e28764992067f ]
The National Instruments USB Host-to-Host Cable is based on the Prolific PL-25A1 chipset. Add its VID/PID so the plusb driver will recognize it.
--- drivers/net/usb/plusb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/usb/plusb.c +5 -0
@@ -139,6 +139,11 @@ static const struct usb_device_id produc }, { USB_DEVICE(0x050d, 0x258a), /* Belkin F5U258/F5U279 (PL-25A1) */ .driver_info = (unsigned long ) &prolific_info, +}, { +USB_DEVICE (0x3923 ,0x7825 ),/* National Instruments USB +* Host-to-Host Cable +*/ + .driver_info = (unsigned long) &prolific_info, }, { }, // END
PATCH 199/221 udp: only allow UFO for packets from SOCK_DGRAM sockets
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kubeček <[email protected]>
[ Upstream commit acf8dd0a9d0b9e4cdb597c2f74802f79c699e802 ]
If an over-MTU UDP datagram is sent through a SOCK_RAW socket to a UFO-capable device, ip_ufo_append_data() sets skb->ip_summed to CHECKSUM_PARTIAL unconditionally as all GSO code assumes transport layer checksum is to be computed on segmentation. However, in this case, skb->csum_start and skb->csum_offset are never set as raw socket transmit path bypasses udp_send_skb() where they are usually set. As a result, driver may access invalid memory when trying to calculate the checksum and store the result (as observed in virtio_net driver).
Moreover, the very idea of modifying the userspace provided UDP header is IMHO against raw socket semantics (I wasn't able to find a document clearly stating this or the opposite, though). And while allowing CHECKSUM_NONE in the UFO case would be more efficient, it would be a bit too intrusive change just to handle a corner case like this. Therefore disallowing UFO for packets from SOCK_DGRAM seems to be the best option.
--- net/ipv4/ip_output.c | 3 ++- net/ipv6/ip6_output.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
net/ipv4/ip_output.c +2 -1
@@ -834,7 +834,8 @@ static int __ip_append_data(struct sock cork->length += length;if (((length > mtu) || (skb &&skb_has_frags (skb))) && (sk->sk_protocol ==IPPROTO_UDP ) && - (rt->dst.dev->features &NETIF_F_UFO ) && !rt->dst.header_len) { + (rt->dst.dev->features &NETIF_F_UFO ) && !rt->dst.header_len && + (sk->sk_type ==SOCK_DGRAM )) { err =ip_ufo_append_data (sk, queue, getfrag, from, length, hh_len, fragheaderlen, transhdrlen, maxfraglen, flags);
net/ipv6/ip6_output.c +2 -1
@@ -1339,7 +1339,8 @@ int ip6_append_data(struct sock *sk, intif (((length > mtu) || (skb &&skb_has_frags (skb))) && (sk->sk_protocol ==IPPROTO_UDP ) && - (rt->dst.dev->features &NETIF_F_UFO )) { + (rt->dst.dev->features &NETIF_F_UFO ) && + (sk->sk_type ==SOCK_DGRAM )) { err =ip6_ufo_append_data (sk, getfrag, from, length, hh_len, fragheaderlen, transhdrlen, mtu, flags, rt);
PATCH 200/221 net: ping: Return EAFNOSUPPORT when appropriate.
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Colitti <[email protected]>
[ Upstream commit 9145736d4862145684009d6a72a6e61324a9439e ]
1. For an IPv4 ping socket, ping_check_bind_addr does not check the family of the socket address that's passed in. Instead, make it behave like inet_bind, which enforces either that the address family is AF_INET, or that the family is AF_UNSPEC and the address is 0.0.0.0.
2. For an IPv6 ping socket, ping_check_bind_addr returns EINVAL if the socket family is not AF_INET6. Return EAFNOSUPPORT instead, for consistency with inet6_bind.
3. Make ping_v4_sendmsg and ping_v6_sendmsg return EAFNOSUPPORT instead of EINVAL if an incorrect socket address structure is passed in.
4. Make IPv6 ping sockets be IPv6-only. The code does not support IPv4, and it cannot easily be made to support IPv4 because the protocol numbers for ICMP and ICMPv6 are different. This makes connect(::ffff:192.0.2.1) fail with EAFNOSUPPORT instead of making the socket unusable.
Among other things, this fixes an oops that can be triggered by:
int s = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
struct sockaddr_in6 sin6 = {
.sin6_family = AF_INET6,
.sin6_addr = in6addr_any,
};
bind(s, (struct sockaddr *) &sin6, sizeof(sin6));[bwh: Backported to 3.2:
- Drop the IPv6 part
- Adjust context, indentation]
--- net/ipv4/ping.c | 14 +++++++++++++- net/ipv6/ping.c | 5 +++-- 2 files changed, 16 insertions(+), 3 deletions(-)
net/ipv4/ping.c +6 -1
@@ -258,6 +258,11 @@ static int ping_bind(struct sock *sk, stif (addr_len <sizeof (struct sockaddr_in ))return -EINVAL ; +if (addr->sin_family !=AF_INET && + !(addr->sin_family ==AF_UNSPEC && + addr->sin_addr.s_addr ==htonl (INADDR_ANY ))) +return -EAFNOSUPPORT ; +pr_debug ("ping_v4_bind(sk=%p,sa_addr=%08x,sa_port=%d)\n" , sk, addr->sin_addr.s_addr,ntohs (addr->sin_port));
@@ -505,7 +510,7 @@ static int ping_sendmsg(struct kiocb *ioif (msg->msg_namelen <sizeof (*usin))return -EINVAL ;if (usin->sin_family !=AF_INET ) -return -EINVAL ; +return -EAFNOSUPPORT ; daddr = usin->sin_addr.s_addr;/* no remote port */ }else {
PATCH 201/221 net: avoid to hang up on sending due to sysctl configuration overflow.
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit cdda88912d62f9603d27433338a18be83ef23ac1 upstream.
I found if we write a larger than 4GB value to some sysctl
variables, the sending syscall will hang up forever, because these variables are 32 bits, such large values make them overflow to 0 or negative.
This patch try to fix overflow or prevent from zero value setup
of below sysctl variables:
net.core.wmem_default
net.core.rmem_default
net.core.rmem_max
net.core.wmem_max
net.ipv4.udp_rmem_min
net.ipv4.udp_wmem_min
net.ipv4.tcp_wmem
net.ipv4.tcp_rmem
[bwh: Backported to 3.2:
- Adjust context
- Delete now-unused 'zero' variable]
--- net/core/sysctl_net_core.c | 14 ++++++++++---- net/ipv4/sysctl_net_ipv4.c | 11 +++++++---- 2 files changed, 17 insertions(+), 8 deletions(-)
net/core/sysctl_net_core.c +10 -4
@@ -22,6 +22,8 @@static int zero =0 ;static int ushort_max =USHRT_MAX ; +static int one =1 ; +#ifdef CONFIG_RPS static int rps_sock_flow_sysctl (ctl_table *table,int write,void __user *buffer,size_t *lenp,loff_t *ppos)
@@ -89,28 +91,32 @@ static struct ctl_table net_core_table[] .data = &sysctl_wmem_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec + .proc_handler = proc_dointvec_minmax, + .extra1 = &one, }, { .procname = "rmem_max", .data = &sysctl_rmem_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec + .proc_handler = proc_dointvec_minmax, + .extra1 = &one, }, { .procname = "wmem_default", .data = &sysctl_wmem_default, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec + .proc_handler = proc_dointvec_minmax, + .extra1 = &one, }, { .procname = "rmem_default", .data = &sysctl_rmem_default, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec + .proc_handler = proc_dointvec_minmax, + .extra1 = &one, }, { .procname = "dev_weight",
net/ipv4/sysctl_net_ipv4.c +7 -5
@@ -24,7 +24,7 @@#include <net/inet_frag.h> #include <net/ping.h> -static int zero; +static int one =1 ;static int tcp_retr1_max =255 ;static int ip_local_port_range_min[] = {1 ,1 };static int ip_local_port_range_max[] = {65535 ,65535 };
@@ -448,14 +448,16 @@ static struct ctl_table ipv4_table[] = { .data = &sysctl_tcp_wmem, .maxlen = sizeof(sysctl_tcp_wmem), .mode = 0644, - .proc_handler = proc_dointvec + .proc_handler = proc_dointvec_minmax, + .extra1 = &one, }, { .procname = "tcp_rmem", .data = &sysctl_tcp_rmem, .maxlen = sizeof(sysctl_tcp_rmem), .mode = 0644, - .proc_handler = proc_dointvec + .proc_handler = proc_dointvec_minmax, + .extra1 = &one, }, { .procname = "tcp_app_win",
@@ -662,7 +664,7 @@ static struct ctl_table ipv4_table[] = { .maxlen = sizeof(sysctl_udp_rmem_min), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero + .extra1 = &one }, { .procname = "udp_wmem_min",
@@ -670,7 +672,7 @@ static struct ctl_table ipv4_table[] = { .maxlen = sizeof(sysctl_udp_wmem_min), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &zero + .extra1 = &one }, { } };
PATCH 202/221 net: sysctl_net_core: check SNDBUF and RCVBUF for min length
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Kodanev <[email protected]>
[ Upstream commit b1cb59cf2efe7971d3d72a7b963d09a512d994c9 ]
sysctl has sysctl.net.core.rmem_*/wmem_* parameters which can be set to incorrect values. Given that 'struct sk_buff' allocates from rcvbuf, incorrectly set buffer length could result to memory allocation failures. For example, set them as follows:
# sysctl net.core.rmem_default=64
net.core.wmem_default = 64
# sysctl net.core.wmem_default=64
net.core.wmem_default = 64
# ping localhost -s 1024 -i 0 > /dev/nullThis could result to the following failure:
skbuff: skb_over_panic: text:ffffffff81628db4 len:-32 put:-32 head:ffff88003a1cc200 data:ffff88003a1cc200 tail:0xffffffe0 end:0xc0 dev:<NULL> kernel BUG at net/core/skbuff.c:102!
invalid opcode: 0000 [#1] SMP
...
task: ffff88003b7f5550 ti: ffff88003ae88000 task.ti: ffff88003ae88000
RIP: 0010:[<ffffffff8155fbd1>] [<ffffffff8155fbd1>] skb_put+0xa1/0xb0
RSP: 0018:ffff88003ae8bc68 EFLAGS: 00010296
RAX: 000000000000008d RBX: 00000000ffffffe0 RCX: 0000000000000000
RDX: ffff88003fdcf598 RSI: ffff88003fdcd9c8 RDI: ffff88003fdcd9c8
RBP: ffff88003ae8bc88 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 00000000000002b2 R12: 0000000000000000
R13: 0000000000000000 R14: ffff88003d3f7300 R15: ffff88000012a900
FS: 00007fa0e2b4a840(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000d0f7e0 CR3: 000000003b8fb000 CR4: 00000000000006f0
Stack:
ffff88003a1cc200 00000000ffffffe0 00000000000000c0 ffffffff818cab1d
ffff88003ae8bd68 ffffffff81628db4 ffff88003ae8bd48 ffff88003b7f5550
ffff880031a09408 ffff88003b7f5550 ffff88000012aa48 ffff88000012ab00
Call Trace:
[<ffffffff81628db4>] unix_stream_sendmsg+0x2c4/0x470
[<ffffffff81556f56>] sock_write_iter+0x146/0x160
[<ffffffff811d9612>] new_sync_write+0x92/0xd0
[<ffffffff811d9cd6>] vfs_write+0xd6/0x180
[<ffffffff811da499>] SyS_write+0x59/0xd0
[<ffffffff81651532>] system_call_fastpath+0x12/0x17
Code: 00 00 48 89 44 24 10 8b 87 c8 00 00 00 48 89 44 24 08 48 8b 87 d8 00
00 00 48 c7 c7 30 db 91 81 48 89 04 24 31 c0 e8 4f a8 0e 00 <0f> 0b
eb fe 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 48 83
RIP [<ffffffff8155fbd1>] skb_put+0xa1/0xb0
RSP <ffff88003ae8bc68>
Kernel panic - not syncing: Fatal exceptionMoreover, the possible minimum is 1, so we can get another kernel panic:
...
BUG: unable to handle kernel paging request at ffff88013caee5c0 IP: [<ffffffff815604cf>] __alloc_skb+0x12f/0x1f0
...
--- net/core/sysctl_net_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/core/sysctl_net_core.c +6 -6
@@ -21,8 +21,8 @@static int zero =0 ;static int ushort_max =USHRT_MAX ; - -static int one =1 ; +static int min_sndbuf =SOCK_MIN_SNDBUF ; +static int min_rcvbuf =SOCK_MIN_RCVBUF ;#ifdef CONFIG_RPS static int rps_sock_flow_sysctl(ctl_table *table, int write,
@@ -92,7 +92,7 @@ static struct ctl_table net_core_table[] .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &one, + .extra1 = &min_sndbuf, }, { .procname = "rmem_max",
@@ -100,7 +100,7 @@ static struct ctl_table net_core_table[] .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &one, + .extra1 = &min_rcvbuf, }, { .procname = "wmem_default",
@@ -108,7 +108,7 @@ static struct ctl_table net_core_table[] .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &one, + .extra1 = &min_sndbuf, }, { .procname = "rmem_default",
@@ -116,7 +116,7 @@ static struct ctl_table net_core_table[] .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec_minmax, - .extra1 = &one, + .extra1 = &min_rcvbuf, }, { .procname = "dev_weight",
PATCH 203/221 rds: avoid potential stack overflow
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit f862e07cf95d5b62a5fc5e981dd7d0dbaf33a501 ]
The rds_iw_update_cm_id function stores a large 'struct rds_sock' object on the stack in order to pass a pair of addresses. This happens to just fit withint the 1024 byte stack size warning limit on x86, but just exceed that limit on ARM, which gives us this warning:
net/rds/iw_rdma.c:200:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=]
As the use of this large variable is basically bogus, we can rearrange the code to not do that. Instead of passing an rds socket into rds_iw_get_device, we now just pass the two addresses that we have available in rds_iw_update_cm_id, and we change rds_iw_get_mr accordingly, to create two address structures on the stack there.
--- net/rds/iw_rdma.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-)
net/rds/iw_rdma.c +22 -18
@@ -88,7 +88,9 @@ static unsigned int rds_iw_unmap_fastreg int *unpinned);static void rds_iw_destroy_fastreg (struct rds_iw_mr_pool *pool,struct rds_iw_mr *ibmr); -static int rds_iw_get_device (struct rds_sock *rs,struct rds_iw_device **rds_iwdev,struct rdma_cm_id **cm_id) +static int rds_iw_get_device (struct sockaddr_in *src,struct sockaddr_in *dst, +struct rds_iw_device **rds_iwdev, +struct rdma_cm_id **cm_id) {struct rds_iw_device *iwdev;struct rds_iw_cm_id *i_cm_id;
@@ -112,15 +114,15 @@ static int rds_iw_get_device(struct rds_ src_addr->sin_port, dst_addr->sin_addr.s_addr, dst_addr->sin_port, - rs->rs_bound_addr, - rs->rs_bound_port, - rs->rs_conn_addr, - rs->rs_conn_port); + src->sin_addr.s_addr, + src->sin_port, + dst->sin_addr.s_addr, + dst->sin_port);#ifdef WORKING_TUPLE_DETECTION -if (src_addr->sin_addr.s_addr == rs->rs_bound_addr && - src_addr->sin_port == rs->rs_bound_port && - dst_addr->sin_addr.s_addr == rs->rs_conn_addr && - dst_addr->sin_port == rs->rs_conn_port) { +if (src_addr->sin_addr.s_addr == src->sin_addr.s_addr && + src_addr->sin_port == src->sin_port && + dst_addr->sin_addr.s_addr == dst->sin_addr.s_addr && + dst_addr->sin_port == dst->sin_port) {#else /* FIXME - needs to compare the local and remote * ipaddr/port tuple, but the ipaddr is the only
@@ -128,7 +130,7 @@ static int rds_iw_get_device(struct rds_* zero'ed. It doesn't appear to be properly populated * during connection setup... */ -if (src_addr->sin_addr.s_addr == rs->rs_bound_addr) { +if (src_addr->sin_addr.s_addr == src->sin_addr.s_addr) {#endif spin_unlock_irq (&iwdev->spinlock); *rds_iwdev = iwdev;
@@ -180,19 +182,13 @@ int rds_iw_update_cm_id(struct rds_iw_de {struct sockaddr_in *src_addr, *dst_addr;struct rds_iw_device *rds_iwdev_old; -struct rds_sock rs;struct rdma_cm_id *pcm_id;int rc; src_addr = (struct sockaddr_in *)&cm_id->route.addr.src_addr; dst_addr = (struct sockaddr_in *)&cm_id->route.addr.dst_addr; - rs.rs_bound_addr = src_addr->sin_addr.s_addr; - rs.rs_bound_port = src_addr->sin_port; - rs.rs_conn_addr = dst_addr->sin_addr.s_addr; - rs.rs_conn_port = dst_addr->sin_port; - - rc =rds_iw_get_device (&rs, &rds_iwdev_old, &pcm_id); + rc =rds_iw_get_device (src_addr, dst_addr, &rds_iwdev_old, &pcm_id);if (rc)rds_iw_remove_cm_id (rds_iwdev, cm_id);
@@ -611,9 +607,17 @@ void *rds_iw_get_mr(struct scatterlist *struct rds_iw_device *rds_iwdev;struct rds_iw_mr *ibmr =NULL ;struct rdma_cm_id *cm_id; +struct sockaddr_in src = { + .sin_addr.s_addr = rs->rs_bound_addr, + .sin_port = rs->rs_bound_port, + }; +struct sockaddr_in dst = { + .sin_addr.s_addr = rs->rs_conn_addr, + .sin_port = rs->rs_conn_port, + };int ret; - ret =rds_iw_get_device (rs, &rds_iwdev, &cm_id); + ret =rds_iw_get_device (&src, &dst, &rds_iwdev, &cm_id);if (ret || !cm_id) { ret = -ENODEV ; goto out;
PATCH 204/221 caif: fix MSG_OOB test in caif_seqpkt_recvmsg()
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 3eeff778e00c956875c70b145c52638c313dfb23 ]
It should be checking flags, not msg->msg_flags. It's ->sendmsg() instances that need to look for that in ->msg_flags, ->recvmsg() ones (including the other ->recvmsg() instance in that file, as well as unix_dgram_recvmsg() this one claims to be imitating) check in flags. Braino had been introduced in commit dcda13 ("caif: Bugfix - use MSG_TRUNC in receive") back in 2010, so it goes quite a while back.
--- net/caif/caif_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/caif/caif_socket.c +1 -1
@@ -317,7 +317,7 @@ static int caif_seqpkt_recvmsg(struct kiint copylen; ret = -EOPNOTSUPP ; -if (m->msg_flags&MSG_OOB ) +if (flags &MSG_OOB ) goto read_error; skb =skb_recv_datagram (sk, flags,0 , &ret);
PATCH 205/221 rxrpc: bogus MSG_PEEK test in rxrpc_recvmsg()
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 7d985ed1dca5c90535d67ce92ef6ca520302340a ]
[I would really like an ACK on that one from dhowells; it appears to be quite straightforward, but...]
MSG_PEEK isn't passed to ->recvmsg() via msg->msg_flags; as the matter of fact, neither the kernel users of rxrpc, nor the syscalls ever set that bit in there. It gets passed via flags; in fact, another such check in the same function is done correctly - as flags & MSG_PEEK.
It had been that way (effectively disabled) for 8 years, though, so the patch needs beating up - that case had never been tested. If it is correct, it's -stable fodder.
--- net/rxrpc/ar-recvmsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/ar-recvmsg.c +1 -1
@@ -87,7 +87,7 @@ int rxrpc_recvmsg(struct kiocb *iocb, stif (!skb) {/* nothing remains on the queue */ if (copied && - (msg->msg_flags &MSG_PEEK || timeo ==0 )) + (flags &MSG_PEEK || timeo ==0 )) goto out;/* wait for a message to turn up */
PATCH 206/221 tcp: make connect() mem charging friendly
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 355a901e6cf1b2b763ec85caa2a9f04fbcc4ab4a ]
While working on sk_forward_alloc problems reported by Denys Fedoryshchenko, we found that tcp connect() (and fastopen) do not call sk_wmem_schedule() for SYN packet (and/or SYN/DATA packet), so sk_forward_alloc is negative while connect is in progress.
We can fix this by calling regular sk_stream_alloc_skb() both for the SYN packet (in tcp_connect()) and the syn_data packet in tcp_send_syn_data()
Then, tcp_send_syn_data() can avoid copying syn_data as we simply can manipulate syn_data->cb[] to remove SYN flag (and increment seq)
Instead of open coding memcpy_fromiovecend(), simply use this helper.
This leaves in socket write queue clean fast clone skbs.
This was tested against our fastopen packetdrill tests.
[bwh: Backported to 3.2:
- Drop the Fast Open changes
- Adjust context]
--- net/ipv4/tcp_output.c | 62 ++++++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 35 deletions(-)
net/ipv4/tcp_output.c +2 -5
@@ -2628,13 +2628,10 @@ int tcp_connect(struct sock *sk)tcp_connect_init (sk); - buff =alloc_skb_fclone (MAX_TCP_HEADER +15 , sk->sk_allocation); -if (unlikely (buff ==NULL )) + buff =sk_stream_alloc_skb (sk,0 , sk->sk_allocation); +if (unlikely (!buff))return -ENOBUFS ; -/* Reserve space for headers. */ -skb_reserve (buff,MAX_TCP_HEADER ); - tp->snd_nxt = tp->write_seq;tcp_init_nondata_skb (buff, tp->write_seq++,TCPHDR_SYN );TCP_ECN_send_syn (sk, buff);
PATCH 207/221 8139cp: Call dev_kfree_skby_any instead of kfree_skb.
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 508f81d517ed1f3f0197df63ea7ab5cd91b6f3b3 upstream.
Replace kfree_skb with dev_kfree_skb_any in cp_start_xmit as it can be called in both hard irq and other contexts.
--- drivers/net/ethernet/realtek/8139cp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/realtek/8139cp.c +1 -1
@@ -886,7 +886,7 @@ out_unlock:return NETDEV_TX_OK ; out_dma_error: -kfree_skb (skb); +dev_kfree_skb_any (skb); cp->dev->stats.tx_dropped++; goto out_unlock; }
PATCH 208/221 8139too: Call dev_kfree_skby_any instead of dev_kfree_skb.
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit a2ccd2e4bd70122523a7bf21cec4dd6e34427089 upstream.
Replace dev_kfree_skb with dev_kfree_skb_any in functions that can be called in hard irq and other contexts.
--- drivers/net/ethernet/realtek/8139too.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/realtek/8139too.c +2 -2
@@ -1703,9 +1703,9 @@ static netdev_tx_t rtl8139_start_xmit (sif (len <ETH_ZLEN )memset (tp->tx_buf[entry],0 ,ETH_ZLEN );skb_copy_and_csum_dev (skb, tp->tx_buf[entry]); -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); }else { -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); dev->stats.tx_dropped++;return NETDEV_TX_OK ; }
PATCH 209/221 r8169: Call dev_kfree_skby_any instead of dev_kfree_skb.
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 989c9ba104d9ce53c1ca918262f3fdfb33aca12a upstream.
Replace dev_kfree_skb with dev_kfree_skb_any in functions that can be called in hard irq and other contexts.
--- drivers/net/ethernet/realtek/r8169.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/realtek/r8169.c +3 -3
@@ -5372,7 +5372,7 @@ static void rtl8169_tx_clear_range(struc tp->TxDescArray + entry);if (skb) { tp->dev->stats.tx_dropped++; -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); tx_skb->skb =NULL ; } }
@@ -5651,7 +5651,7 @@ static netdev_tx_t rtl8169_start_xmit(st err_dma_1:rtl8169_unmap_tx_skb (d, tp->tx_skb + entry, txd); err_dma_0: -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); err_update_stats: dev->stats.tx_dropped++;return NETDEV_TX_OK ;
@@ -5734,7 +5734,7 @@ static void rtl8169_tx_interrupt(structif (status & LastFrag) { dev->stats.tx_packets++; dev->stats.tx_bytes += tx_skb->skb->len; -dev_kfree_skb (tx_skb->skb); +dev_kfree_skb_any (tx_skb->skb); tx_skb->skb =NULL ; } dirty_tx++;
PATCH 210/221 tg3: Call dev_kfree_skby_any instead of dev_kfree_skb.
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 497a27b9e1bcf6dbaea7a466cfcd866927e1b431 upstream.
Replace dev_kfree_skb with dev_kfree_skb_any in functions that can be called in hard irq and other contexts.
--- drivers/net/ethernet/broadcom/tg3.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +7 -7
@@ -5412,7 +5412,7 @@ static void tg3_tx(struct tg3_napi *tnap sw_idx =NEXT_TX (sw_idx); } -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);if (unlikely (tx_bug)) {tg3_tx_recover (tp);
@@ -5702,7 +5702,7 @@ static int tg3_rx(struct tg3_napi *tnapiif (len > (tp->dev->mtu +ETH_HLEN ) && skb->protocol !=htons (ETH_P_8021Q )) { -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); goto drop_it_no_recycle; }
@@ -6609,7 +6609,7 @@ static int tigon3_dma_hwbug_workaround(s PCI_DMA_TODEVICE);/* Make sure the mapping succeeded */ if (pci_dma_mapping_error (tp->pdev, new_addr)) { -dev_kfree_skb (new_skb); +dev_kfree_skb_any (new_skb); ret =-1 ; }else {u32 save_entry = *entry;
@@ -6624,13 +6624,13 @@ static int tigon3_dma_hwbug_workaround(s new_skb->len, base_flags, mss, vlan)) {tg3_tx_skb_unmap (tnapi, save_entry,-1 ); -dev_kfree_skb (new_skb); +dev_kfree_skb_any (new_skb); ret =-1 ; } } } -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); *pskb = new_skb;return ret; }
@@ -6673,7 +6673,7 @@ static int tg3_tso_bug(struct tg3 *tp, s }while (segs); tg3_tso_bug_end: -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
@@ -6888,7 +6888,7 @@ dma_error:tg3_tx_skb_unmap (tnapi, tnapi->tx_prod, --i); tnapi->tx_buffers[tnapi->tx_prod].skb =NULL ; drop: -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); drop_nofree: tp->tx_dropped++;return NETDEV_TX_OK ;
PATCH 211/221 ixgb: Call dev_kfree_skby_any instead of dev_kfree_skb.
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit f7e79913a1d6a6139211ead3b03579b317d25a1f upstream.
Replace dev_kfree_skb with dev_kfree_skb_any in functions that can be called in hard irq and other contexts.
--- drivers/net/ethernet/intel/ixgb/ixgb_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ixgb/ixgb_main.c +3 -3
@@ -1539,12 +1539,12 @@ ixgb_xmit_frame(struct sk_buff *skb, strint tso;if (test_bit (__IXGB_DOWN, &adapter->flags)) { -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }if (skb->len <=0 ) { -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
@@ -1561,7 +1561,7 @@ ixgb_xmit_frame(struct sk_buff *skb, str tso =ixgb_tso (adapter, skb);if (tso <0 ) { -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
PATCH 212/221 benet: Call dev_kfree_skby_any instead of kfree_skb.
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit d8ec2c02caa3515f35d6c33eedf529394c419298 upstream.
Replace free_skb with dev_kfree_skb_any in be_tx_compl_process as which can be called in hard irq by netpoll, softirq context by normal napi polling, and in normal sleepable context by the network device close method.
--- drivers/net/ethernet/emulex/benet/be_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/emulex/benet/be_main.c +1 -1
@@ -1434,7 +1434,7 @@ static u16 be_tx_compl_process(struct bequeue_tail_inc (txq); }while (cur_index != last_index); -kfree_skb (sent_skb); +dev_kfree_skb_any (sent_skb);return num_wrbs; }
PATCH 213/221 gianfar: Carefully free skbs in functions called by netpoll.
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit c9974ad4aeb36003860100221a594f3c0ccc3f78 upstream.
netpoll can call functions in hard irq context that are ordinarily called in lesser contexts. For those functions use dev_kfree_skb_any and dev_consume_skb_any so skbs are freed safely from hard irq context.
--- drivers/net/ethernet/freescale/gianfar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/freescale/gianfar.c +2 -2
@@ -2092,10 +2092,10 @@ static int gfar_start_xmit(struct sk_buf skb_new =skb_realloc_headroom (skb,GMAC_FCB_LEN );if (!skb_new) { dev->stats.tx_errors++; -kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; } -kfree_skb (skb); +dev_kfree_skb_any (skb); skb = skb_new; }
PATCH 214/221 ip_forward: Drop frames with attached skb->sk
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Pöhn <[email protected]>
[ Upstream commit 2ab957492d13bb819400ac29ae55911d50a82a13 ]
Initial discussion was:
[FYI] xfrm: Don't lookup sk_policy for timewait sockets
Forwarded frames should not have a socket attached. Especially tw sockets will lead to panics later-on in the stack.
This was observed with TPROXY assigning a tw socket and broken policy routing (misconfigured). As a result frame enters forwarding path instead of input. We cannot solve this in TPROXY as it cannot know that policy routing is broken.
v2:
Remove useless comment
--- net/ipv4/ip_forward.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv4/ip_forward.c +3 -0
@@ -57,6 +57,9 @@ int ip_forward(struct sk_buff *skb)struct rtable *rt;/* Route we use */ struct ip_options * opt = &(IPCB (skb)->opt); +if (unlikely (skb->sk)) + goto drop; +if (skb_warn_if_lro (skb)) goto drop;
PATCH 215/221 tcp: avoid looping in tcp_send_fin()
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 845704a535e9b3c76448f52af1b70e4422ea03fd ]
Presence of an unbound loop in tcp_send_fin() had always been hard to explain when analyzing crash dumps involving gigantic dying processes with millions of sockets.
Lets try a different strategy :
In case of memory pressure, try to add the FIN flag to last packet in write queue, even if packet was already sent. TCP stack will be able to deliver this FIN after a timeout event. Note that this FIN being delivered by a retransmit, it also carries a Push flag given our current implementation.
By checking sk_under_memory_pressure(), we anticipate that cooking many FIN packets might deplete tcp memory.
In the case we could not allocate a packet, even with __GFP_WAIT allocation, then not sending a FIN seems quite reasonable if it allows to get rid of this socket, free memory, and not block the process from eventually doing other useful work.
[bwh: Backported to 3.2:
- Drop inapplicable change to sk_forced_wmem_schedule()
- s/sk_under_memory_pressure(sk)/tcp_memory_pressure/]
--- net/ipv4/tcp_output.c | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-)
net/ipv4/tcp_output.c +27 -20
@@ -2320,33 +2320,40 @@ begin_fwd: } } -/* Send a fin. The caller locks the socket for us. This cannot be -* allowed to fail queueing a FIN frame under any circumstances. +/* Send a FIN. The caller locks the socket for us. +* We should try to send a FIN packet really hard, but eventually give up. */ void tcp_send_fin (struct sock *sk) { +struct sk_buff *skb, *tskb =tcp_write_queue_tail (sk);struct tcp_sock *tp =tcp_sk (sk); -struct sk_buff *skb =tcp_write_queue_tail (sk); -int mss_now; -/* Optimization, tack on the FIN if we have a queue of -* unsent frames. But be careful about outgoing SACKS -* and IP options. +/* Optimization, tack on the FIN if we have one skb in write queue and +* this skb was not yet sent, or we are under memory pressure. +* Note: in the latter case, FIN packet will be sent after a timeout, +* as TCP stack thinks it has already been transmitted. */ - mss_now =tcp_current_mss (sk); - -if (tcp_send_head (sk) !=NULL ) { -TCP_SKB_CB (skb)->tcp_flags |=TCPHDR_FIN ; -TCP_SKB_CB (skb)->end_seq++; +if (tskb && (tcp_send_head (sk) || tcp_memory_pressure)) { +coalesce: +TCP_SKB_CB (tskb)->tcp_flags |=TCPHDR_FIN ; +TCP_SKB_CB (tskb)->end_seq++; tp->write_seq++; +if (!tcp_send_head (sk)) { +/* This means tskb was already sent. +* Pretend we included the FIN on previous transmit. +* We need to set tp->snd_nxt to the value it would have +* if FIN had been sent. This is because retransmit path +* does not change tp->snd_nxt. +*/ + tp->snd_nxt++; +return ; + } }else { -/* Socket is locked, keep trying until memory is available. */ -for (;;) { - skb =alloc_skb_fclone (MAX_TCP_HEADER , - sk->sk_allocation); -if (skb) -break ; -yield (); + skb =alloc_skb_fclone (MAX_TCP_HEADER , sk->sk_allocation); +if (unlikely (!skb)) { +if (tskb) + goto coalesce; +return ; }/* Reserve space for headers and prepare control bits. */
@@ -2356,7 +2363,7 @@ void tcp_send_fin(struct sock *sk) TCPHDR_ACK | TCPHDR_FIN);tcp_queue_skb (sk, skb); } -__tcp_push_pending_frames (sk, mss_now,TCP_NAGLE_OFF ); +__tcp_push_pending_frames (sk,tcp_current_mss (sk),TCP_NAGLE_OFF ); }/* We get here when a process closes a file descriptor (either due to
PATCH 216/221 net: make skb_gso_segment error handling more robust
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
commit 330966e501ffe282d7184fde4518d5e0c24bc7f8 upstream.
skb_gso_segment has three possible return values:
1. a pointer to the first segmented skb
2. an errno value (IS_ERR())
3. NULL. This can happen when GSO is used for header verification.
However, several callers currently test IS_ERR instead of IS_ERR_OR_NULL and would oops when NULL is returned.
Note that these call sites should never actually see such a NULL return value; all callers mask out the GSO bits in the feature argument.
However, there have been issues with some protocol handlers erronously not respecting the specified feature mask in some cases.
It is preferable to get 'have to turn off hw offloading, else slow' reports rather than 'kernel crashes'.
---
net/netfilter/nf_queue.c +1 -1
@@ -233,7 +233,7 @@ int nf_queue(struct sk_buff *skb,* returned by nf_queue. For instance, callers rely on -ECANCELED to mean * 'ignore this hook'. */ -if (IS_ERR (segs)) +if (IS_ERR_OR_NULL (segs))return -EINVAL ; queued =0 ;
net/xfrm/xfrm_output.c +2 -0
@@ -151,6 +151,8 @@ static int xfrm_output_gso(struct sk_buff *skb)kfree_skb (skb);if (IS_ERR (segs))return PTR_ERR (segs); +if (segs ==NULL ) +return -EINVAL ; do { struct sk_buff *nskb = segs->next;
PATCH 217/221 spi: spidev: fix possible arithmetic overflow for multi-transfer message
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit f20fbaad7620af2df36a1f9d1c9ecf48ead5b747 upstream.
spidev_message() sums the lengths of the individual SPI transfers to determine the overall SPI message length. It restricts the total length, returning an error if too long, but it does not check for arithmetic overflow. For example, if the SPI message consisted of two transfers and the first has a length of 10 and the second has a length of (__u32)(-1), the total length would be seen as 9, even though the second transfer is actually very long. If the second transfer specifies a null rx_buf and a non-null tx_buf, the copy_from_user() could overrun the spidev's pre-allocated tx buffer before it reaches an invalid user memory address. Fix it by checking that neither the total nor the individual transfer lengths exceed the maximum allowed value.
Thanks to Dan Carpenter for reporting the potential integer overflow.
[Ian Abbott: Note: original commit compares the lengths to INT_MAX
instead of bufsiz due to changes in earlier commits.]
--- drivers/spi/spidev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/spidev.c +4 -1
@@ -241,7 +241,10 @@ static int spidev_message(struct spidev_ k_tmp->len = u_tmp->len; total += k_tmp->len; -if (total > bufsiz) { +/* Check total length of transfers. Also check each +* transfer length to avoid arithmetic overflow. +*/ +if (total > bufsiz || k_tmp->len > bufsiz) { status = -EMSGSIZE ; goto done; }
PATCH 218/221 IB/core: Avoid leakage from kernel to user space
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eli Cohen <[email protected]>
commit 377b513485fd885dea1083a9a5430df65b35e048 upstream.
Clear the reserved field of struct ib_uverbs_async_event_desc which is copied to user space.
--- drivers/infiniband/core/uverbs_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/core/uverbs_main.c +1 -0
@@ -451,6 +451,7 @@ static void ib_uverbs_async_handler(stru entry->desc.async.element = element; entry->desc.async.event_type = event; + entry->desc.async.reserved =0 ; entry->counter = counter;list_add_tail (&entry->list, &file->async_file->event_list);
PATCH 219/221 ipvs: rerouting to local clients is not needed anymore
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Julian Anastasov <[email protected]>
commit 579eb62ac35845686a7c4286c0a820b4eb1f96aa upstream.
commit f5a41847acc5 ("ipvs: move ip_route_me_harder for ICMP") from 2.6.37 introduced ip_route_me_harder() call for responses to local clients, so that we can provide valid rt_src after SNAT. It was used by TCP to provide valid daddr for ip_send_reply(). After commit 0a5ebb8000c5 ("ipv4: Pass explicit daddr arg to ip_send_reply()." from 3.0 this rerouting is not needed anymore and should be avoided, especially in LOCAL_IN.
Fixes 3.12.33 crash in xfrm reported by Florian Wiessner:
"3.12.33 - BUG xfrm_selector_match+0x25/0x2f6"
--- net/netfilter/ipvs/ip_vs_core.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
net/netfilter/ipvs/ip_vs_core.c +21 -11
@@ -662,16 +662,24 @@ static inline int ip_vs_gather_frags_v6(struct sk_buff *skb, u_int32_t user) }#endif -static int ip_vs_route_me_harder (int af,struct sk_buff *skb) +static int ip_vs_route_me_harder (int af,struct sk_buff *skb, +unsigned int hooknum) { +if (!sysctl_snat_reroute (skb)) +return 0 ; +/* Reroute replies only to remote clients (FORWARD and LOCAL_OUT) */ +if (NF_INET_LOCAL_IN == hooknum) +return 0 ;#ifdef CONFIG_IP_VS_IPV6 if (af ==AF_INET6 ) { -if (sysctl_snat_reroute (skb) &&ip6_route_me_harder (skb) !=0 ) +struct dst_entry *dst =skb_dst (skb); + +if (dst->dev && !(dst->dev->flags &IFF_LOOPBACK ) && +ip6_route_me_harder (skb) !=0 )return 1 ; } else#endif -if ((sysctl_snat_reroute (skb) || -skb_rtable (skb)->rt_flags &RTCF_LOCAL ) && +if (!(skb_rtable (skb)->rt_flags &RTCF_LOCAL ) &&ip_route_me_harder (skb,RTN_LOCAL ) !=0 )return 1 ;
@@ -782,7 +790,8 @@ static int handle_response_icmp(int af, struct sk_buff *skb,union nf_inet_addr *snet, __u8 protocol, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, - unsigned int offset, unsigned int ihl) + unsigned int offset, unsigned int ihl, + unsigned int hooknum) { unsigned int verdict = NF_DROP;
@@ -812,7 +821,7 @@ static int handle_response_icmp(int af, struct sk_buff *skb,#endif ip_vs_nat_icmp (skb, pp, cp,1 ); -if (ip_vs_route_me_harder (af, skb)) +if (ip_vs_route_me_harder (af, skb, hooknum)) goto out;/* do the statistics and put it back */
@@ -908,7 +917,7 @@ static int ip_vs_out_icmp(struct sk_buff *skb, int *related, snet.ip = iph->saddr;return handle_response_icmp (AF_INET , skb, &snet, cih->protocol, cp, - pp, offset, ihl); + pp, offset, ihl, hooknum); }#ifdef CONFIG_IP_VS_IPV6
@@ -985,7 +994,8 @@ static int ip_vs_out_icmp_v6(struct sk_buff *skb, int *related,ipv6_addr_copy (&snet.in6, &iph->saddr);return handle_response_icmp (AF_INET6 , skb, &snet, cih->nexthdr, cp, - pp, offset, sizeof(struct ipv6hdr)); + pp, offset,sizeof (struct ipv6hdr ), + hooknum); }#endif
@@ -1018,7 +1028,7 @@ static inline int is_tcp_reset(const struct sk_buff *skb, int nh_len)*/ static unsigned int handle_response (int af,struct sk_buff *skb,struct ip_vs_proto_data *pd, -struct ip_vs_conn *cp,int ihl) +struct ip_vs_conn *cp,int ihl,unsigned int hooknum) {struct ip_vs_protocol *pp = pd->pp;
@@ -1056,7 +1066,7 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,* if it came from this machine itself. So re-compute * the routing information. */ -if (ip_vs_route_me_harder (af, skb)) +if (ip_vs_route_me_harder (af, skb, hooknum)) goto drop;IP_VS_DBG_PKT (10 , af, pp, skb,0 ,"After SNAT" );
@@ -1169,7 +1179,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af) cp = pp->conn_out_get (af, skb, &iph, iph.len,0 );if (likely (cp)) -return handle_response (af, skb, pd, cp, iph.len); +return handle_response (af, skb, pd, cp, iph.len, hooknum); if (sysctl_nat_icmp_send(net) && (pp->protocol == IPPROTO_TCP || pp->protocol == IPPROTO_UDP ||
PATCH 220/221 ipvs: uninitialized data with IP_VS_IPV6
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 3b05ac3824ed9648c0d9c02d51d9b54e4e7e874f upstream.
The app_tcp_pkt_out() function expects "*diff" to be set and ends up using uninitialized data if CONFIG_IP_VS_IPV6 is turned on.
The same issue is there in app_tcp_pkt_in(). Thanks to Julian Anastasov for noticing that.
--- net/netfilter/ipvs/ip_vs_ftp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/netfilter/ipvs/ip_vs_ftp.c +5 -5
@@ -183,6 +183,8 @@ static int ip_vs_ftp_out(struct ip_vs_apstruct nf_conn *ct;struct net *net; + *diff =0 ; +#ifdef CONFIG_IP_VS_IPV6 /* This application helper doesn't work with IPv6 yet, * so turn this into a no-op for IPv6 packets
@@ -191,8 +193,6 @@ static int ip_vs_ftp_out(struct ip_vs_apreturn 1 ;#endif - *diff =0 ; -/* Only useful for established sessions */ if (cp->state !=IP_VS_TCP_S_ESTABLISHED )return 1 ;
@@ -318,6 +318,9 @@ static int ip_vs_ftp_in(struct ip_vs_appstruct ip_vs_conn *n_cp;struct net *net; +/* no diff required for incoming packets */ + *diff =0 ; +#ifdef CONFIG_IP_VS_IPV6 /* This application helper doesn't work with IPv6 yet, * so turn this into a no-op for IPv6 packets
@@ -326,9 +329,6 @@ static int ip_vs_ftp_in(struct ip_vs_appreturn 1 ;#endif -/* no diff required for incoming packets */ - *diff =0 ; -/* Only useful for established sessions */ if (cp->state !=IP_VS_TCP_S_ESTABLISHED )return 1 ;
PATCH 221/221 Revert "KVM: s390: flush CPU on load control"
In reply to Ben Hutchings3.2.69-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
This reverts commit 823f14022fd2335affc8889a9c7e1b60258883a3, which was commit 2dca485f8740208604543c3960be31a5dd3ea603 upstream. It depends on functionality that is not present in 3.2.y.
--- arch/s390/kvm/intercept.c | 2 -- 1 file changed, 2 deletions(-)
arch/s390/kvm/intercept.c +0 -2
@@ -58,7 +58,6 @@ static int handle_lctlg(struct kvm_vcpu *vcpu)break ; reg = (reg +1 ) %16 ; }while (1 ); -kvm_make_request (KVM_REQ_TLB_FLUSH , vcpu);return 0 ; }
@@ -98,7 +97,6 @@ static int handle_lctl(struct kvm_vcpu *vcpu)break ; reg = (reg +1 ) %16 ; }while (1 ); -kvm_make_request (KVM_REQ_TLB_FLUSH , vcpu);return 0 ; }
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.2.69 release. There are 221 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri May 08 23:00:00 UTC 2015. Anything received after that time might be too late.
Build results:
total: 101 pass: 97 fail: 4
Failed builds:
arm:allmodconfig
mips:allmodconfig
xtensa:defconfig
xtensa:allmodconfig
Qemu test results:
total: 20 pass: 20 fail: 0
Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Quoted 18 lines · Guenter Roeck
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.2.69 release. There are 221 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri May 08 23:00:00 UTC 2015. Anything received after that time might be too late.
Build results:
total: 101 pass: 97 fail: 4Failed builds:
arm:allmodconfig
mips:allmodconfig
xtensa:defconfig
xtensa:allmodconfig
Quoted 5 lines
Qemu test results:
total: 20 pass: 20 fail: 0Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
Thanks for testing.
Ben.
Signature · 2 lines
Ben Hutchings Once a job is fouled up, anything done to improve it makes it worse.
This is the combined diff for 3.2.69-rc1 relative to 3.2.68.
Ben.
Signature · 2 lines
Ben Hutchings Once a job is fouled up, anything done to improve it makes it worse.
Documentation/usb/usb-serial.txt +1 -1
@@ -145,7 +145,7 @@ Keyspan PDA Serial Adapter Single port DB-9 serial adapter, pushed as a PDA adapter for iMacs (mostly sold in Macintosh catalogs, comes in a translucent white/green dongle). Fairly simple device. Firmware is homebrew. - This driver also works for the Xircom/Entrgra single port serial adapter. + This driver also works for the Xircom/Entrega single port serial adapter. Current status: Things that work:
Makefile +2 -2
@@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 2 -SUBLEVEL = 68 -EXTRAVERSION = +SUBLEVEL = 69 +EXTRAVERSION = -rc1 NAME = Saber-toothed Squirrel # *DOCUMENTATION*
arch/arm/mach-pxa/corgi.c +3 -0
@@ -26,6 +26,7 @@#include <linux/i2c.h> #include <linux/i2c/pxa-i2c.h> #include <linux/io.h> +#include <linux/regulator/machine.h> #include <linux/spi/spi.h> #include <linux/spi/ads7846.h> #include <linux/spi/corgi_lcd.h>
@@ -704,6 +705,8 @@ static void __init corgi_init(void) sharpsl_nand_partitions[1 ].size =53 *1024 *1024 ;platform_add_devices (devices,ARRAY_SIZE (devices)); + +regulator_has_full_constraints (); } static void __init fixup_corgi(struct tag *tags, char **cmdline,
arch/arm/mach-pxa/hx4700.c +2 -0
@@ -835,6 +835,8 @@ static void __init hx4700_init(void)mdelay (10 );gpio_set_value (GPIO71_HX4700_ASIC3_nRESET,1 );mdelay (10 ); + +regulator_has_full_constraints (); }MACHINE_START (H4700 ,"HP iPAQ HX4700" )
arch/arm/mach-pxa/poodle.c +2 -0
@@ -25,6 +25,7 @@#include <linux/gpio.h> #include <linux/i2c.h> #include <linux/i2c/pxa-i2c.h> +#include <linux/regulator/machine.h> #include <linux/spi/spi.h> #include <linux/spi/ads7846.h> #include <linux/spi/pxa2xx_spi.h>
@@ -453,6 +454,7 @@ static void __init poodle_init(void)pxa_set_i2c_info (NULL );i2c_register_board_info (0 ,ARRAY_AND_SIZE (poodle_i2c_devices));poodle_init_spi (); +regulator_has_full_constraints (); } static void __init fixup_poodle(struct tag *tags, char **cmdline,
arch/arm/mach-pxa/spitz.c +2 -0
@@ -969,6 +969,8 @@ static void __init spitz_init(void)spitz_nor_init ();spitz_nand_init ();spitz_i2c_init (); + +regulator_has_full_constraints (); } static void __init spitz_fixup(struct tag *tags, char **cmdline,
arch/arm/mach-sa1100/pm.c +1 -0
@@ -81,6 +81,7 @@ static int sa11x0_pm_enter(suspend_state_t state)/* * Ensure not to come back here if it wasn't intended */ +RCSR =RCSR_SMR ;PSPR =0 ;/*
arch/powerpc/sysdev/axonram.c +1 -1
@@ -156,7 +156,7 @@ axon_ram_direct_access(struct block_device *device, sector_t sector, } *kaddr = (void *)(bank->ph_addr + offset); - *pfn =virt_to_phys (kaddr) >>PAGE_SHIFT ; + *pfn =virt_to_phys (*kaddr) >>PAGE_SHIFT ;return 0 ; }
arch/s390/kvm/intercept.c +0 -2
@@ -58,7 +58,6 @@ static int handle_lctlg(struct kvm_vcpu *vcpu)break ; reg = (reg +1 ) %16 ; }while (1 ); -kvm_make_request (KVM_REQ_TLB_FLUSH , vcpu);return 0 ; }
@@ -98,7 +97,6 @@ static int handle_lctl(struct kvm_vcpu *vcpu)break ; reg = (reg +1 ) %16 ; }while (1 ); -kvm_make_request (KVM_REQ_TLB_FLUSH , vcpu);return 0 ; }
arch/s390/kvm/kvm-s390.c +1 -1
@@ -311,7 +311,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) vcpu->arch.sie_block->ecb =6 ; vcpu->arch.sie_block->eca =0xC1002001U ; vcpu->arch.sie_block->fac = (int ) (long ) facilities; -hrtimer_init (&vcpu->arch.ckc_timer,CLOCK_REALTIME ,HRTIMER_MODE_ABS ); +hrtimer_init (&vcpu->arch.ckc_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL );tasklet_init (&vcpu->arch.tasklet, kvm_s390_tasklet, (unsigned long ) vcpu); vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup;
arch/x86/crypto/aesni-intel_glue.c +2 -2
@@ -1202,7 +1202,7 @@ static int __driver_rfc4106_decrypt(struct aead_request *req) src =kmalloc (req->cryptlen + req->assoclen,GFP_ATOMIC );if (!src)return -ENOMEM ; - assoc = (src + req->cryptlen + auth_tag_len); + assoc = (src + req->cryptlen);scatterwalk_map_and_copy (src, req->src,0 , req->cryptlen,0 );scatterwalk_map_and_copy (assoc, req->assoc,0 , req->assoclen,0 );
@@ -1227,7 +1227,7 @@ static int __driver_rfc4106_decrypt(struct aead_request *req)scatterwalk_done (&src_sg_walk,0 ,0 );scatterwalk_done (&assoc_sg_walk,0 ,0 ); }else { -scatterwalk_map_and_copy (dst, req->dst,0 , req->cryptlen,1 ); +scatterwalk_map_and_copy (dst, req->dst,0 , tempCipherLen,1 );kfree (src); }return retval;
arch/x86/kernel/entry_64.S +8 -5
@@ -414,11 +414,14 @@ ENTRY(ret_from_fork) testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread? je int_ret_from_sys_call - testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET - jnz int_ret_from_sys_call - - RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET - jmp ret_from_sys_call # go to the SYSRET fastpath + /* + * By the time we get here, we have no idea whether our pt_regs, + * ti flags, and ti status came from the 64-bit SYSCALL fast path, + * the slow path, or one of the ia32entry paths. + * Use int_ret_from_sys_call to return, since it can safely handle + * all of the above. + */ + jmp int_ret_from_sys_call CFI_ENDPROC END(ret_from_fork)
arch/x86/kernel/reboot.c +42 -16
88 lines not on this page · raw message
arch/x86/kernel/traps.c +1 -1
@@ -435,7 +435,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)* then it's very likely the result of an icebp/int01 trap. * User wants a sigtrap for that. */ -if (!dr6 &&user_mode (regs)) +if (!dr6 &&user_mode_vm (regs)) user_icebp =1 ;/* Catch kmemcheck conditions first of all! */
arch/x86/kvm/emulate.c +2 -1
@@ -4014,7 +4014,8 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)if (rc !=X86EMUL_CONTINUE ) goto done; } - ctxt->dst.orig_val = ctxt->dst.val; +/* Copy full 64-bit value for CMPXCHG8B. */ + ctxt->dst.orig_val64 = ctxt->dst.val64; special_insn:
arch/x86/mm/mmap.c +3 -3
@@ -35,12 +35,12 @@ struct __read_mostly va_alignment va_align = { .flags = -1, }; -static unsigned int stack_maxrandom_size (void ) +static unsigned long stack_maxrandom_size (void ) { -unsigned int max =0 ; +unsigned long max =0 ;if ((current->flags &PF_RANDOMIZE ) && !(current->personality &ADDR_NO_RANDOMIZE )) { - max = ((-1U ) &STACK_RND_MASK ) <<PAGE_SHIFT ; + max = ((-1UL ) &STACK_RND_MASK ) <<PAGE_SHIFT ; }return max;
arch/x86/vdso/vdso32/sigreturn.S +1 -0
@@ -17,6 +17,7 @@ .text .globl __kernel_sigreturn .type __kernel_sigreturn,@function + nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */ ALIGN __kernel_sigreturn: .LSTART_sigreturn:
drivers/acpi/video.c +11 -0
@@ -1854,6 +1854,17 @@ EXPORT_SYMBOL(acpi_video_unregister);static int __init acpi_video_init (void ) { +/* +* Let the module load even if ACPI is disabled (e.g. due to +* a broken BIOS) so that i915.ko can still be loaded on such +* old systems without an AcpiOpRegion. +* +* acpi_video_register() will report -ENODEV later as well due +* to acpi_disabled when i915.ko tries to register itself afterwards. +*/ +if (acpi_disabled) +return 0 ; +dmi_check_system (video_dmi_table);if (intel_opregion_present ())
drivers/block/nbd.c +4 -4
@@ -773,10 +773,6 @@ static int __init nbd_init(void)return -EINVAL ; } - nbd_dev =kcalloc (nbds_max,sizeof (*nbd_dev),GFP_KERNEL ); -if (!nbd_dev) -return -ENOMEM ; - part_shift =0 ;if (max_part >0 ) { part_shift =fls (max_part);
@@ -798,6 +794,10 @@ static int __init nbd_init(void)if (nbds_max >1UL << (MINORBITS - part_shift))return -EINVAL ; + nbd_dev =kcalloc (nbds_max,sizeof (*nbd_dev),GFP_KERNEL ); +if (!nbd_dev) +return -ENOMEM ; +for (i =0 ; i < nbds_max; i++) {struct gendisk *disk =alloc_disk (1 << part_shift);if (!disk)
drivers/bluetooth/ath3k.c +2 -0
@@ -106,6 +106,7 @@ static struct usb_device_id ath3k_table[] = { { USB_DEVICE(0x13d3, 0x3393) }, { USB_DEVICE(0x13d3, 0x3402) }, { USB_DEVICE(0x13d3, 0x3408) }, + { USB_DEVICE(0x13d3, 0x3423) }, { USB_DEVICE(0x13d3, 0x3432) },/* Atheros AR5BBU12 with sflash firmware */
@@ -160,6 +161,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },/* Atheros AR5BBU22 with sflash firmware */
drivers/bluetooth/btusb.c +1 -0
@@ -191,6 +191,7 @@ static struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },/* Atheros AR5BBU12 with sflash firmware */
drivers/char/tpm/tpm.c +1 -1
@@ -1341,7 +1341,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,/* Make chip available */ spin_lock (&driver_lock); -list_add_rcu (&chip->list, &tpm_chip_list); +list_add_tail_rcu (&chip->list, &tpm_chip_list);spin_unlock (&driver_lock);return chip;
drivers/char/virtio_console.c +16 -0
@@ -124,6 +124,7 @@ struct ports_device {* notification */ struct work_struct control_work; +struct work_struct config_work;struct list_head ports;
@@ -1556,10 +1557,21 @@ static void config_intr(struct virtio_device *vdev) portdev = vdev->priv; +if (!use_multiport (portdev)) +schedule_work (&portdev->config_work); +} + +static void config_work_handler (struct work_struct *work) +{ +struct ports_device *portdev; + + portdev = container_of(work, struct ports_device, control_work);if (!use_multiport (portdev)) { +struct virtio_device *vdev;struct port *port;u16 rows, cols; + vdev = portdev->vdev; vdev->config->get (vdev, offsetof(struct virtio_console_config , cols), &cols,sizeof (u16));
@@ -1731,6 +1743,8 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)spin_lock_init (&portdev->ports_lock);INIT_LIST_HEAD (&portdev->ports); +INIT_WORK (&portdev->config_work, &config_work_handler); +if (multiport) {unsigned int nr_added_bufs;
@@ -1806,6 +1820,8 @@ static void virtcons_remove(struct virtio_device *vdev)/* Finish up work that's lined up */ if (use_multiport (portdev))cancel_work_sync (&portdev->control_work); +else +cancel_work_sync (&portdev->config_work);list_for_each_entry_safe (port, port2, &portdev->ports, list)unplug_port (port);
drivers/cpufreq/speedstep-lib.c +3 -0
@@ -399,6 +399,7 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor,pr_debug ("previous speed is %u\n" , prev_speed); +preempt_disable ();local_irq_save (flags);/* switch to low state */
@@ -463,6 +464,8 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor, out:local_irq_restore (flags); +preempt_enable (); +return ret; }EXPORT_SYMBOL_GPL (speedstep_get_freqs);
drivers/cpufreq/speedstep-smi.c +12 -0
@@ -187,6 +187,7 @@ static void speedstep_set_state(unsigned int state)return ;/* Disable IRQs */ +preempt_disable ();local_irq_save (flags); command = (smi_sig &0xffffff00 ) | (smi_cmd &0xff );
@@ -197,9 +198,19 @@ static void speedstep_set_state(unsigned int state) do { if (retry) { + /* + * We need to enable interrupts, otherwise the blockage + * won't resolve. + * + * We disable preemption so that other processes don't + * run. If other processes were running, they could + * submit more DMA requests, making the blockage worse. + */ pr_debug("retry %u, previous result %u, waiting...\n", retry, result); + local_irq_enable(); mdelay(retry * 50); + local_irq_disable(); } retry++; __asm__ __volatile__(
@@ -216,6 +227,7 @@ static void speedstep_set_state(unsigned int state)/* enable IRQs */ local_irq_restore (flags); +preempt_enable ();if (new_state == state) pr_debug("change to %u MHz succeeded after %u tries "
drivers/firmware/dmi_scan.c +2 -2
@@ -69,7 +69,7 @@ static char * __init dmi_string(const struct dmi_header *dm, u8 s)* We have to be cautious here. We have seen BIOSes with DMI pointers * pointing to completely the wrong place for example */ -static void dmi_table (u8 *buf,int len,int num, +static void dmi_table (u8 *buf,u32 len,int num,void (*decode)(const struct dmi_header *,void *),void *private_data) {
@@ -99,7 +99,7 @@ static void dmi_table(u8 *buf, int len, int num, }static u32 dmi_base; -static u16 dmi_len; +static u32 dmi_len;static u16 dmi_num; static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,
drivers/gpio/gpio-tps65912.c +10 -4
@@ -26,9 +26,12 @@ struct tps65912_gpio_data {struct gpio_chip gpio_chip; }; +#define to_tgd (gc) container_of(gc, struct tps65912_gpio_data, gpio_chip) +static int tps65912_gpio_get (struct gpio_chip *gc,unsigned offset) { - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); +struct tps65912_gpio_data *tps65912_gpio =to_tgd (gc); +struct tps65912 *tps65912 = tps65912_gpio->tps65912;int val; val =tps65912_reg_read (tps65912,TPS65912_GPIO1 + offset);
@@ -42,7 +45,8 @@ static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset)static void tps65912_gpio_set (struct gpio_chip *gc,unsigned offset,int value) { - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); +struct tps65912_gpio_data *tps65912_gpio =to_tgd (gc); +struct tps65912 *tps65912 = tps65912_gpio->tps65912;if (value) tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset,
@@ -55,7 +59,8 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset,static int tps65912_gpio_output (struct gpio_chip *gc,unsigned offset,int value) { - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); +struct tps65912_gpio_data *tps65912_gpio =to_tgd (gc); +struct tps65912 *tps65912 = tps65912_gpio->tps65912;/* Set the initial value */ tps65912_gpio_set (gc, offset, value);
@@ -66,7 +71,8 @@ static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset,static int tps65912_gpio_input (struct gpio_chip *gc,unsigned offset) { - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); +struct tps65912_gpio_data *tps65912_gpio =to_tgd (gc); +struct tps65912 *tps65912 = tps65912_gpio->tps65912;return tps65912_clear_bits (tps65912,TPS65912_GPIO1 + offset,GPIO_CFG_MASK );
drivers/gpu/drm/radeon/atombios_dp.c +1 -3
@@ -739,10 +739,8 @@ static int radeon_dp_link_train_init(struct radeon_dp_link_train_info *dp_info)radeon_write_dpcd_reg (dp_info->radeon_connector,DP_DOWNSPREAD_CTRL ,0 ); -if ((dp_info->connector->connector_type == DRM_MODE_CONNECTOR_eDP) && - (dig->panel_mode ==DP_PANEL_MODE_INTERNAL_DP2_MODE )) { +if (dig->panel_mode ==DP_PANEL_MODE_INTERNAL_DP2_MODE )radeon_write_dpcd_reg (dp_info->radeon_connector,DP_EDP_CONFIGURATION_SET ,1 ); - }/* set the lane count on the sink */ tmp = dp_info->dp_lane_count;
drivers/gpu/drm/radeon/evergreen.c +3 -0
@@ -2631,6 +2631,9 @@ int evergreen_irq_set(struct radeon_device *rdev)WREG32 (DC_HPD5_INT_CONTROL , hpd5);WREG32 (DC_HPD6_INT_CONTROL , hpd6); +/* posting read */ +RREG32 (SRBM_STATUS ); +return 0 ; }
drivers/gpu/drm/radeon/r100.c +4 -0
@@ -688,6 +688,10 @@ int r100_irq_set(struct radeon_device *rdev) tmp |=RADEON_FP2_DETECT_MASK ; }WREG32 (RADEON_GEN_INT_CNTL , tmp); + +/* read back to post the write */ +RREG32 (RADEON_GEN_INT_CNTL ); +return 0 ; }
drivers/gpu/drm/radeon/r600.c +3 -0
@@ -3156,6 +3156,9 @@ int r600_irq_set(struct radeon_device *rdev)WREG32 (DC_HOT_PLUG_DETECT3_INT_CONTROL , hpd3); } +/* posting read */ +RREG32 (R_000E50_SRBM_STATUS ); +return 0 ; }
drivers/gpu/drm/radeon/radeon_bios.c +7 -3
@@ -76,7 +76,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev)static bool radeon_read_bios (struct radeon_device *rdev) { -uint8_t __iomem *bios; +uint8_t __iomem *bios, val1, val2;size_t size; rdev->bios =NULL ;
@@ -86,15 +86,19 @@ static bool radeon_read_bios(struct radeon_device *rdev)return false; } -if (size ==0 || bios[0 ] !=0x55 || bios[1 ] !=0xaa ) { + val1 =readb (&bios[0 ]); + val2 =readb (&bios[1 ]); + +if (size ==0 || val1 !=0x55 || val2 !=0xaa ) {pci_unmap_rom (rdev->pdev, bios);return false; } - rdev->bios =kmemdup (bios, size,GFP_KERNEL ); + rdev->bios =kzalloc (size,GFP_KERNEL );if (rdev->bios ==NULL ) {pci_unmap_rom (rdev->pdev, bios);return false; } +memcpy_fromio (rdev->bios, bios, size);pci_unmap_rom (rdev->pdev, bios);return true; }
drivers/gpu/drm/radeon/radeon_cs.c +3 -1
@@ -95,11 +95,13 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)uint64_t *chunk_array_ptr;unsigned size, i, flags =0 ; +INIT_LIST_HEAD (&p->validated); +if (!cs->num_chunks) {return 0 ; } +/* get chunks */ -INIT_LIST_HEAD (&p->validated); p->idx =0 ; p->chunk_ib_idx =-1 ; p->chunk_relocs_idx =-1 ;
drivers/gpu/drm/radeon/rs600.c +4 -0
@@ -576,6 +576,10 @@ int rs600_irq_set(struct radeon_device *rdev)WREG32 (R_006540_DxMODE_INT_MASK, mode_int);WREG32 (R_007D08_DC_HOT_PLUG_DETECT1_INT_CONTROL , hpd1);WREG32 (R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL , hpd2); + +/* posting read */ +RREG32 (R_000040_GEN_INT_CNTL ); +return 0 ; }
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +25 -22
83 lines not on this page · raw message
drivers/infiniband/core/umem.c +8 -0
@@ -94,6 +94,14 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,if (dmasync)dma_set_attr (DMA_ATTR_WRITE_BARRIER , &attrs); +/* +* If the combination of the addr and size requested for this memory +* region causes an integer overflow, return error. +*/ +if ((PAGE_ALIGN (addr + size) <= size) || + (PAGE_ALIGN (addr + size) <= addr)) +return ERR_PTR (-EINVAL ); +if (!can_do_mlock ())return ERR_PTR (-EPERM );
drivers/infiniband/core/uverbs_main.c +1 -0
@@ -451,6 +451,7 @@ static void ib_uverbs_async_handler(struct ib_uverbs_file *file, entry->desc.async.element = element; entry->desc.async.event_type = event; + entry->desc.async.reserved =0 ; entry->counter = counter;list_add_tail (&entry->list, &file->async_file->event_list);
drivers/infiniband/hw/mlx4/mad.c +16 -4
@@ -44,6 +44,14 @@ enum { MLX4_IB_VENDOR_CLASS2 = 0xa }; +/* Counters should be saturate once they reach their maximum value */ +#define ASSIGN_32BIT_COUNTER (counter, value) do {\ + if ((value) > (u32)~0U) \ + counter = cpu_to_be32((u32)~0U); \ + else \ + counter = cpu_to_be32(value); \ +} while (0) +int mlx4_MAD_IFC (struct mlx4_ib_dev *dev,int ignore_mkey,int ignore_bkey,int port,struct ib_wc *in_wc,struct ib_grh *in_grh,void *in_mad,void *response_mad)
@@ -303,10 +311,14 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,static void edit_counter (struct mlx4_counter *cnt,struct ib_pma_portcounters *pma_cnt) { - pma_cnt->port_xmit_data =cpu_to_be32 ((be64_to_cpu (cnt->tx_bytes)>>2 )); - pma_cnt->port_rcv_data =cpu_to_be32 ((be64_to_cpu (cnt->rx_bytes)>>2 )); - pma_cnt->port_xmit_packets =cpu_to_be32 (be64_to_cpu (cnt->tx_frames)); - pma_cnt->port_rcv_packets =cpu_to_be32 (be64_to_cpu (cnt->rx_frames)); +ASSIGN_32BIT_COUNTER (pma_cnt->port_xmit_data, + (be64_to_cpu (cnt->tx_bytes) >>2 )); +ASSIGN_32BIT_COUNTER (pma_cnt->port_rcv_data, + (be64_to_cpu (cnt->rx_bytes) >>2 )); +ASSIGN_32BIT_COUNTER (pma_cnt->port_xmit_packets, +be64_to_cpu (cnt->tx_frames)); +ASSIGN_32BIT_COUNTER (pma_cnt->port_rcv_packets, +be64_to_cpu (cnt->rx_frames)); } static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
drivers/infiniband/hw/qib/qib.h +1 -8
@@ -1005,12 +1005,6 @@ struct qib_devdata {/* control high-level access to EEPROM */ struct mutex eep_lock;uint64_t traffic_wds; -/* active time is kept in seconds, but logged in hours */ -atomic_t active_time; -/* Below are nominal shadow of EEPROM, new since last EEPROM update */ -uint8_t eep_st_errs[QIB_EEP_LOG_CNT ]; -uint8_t eep_st_new_errs[QIB_EEP_LOG_CNT ]; -uint16_t eep_hrs;/* * masks for which bits of errs, hwerrs that cause * each of the counters to increment.
@@ -1227,8 +1221,7 @@ int qib_twsi_blk_rd(struct qib_devdata *dd, int dev, int addr, void *buffer,int qib_twsi_blk_wr (struct qib_devdata *dd,int dev,int addr,const void *buffer,int len);void qib_get_eeprom_info (struct qib_devdata *); -int qib_update_eeprom_log (struct qib_devdata *dd); -void qib_inc_eeprom_err (struct qib_devdata *dd,u32 eidx,u32 incr); +#define qib_inc_eeprom_err (dd, eidx, incr)void qib_dump_lookup_output_queue (struct qib_devdata *);void qib_force_pio_avail_update (struct qib_devdata *);void qib_clear_symerror_on_linkup (unsigned long opaque);
drivers/infiniband/hw/qib/qib_eeprom.c +0 -180
189 lines not on this page · raw message
drivers/infiniband/hw/qib/qib_iba6120.c +0 -2
@@ -2674,8 +2674,6 @@ static void qib_get_6120_faststats(unsigned long opaque)spin_lock_irqsave (&dd->eep_st_lock, flags); traffic_wds -= dd->traffic_wds; dd->traffic_wds += traffic_wds; -if (traffic_wds >=QIB_TRAFFIC_ACTIVE_THRESHOLD ) -atomic_add (5 , &dd->active_time);/* S/B #define */ spin_unlock_irqrestore (&dd->eep_st_lock, flags);qib_chk_6120_errormask (dd);
drivers/infiniband/hw/qib/qib_iba7220.c +0 -2
@@ -3292,8 +3292,6 @@ static void qib_get_7220_faststats(unsigned long opaque)spin_lock_irqsave (&dd->eep_st_lock, flags); traffic_wds -= dd->traffic_wds; dd->traffic_wds += traffic_wds; -if (traffic_wds >=QIB_TRAFFIC_ACTIVE_THRESHOLD ) -atomic_add (5 , &dd->active_time);/* S/B #define */ spin_unlock_irqrestore (&dd->eep_st_lock, flags); done:mod_timer (&dd->stats_timer, jiffies +HZ *ACTIVITY_TIMER );
drivers/infiniband/hw/qib/qib_iba7322.c +0 -2
@@ -4793,8 +4793,6 @@ static void qib_get_7322_faststats(unsigned long opaque)spin_lock_irqsave (&ppd->dd->eep_st_lock, flags); traffic_wds -= ppd->dd->traffic_wds; ppd->dd->traffic_wds += traffic_wds; -if (traffic_wds >=QIB_TRAFFIC_ACTIVE_THRESHOLD ) -atomic_add (ACTIVITY_TIMER , &ppd->dd->active_time);spin_unlock_irqrestore (&ppd->dd->eep_st_lock, flags); if (ppd->cpspec->qdr_dfe_on && (ppd->link_speed_active & QIB_IB_QDR) &&
drivers/infiniband/hw/qib/qib_init.c +0 -1
@@ -765,7 +765,6 @@ static void qib_shutdown_device(struct qib_devdata *dd) dd->f_quiet_serdes (ppd); } -qib_update_eeprom_log (dd); }/**
drivers/infiniband/hw/qib/qib_sysfs.c +0 -24
@@ -550,28 +550,6 @@ bail:return ret <0 ? ret : count; } -static ssize_t show_logged_errs (struct device *device, -struct device_attribute *attr,char *buf) -{ -struct qib_ibdev *dev = - container_of(device, struct qib_ibdev, ibdev.dev); -struct qib_devdata *dd =dd_from_dev (dev); -int idx, count; - -/* force consistency with actual EEPROM */ -if (qib_update_eeprom_log (dd) !=0 ) -return -ENXIO ; - - count =0 ; -for (idx =0 ; idx <QIB_EEP_LOG_CNT ; ++idx) { - count +=scnprintf (buf + count,PAGE_SIZE - count,"%d%c" , - dd->eep_st_errs[idx], - idx == (QIB_EEP_LOG_CNT -1 ) ?'\n' :' ' ); - } - -return count; -} -/* * Dump tempsense regs. in decimal, to ease shell-scripts. */
@@ -618,7 +596,6 @@ static DEVICE_ATTR(nctxts, S_IRUGO, show_nctxts, NULL); static DEVICE_ATTR(nfreectxts, S_IRUGO, show_nfreectxts, NULL); static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL); static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL); -static DEVICE_ATTR(logged_errors, S_IRUGO, show_logged_errs, NULL); static DEVICE_ATTR(tempsense, S_IRUGO, show_tempsense, NULL); static DEVICE_ATTR(localbus_info, S_IRUGO, show_localbus_info, NULL); static DEVICE_ATTR(chip_reset, S_IWUSR, NULL, store_chip_reset);
@@ -632,7 +609,6 @@ static struct device_attribute *qib_attributes[] = { &dev_attr_nfreectxts, &dev_attr_serial, &dev_attr_boardversion, - &dev_attr_logged_errors, &dev_attr_tempsense, &dev_attr_localbus_info, &dev_attr_chip_reset,
drivers/input/mouse/synaptics.c +47 -26
109 lines not on this page · raw message
drivers/md/dm-io.c +11 -1
@@ -299,6 +299,16 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,sector_t remaining = where->count;struct request_queue *q =bdev_get_queue (where->bdev);sector_t discard_sectors; +unsigned int uninitialized_var (special_cmd_max_sectors ); + +/* Reject unsupported discard requests */ +if (rw &REQ_DISCARD ) { + special_cmd_max_sectors = q->limits.max_discard_sectors; +if (special_cmd_max_sectors ==0 ) { +dec_count (io, region, -EOPNOTSUPP ); +return ; + } + }/* * where->count may be zero if rw holds a flush and we need to
@@ -322,7 +332,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,store_io_and_region_in_bio (bio, io, region);if (rw &REQ_DISCARD ) { - discard_sectors =min_t (sector_t, q->limits.max_discard_sectors, remaining); + discard_sectors =min_t (sector_t, special_cmd_max_sectors, remaining); bio->bi_size = discard_sectors <<SECTOR_SHIFT ; remaining -= discard_sectors; }else while (remaining) {
drivers/md/dm-raid1.c +9 -0
@@ -603,6 +603,15 @@ static void write_callback(unsigned long error, void *context)return ; } +/* +* If the bio is discard, return an error, but do not +* degrade the array. +*/ +if (bio->bi_rw &REQ_DISCARD ) { +bio_endio (bio, -EOPNOTSUPP ); +return ; + } +for (i =0 ; i < ms->nr_mirrors; i++)if (test_bit (i, &error))fail_mirror (ms->mirror + i,DM_RAID1_WRITE_ERROR );
drivers/md/dm-snap.c +2 -2
@@ -1444,8 +1444,6 @@ out: full_bio->bi_end_io = pe->full_bio_end_io; full_bio->bi_private = pe->full_bio_private; } -free_pending_exception (pe); -increment_pending_exceptions_done_count ();up_write (&s->lock);
@@ -1462,6 +1460,8 @@ out: }retry_origin_bios (s, origin_bios); + +free_pending_exception (pe); }static void commit_callback (void *context,int success)
drivers/md/dm.c +16 -17
@@ -2232,7 +2232,7 @@ int dm_setup_md_queue(struct mapped_device *md)return 0 ; } -static struct mapped_device *dm_find_md (dev_t dev) +struct mapped_device *dm_get_md (dev_t dev) {struct mapped_device *md;unsigned minor =MINOR (dev);
@@ -2243,12 +2243,15 @@ static struct mapped_device *dm_find_md(dev_t dev)spin_lock (&_minor_lock); md =idr_find (&_minor_idr, minor); -if (md && (md ==MINOR_ALLOCED || - (MINOR (disk_devt (dm_disk (md))) != minor) || -dm_deleting_md (md) || -test_bit (DMF_FREEING , &md->flags))) { - md =NULL ; - goto out; +if (md) { +if ((md ==MINOR_ALLOCED || + (MINOR (disk_devt (dm_disk (md))) != minor) || +dm_deleting_md (md) || +test_bit (DMF_FREEING , &md->flags))) { + md =NULL ; + goto out; + } +dm_get (md); } out:
@@ -2256,16 +2259,6 @@ out:return md; } - -struct mapped_device *dm_get_md (dev_t dev) -{ -struct mapped_device *md =dm_find_md (dev); - -if (md) -dm_get (md); - -return md; -}EXPORT_SYMBOL_GPL (dm_get_md);void *dm_get_mdptr (struct mapped_device *md)
@@ -2302,10 +2295,16 @@ static void __dm_destroy(struct mapped_device *md, bool wait)set_bit (DMF_FREEING , &md->flags);spin_unlock (&_minor_lock); +/* +* Take suspend_lock so that presuspend and postsuspend methods +* do not race with internal suspend. +*/ +mutex_lock (&md->suspend_lock);if (!dm_suspended_md (md)) {dm_table_presuspend_targets (map);dm_table_postsuspend_targets (map); } +mutex_unlock (&md->suspend_lock);/* * Rare, but there may be I/O requests still going to complete,
drivers/media/dvb/dvb-usb/lmedm04.c +8 -0
@@ -326,7 +326,9 @@ static void lme2510_int_response(struct urb *lme_urb)static int lme2510_int_read (struct dvb_usb_adapter *adap) { +struct dvb_usb_device *d = adap->dev;struct lme2510_state *lme_int = adap->dev->priv; +struct usb_host_endpoint *ep; lme_int->lme_urb =usb_alloc_urb (0 ,GFP_ATOMIC );
@@ -348,6 +350,12 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) adap, 8); +/* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */ + ep =usb_pipe_endpoint (d->udev, lme_int->lme_urb->pipe); + +if (usb_endpoint_type (&ep->desc) ==USB_ENDPOINT_XFER_BULK ) + lme_int->lme_urb->pipe =usb_rcvbulkpipe (d->udev,0xa ), + lme_int->lme_urb->transfer_flags |=URB_NO_TRANSFER_DMA_MAP ;usb_submit_urb (lme_int->lme_urb,GFP_ATOMIC );
drivers/net/can/dev.c +5 -0
@@ -468,6 +468,11 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) skb->protocol =htons (ETH_P_CAN ); skb->pkt_type =PACKET_BROADCAST ; skb->ip_summed =CHECKSUM_UNNECESSARY ; + +skb_reset_mac_header (skb); +skb_reset_network_header (skb); +skb_reset_transport_header (skb); + *cf = (struct can_frame *)skb_put (skb,sizeof (struct can_frame ));memset (*cf,0 ,sizeof (struct can_frame ));
drivers/net/ethernet/amd/pcnet32.c +29 -2
@@ -1524,7 +1524,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) {struct pcnet32_private *lp;int i, media; -int fdx, mii, fset, dxsuflo; +int fdx, mii, fset, dxsuflo, sram;int chip_version;char *chipname;struct net_device *dev;
@@ -1561,7 +1561,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) }/* initialize variables */ - fdx = mii = fset = dxsuflo =0 ; + fdx = mii = fset = dxsuflo = sram =0 ; chip_version = (chip_version >>12 ) &0xffff ;switch (chip_version) {
@@ -1594,6 +1594,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) chipname ="PCnet/FAST III 79C973" ;/* PCI */ fdx =1 ; mii =1 ; + sram =1 ;break ;case 0x2626 : chipname ="PCnet/Home 79C978" ;/* PCI */
@@ -1617,6 +1618,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) chipname ="PCnet/FAST III 79C975" ;/* PCI */ fdx =1 ; mii =1 ; + sram =1 ;break ;case 0x2628 : chipname ="PCnet/PRO 79C976" ;
@@ -1645,6 +1647,31 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) dxsuflo =1 ; } +/* +* The Am79C973/Am79C975 controllers come with 12K of SRAM +* which we can use for the Tx/Rx buffers but most importantly, +* the use of SRAM allow us to use the BCR18:NOUFLO bit to avoid +* Tx fifo underflows. +*/ +if (sram) { +/* +* The SRAM is being configured in two steps. First we +* set the SRAM size in the BCR25:SRAM_SIZE bits. According +* to the datasheet, each bit corresponds to a 512-byte +* page so we can have at most 24 pages. The SRAM_SIZE +* holds the value of the upper 8 bits of the 16-bit SRAM size. +* The low 8-bits start at 0x00 and end at 0xff. So the +* address range is from 0x0000 up to 0x17ff. Therefore, +* the SRAM_SIZE is set to 0x17. The next step is to set +* the BCR26:SRAM_BND midway through so the Tx and Rx +* buffers can share the SRAM equally. +*/ + a->write_bcr (ioaddr,25 ,0x17 ); + a->write_bcr (ioaddr,26 ,0xc ); +/* And finally enable the NOUFLO bit */ + a->write_bcr (ioaddr,18 , a->read_bcr (ioaddr,18 ) | (1 <<11 )); + } + dev =alloc_etherdev (sizeof (*lp));if (!dev) {if (pcnet32_debug &NETIF_MSG_PROBE )
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +4 -0
@@ -10325,6 +10325,10 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev,/* clean indirect addresses */ pci_write_config_dword (bp->pdev,PCICFG_GRC_ADDRESS ,PCICFG_VENDOR_ID_OFFSET ); + +/* Set PCIe reset type to fundamental for EEH recovery */ + pdev->needs_freset =1 ; +/* * Clean the following indirect addresses for all functions since it * is not used by the driver.
drivers/net/ethernet/broadcom/tg3.c +7 -7
@@ -5412,7 +5412,7 @@ static void tg3_tx(struct tg3_napi *tnapi) sw_idx =NEXT_TX (sw_idx); } -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);if (unlikely (tx_bug)) {tg3_tx_recover (tp);
@@ -5702,7 +5702,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget)if (len > (tp->dev->mtu +ETH_HLEN ) && skb->protocol !=htons (ETH_P_8021Q )) { -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); goto drop_it_no_recycle; }
@@ -6609,7 +6609,7 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi, PCI_DMA_TODEVICE);/* Make sure the mapping succeeded */ if (pci_dma_mapping_error (tp->pdev, new_addr)) { -dev_kfree_skb (new_skb); +dev_kfree_skb_any (new_skb); ret =-1 ; }else {u32 save_entry = *entry;
@@ -6624,13 +6624,13 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi, new_skb->len, base_flags, mss, vlan)) {tg3_tx_skb_unmap (tnapi, save_entry,-1 ); -dev_kfree_skb (new_skb); +dev_kfree_skb_any (new_skb); ret =-1 ; } } } -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); *pskb = new_skb;return ret; }
@@ -6673,7 +6673,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb) }while (segs); tg3_tso_bug_end: -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
@@ -6888,7 +6888,7 @@ dma_error:tg3_tx_skb_unmap (tnapi, tnapi->tx_prod, --i); tnapi->tx_buffers[tnapi->tx_prod].skb =NULL ; drop: -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); drop_nofree: tp->tx_dropped++;return NETDEV_TX_OK ;
drivers/net/ethernet/emulex/benet/be_main.c +1 -1
@@ -1434,7 +1434,7 @@ static u16 be_tx_compl_process(struct be_adapter *adapter,queue_tail_inc (txq); }while (cur_index != last_index); -kfree_skb (sent_skb); +dev_kfree_skb_any (sent_skb);return num_wrbs; }
drivers/net/ethernet/freescale/gianfar.c +2 -2
@@ -2092,10 +2092,10 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) skb_new =skb_realloc_headroom (skb,GMAC_FCB_LEN );if (!skb_new) { dev->stats.tx_errors++; -kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; } -kfree_skb (skb); +dev_kfree_skb_any (skb); skb = skb_new; }
drivers/net/ethernet/intel/ixgb/ixgb_main.c +3 -3
@@ -1539,12 +1539,12 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev)int tso;if (test_bit (__IXGB_DOWN, &adapter->flags)) { -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }if (skb->len <=0 ) { -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
@@ -1561,7 +1561,7 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev) tso =ixgb_tso (adapter, skb);if (tso <0 ) { -dev_kfree_skb (skb); +dev_kfree_skb_any (skb);return NETDEV_TX_OK ; }
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +4 -1
@@ -2277,7 +2277,10 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget) work_done =netxen_process_rcv_ring (sds_ring, budget); -if ((work_done < budget) && tx_complete) { +if (!tx_complete) + work_done = budget; + +if (work_done < budget) {napi_complete (&sds_ring->napi);if (test_bit (__NX_DEV_UP, &adapter->state))netxen_nic_enable_int (sds_ring);
drivers/net/ethernet/realtek/8139cp.c +1 -1
@@ -886,7 +886,7 @@ out_unlock:return NETDEV_TX_OK ; out_dma_error: -kfree_skb (skb); +dev_kfree_skb_any (skb); cp->dev->stats.tx_dropped++; goto out_unlock; }
drivers/net/ethernet/realtek/8139too.c +2 -2
@@ -1703,9 +1703,9 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb,if (len <ETH_ZLEN )memset (tp->tx_buf[entry],0 ,ETH_ZLEN );skb_copy_and_csum_dev (skb, tp->tx_buf[entry]); -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); }else { -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); dev->stats.tx_dropped++;return NETDEV_TX_OK ; }
drivers/net/ethernet/realtek/r8169.c +3 -3
@@ -5372,7 +5372,7 @@ static void rtl8169_tx_clear_range(struct rtl8169_private *tp, u32 start, tp->TxDescArray + entry);if (skb) { tp->dev->stats.tx_dropped++; -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); tx_skb->skb =NULL ; } }
@@ -5651,7 +5651,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, err_dma_1:rtl8169_unmap_tx_skb (d, tp->tx_skb + entry, txd); err_dma_0: -dev_kfree_skb (skb); +dev_kfree_skb_any (skb); err_update_stats: dev->stats.tx_dropped++;return NETDEV_TX_OK ;
@@ -5734,7 +5734,7 @@ static void rtl8169_tx_interrupt(struct net_device *dev,if (status & LastFrag) { dev->stats.tx_packets++; dev->stats.tx_bytes += tx_skb->skb->len; -dev_kfree_skb (tx_skb->skb); +dev_kfree_skb_any (tx_skb->skb); tx_skb->skb =NULL ; } dirty_tx++;
drivers/net/macvtap.c +11 -2
@@ -667,11 +667,15 @@ static unsigned long iov_pages(const struct iovec *iv, int offset,return pages; } +/* Neighbour code has some assumptions on HH_DATA_MOD alignment */ +#define MACVTAP_RESERVE HH_DATA_OFF(ETH_HLEN) +/* Get packet from user space buffer */ static ssize_t macvtap_get_user (struct macvtap_queue *q,struct msghdr *m,const struct iovec *iv,unsigned long total_len,size_t count,int noblock) { +int good_linear =SKB_MAX_HEAD (MACVTAP_RESERVE );struct sk_buff *skb;struct macvlan_dev *vlan;unsigned long len = total_len;
@@ -714,6 +718,8 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,if (m && m->msg_control &&sock_flag (&q->sk,SOCK_ZEROCOPY )) { copylen = vnet_hdr.hdr_len ? vnet_hdr.hdr_len :GOODCOPY_LEN ; +if (copylen > good_linear) + copylen = good_linear; linear = copylen;if (iov_pages (iv, vnet_hdr_len + copylen, count) <=MAX_SKB_FRAGS )
@@ -722,10 +728,13 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,if (!zerocopy) { copylen = len; - linear = vnet_hdr.hdr_len; +if (vnet_hdr.hdr_len > good_linear) + linear = good_linear; +else + linear = vnet_hdr.hdr_len; } - skb =macvtap_alloc_skb (&q->sk,NET_IP_ALIGN , copylen, + skb =macvtap_alloc_skb (&q->sk,MACVTAP_RESERVE , copylen, linear, noblock, &err);if (!skb) goto err;
drivers/net/ppp/ppp_deflate.c +1 -1
@@ -268,7 +268,7 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf,/* * See if we managed to reduce the size of the packet. */ -if (olen < isize) { +if (olen < isize && olen <= osize) { state->stats.comp_bytes += olen; state->stats.comp_packets++; }else {
drivers/net/usb/plusb.c +5 -0
@@ -139,6 +139,11 @@ static const struct usb_device_id products [] = { }, { USB_DEVICE(0x050d, 0x258a), /* Belkin F5U258/F5U279 (PL-25A1) */ .driver_info = (unsigned long ) &prolific_info, +}, { +USB_DEVICE (0x3923 ,0x7825 ),/* National Instruments USB +* Host-to-Host Cable +*/ + .driver_info = (unsigned long) &prolific_info, }, { }, // END
drivers/net/xen-netfront.c +1 -4
@@ -1053,8 +1053,7 @@ err:static int xennet_change_mtu (struct net_device *dev,int mtu) { -int max =xennet_can_sg (dev) ? -XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER :ETH_DATA_LEN ; +int max =xennet_can_sg (dev) ?XEN_NETIF_MAX_TX_SIZE :ETH_DATA_LEN ;if (mtu > max)return -EINVAL ;
@@ -1329,8 +1328,6 @@ static struct net_device * __devinit xennet_create_dev(struct xenbus_device *devSET_ETHTOOL_OPS (netdev, &xennet_ethtool_ops);SET_NETDEV_DEV (netdev, &dev->dev); -netif_set_gso_max_size (netdev,XEN_NETIF_MAX_TX_SIZE -MAX_TCP_HEADER ); - np->netdev = netdev;netif_carrier_off (netdev);
drivers/pci/hotplug.c +1 -1
@@ -27,7 +27,7 @@ int pci_uevent(struct device *dev, struct kobj_uevent_env *env)if (add_uevent_var (env,"PCI_SLOT_NAME=%s" ,pci_name (pdev)))return -ENOMEM ; - if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x", + if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X", pdev->vendor, pdev->device, pdev->subsystem_vendor, pdev->subsystem_device, (u8)(pdev->class >> 16), (u8)(pdev->class >> 8),
drivers/pci/rom.c +4 -3
@@ -69,6 +69,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) {void __iomem *image;int last_image; +unsigned length; image = rom; do {
@@ -91,9 +92,9 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)if (readb (pds +3 ) !='R' )break ; last_image =readb (pds +21 ) &0x80 ; -/* this length is reliable */ - image +=readw (pds +16 ) *512 ; - }while (!last_image); + length =readw (pds +16 ); + image += length *512 ; + }while (length && !last_image);/* never return a size larger than the PCI resource window */ /* there are known ROMs that get the size wrong */
drivers/scsi/be2iscsi/be_main.c +1 -2
@@ -424,7 +424,6 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev) "iscsi_host_alloc failed\n");return NULL ; } - shost->dma_boundary = pcidev->dma_mask; shost->max_id =BE2_MAX_SESSIONS ; shost->max_channel =0 ; shost->max_cmd_len =BEISCSI_MAX_CMD_LEN ;
@@ -4398,9 +4397,9 @@ free_port: hba_free:if (phba->msix_enabled)pci_disable_msix (phba->pcidev); -iscsi_host_remove (phba->shost);pci_dev_put (phba->pcidev);iscsi_host_free (phba->shost); +pci_set_drvdata (pcidev,NULL ); disable_pci:pci_disable_device (pcidev);return ret;
drivers/scsi/libsas/sas_discover.c +4 -2
@@ -336,14 +336,16 @@ static void sas_revalidate_domain(struct work_struct *work)struct sas_discovery_event *ev = container_of(work, struct sas_discovery_event, work);struct asd_sas_port *port = ev->port; +struct domain_device *ddev = port->port_dev;sas_begin_event (DISCE_REVALIDATE_DOMAIN , &port->disc.disc_event_lock, &port->disc.pending);SAS_DPRINTK ("REVALIDATING DOMAIN on port %d, pid:%d\n" , port->id,task_pid_nr (current)); -if (port->port_dev) - res =sas_ex_revalidate_domain (port->port_dev); +if (ddev && (ddev->dev_type ==FANOUT_DEV || + ddev->dev_type ==EDGE_DEV )) + res =sas_ex_revalidate_domain (ddev);SAS_DPRINTK ("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n" , port->id,task_pid_nr (current), res);
drivers/scsi/scsi_lib.c +3 -1
@@ -1206,9 +1206,11 @@ int scsi_prep_state_check(struct scsi_device *sdev, struct request *req) "rejecting I/O to dead device\n"); ret =BLKPREP_KILL ;break ; -case SDEV_QUIESCE :case SDEV_BLOCK :case SDEV_CREATED_BLOCK : + ret =BLKPREP_DEFER ; +break ; +case SDEV_QUIESCE :/* * If the devices is blocked we defer normal commands. */
drivers/scsi/sg.c +3 -3
@@ -498,7 +498,7 @@ static ssize_t sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) {sg_io_hdr_t *hp = &srp->header; -int err =0 ; +int err =0 , err2;int len;if (count <SZ_SG_IO_HDR ) {
@@ -527,8 +527,8 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) goto err_out; } err_out: - err =sg_finish_rem_req (srp); -return (0 == err) ? count : err; + err2 =sg_finish_rem_req (srp); +return err ? : err2 ? : count; } static ssize_t
drivers/spi/spi-dw-mid.c +6 -0
@@ -155,6 +155,9 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)1 ,DMA_TO_DEVICE , DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP); +if (!txdesc) +return NULL ; + txdesc->callback = dw_spi_dma_done; txdesc->callback_param = dws;
@@ -177,6 +180,9 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change)1 ,DMA_FROM_DEVICE , DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP); +if (!rxdesc) +return NULL ; + rxdesc->callback = dw_spi_dma_done; rxdesc->callback_param = dws;
drivers/spi/spi-dw.c +2 -2
@@ -786,13 +786,13 @@ static void spi_hw_init(struct dw_spi *dws)*/ if (!dws->fifo_len) {u32 fifo; -for (fifo =2 ; fifo <=256 ; fifo++) { +for (fifo =1 ; fifo <256 ; fifo++) {dw_writew (dws,DW_SPI_TXFLTR , fifo);if (fifo !=dw_readw (dws,DW_SPI_TXFLTR ))break ; } - dws->fifo_len = (fifo ==2 ) ?0 : fifo -1 ; + dws->fifo_len = (fifo ==1 ) ?0 : fifo;dw_writew (dws,DW_SPI_TXFLTR ,0 ); } }
drivers/spi/spidev.c +4 -1
@@ -241,7 +241,10 @@ static int spidev_message(struct spidev_data *spidev, k_tmp->len = u_tmp->len; total += k_tmp->len; -if (total > bufsiz) { +/* Check total length of transfers. Also check each +* transfer length to avoid arithmetic overflow. +*/ +if (total > bufsiz || k_tmp->len > bufsiz) { status = -EMSGSIZE ; goto done; }
drivers/staging/comedi/comedi_compat32.c +10 -2
@@ -271,7 +271,7 @@ static int compat_cmd(struct file *file, unsigned long arg) {struct comedi_cmd __user *cmd;struct comedi32_cmd_struct __user *cmd32; -int rc; +int rc, err; cmd32 =compat_ptr (arg); cmd =compat_alloc_user_space (sizeof (*cmd));
@@ -280,7 +280,15 @@ static int compat_cmd(struct file *file, unsigned long arg)if (rc)return rc; -return translated_ioctl (file,COMEDI_CMD , (unsigned long )cmd); + rc =translated_ioctl (file,COMEDI_CMD , (unsigned long )cmd); +if (rc == -EAGAIN ) { +/* Special case: copy cmd back to user. */ + err =put_compat_cmd (cmd32, cmd); +if (err) + rc = err; + } + +return rc; }/* Handle 32-bit COMEDI_CMDTEST ioctl. */
drivers/staging/iio/imu/adis16400_core.c +2 -1
@@ -25,6 +25,7 @@#include <linux/sysfs.h> #include <linux/list.h> #include <linux/module.h> +#include <linux/bitops.h> #include "../iio.h" #include "../sysfs.h"
@@ -541,7 +542,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,mutex_unlock (&indio_dev->mlock);if (ret)return ret; - val16 = ((val16 &0xFFF ) <<4 ) >>4 ; + val16 =sign_extend32 (val16,11 ); *val = val16;return IIO_VAL_INT ;case (1 <<IIO_CHAN_INFO_OFFSET_SEPARATE ):
drivers/staging/iio/industrialio-core.c +2 -0
@@ -711,6 +711,7 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev)iio_device_remove_and_free_read_attr (indio_dev, p); }kfree (indio_dev->chan_attr_group.attrs); + indio_dev->chan_attr_group.attrs =NULL ; }static const char *const iio_ev_type_text[] = {
@@ -986,6 +987,7 @@ static int iio_device_register_eventset(struct iio_dev *indio_dev) error_free_setup_event_lines:__iio_remove_event_config_attrs (indio_dev);kfree (indio_dev->event_interface); + indio_dev->event_interface =NULL ; error_ret:return ret;
drivers/staging/vt6655/rf.c +1 -0
@@ -1029,6 +1029,7 @@ unsigned char byPwrdBm = 0;break ;case RATE_6M :case RATE_9M : +case RATE_12M :case RATE_18M : byPwr = pDevice->abyOFDMPwrTbl[uCH];if (pDevice->byRFType ==RF_UW2452 ) {
drivers/target/iscsi/iscsi_target_tq.c +5 -25
@@ -26,36 +26,22 @@#include "iscsi_target_tq.h" #include "iscsi_target.h" -static LIST_HEAD (active_ts_list);static LIST_HEAD (inactive_ts_list); -static DEFINE_SPINLOCK (active_ts_lock);static DEFINE_SPINLOCK (inactive_ts_lock);static DEFINE_SPINLOCK (ts_bitmap_lock); -static void iscsi_add_ts_to_active_list (struct iscsi_thread_set *ts) -{ -spin_lock (&active_ts_lock); -list_add_tail (&ts->ts_list, &active_ts_list); - iscsit_global->active_ts++; -spin_unlock (&active_ts_lock); -} -extern void iscsi_add_ts_to_inactive_list (struct iscsi_thread_set *ts) { +if (!list_empty (&ts->ts_list)) { +WARN_ON (1 ); +return ; + }spin_lock (&inactive_ts_lock);list_add_tail (&ts->ts_list, &inactive_ts_list); iscsit_global->inactive_ts++;spin_unlock (&inactive_ts_lock); } -static void iscsi_del_ts_from_active_list (struct iscsi_thread_set *ts) -{ -spin_lock (&active_ts_lock); -list_del (&ts->ts_list); - iscsit_global->active_ts--; -spin_unlock (&active_ts_lock); -} -static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list (void ) {struct iscsi_thread_set *ts;
@@ -69,7 +55,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void)list_for_each_entry (ts, &inactive_ts_list, ts_list)break ; -list_del (&ts->ts_list); +list_del_init (&ts->ts_list); iscsit_global->inactive_ts--;spin_unlock (&inactive_ts_lock);
@@ -220,8 +206,6 @@ static void iscsi_deallocate_extra_thread_sets(void)void iscsi_activate_thread_set (struct iscsi_conn *conn,struct iscsi_thread_set *ts) { -iscsi_add_ts_to_active_list (ts); -spin_lock_bh (&ts->ts_state_lock); conn->thread_set = ts; ts->conn = conn;
@@ -424,7 +408,6 @@ struct iscsi_conn *iscsi_rx_thread_pre_handler(struct iscsi_thread_set *ts)if (ts->delay_inactive && (--ts->thread_count ==0 )) {spin_unlock_bh (&ts->ts_state_lock); -iscsi_del_ts_from_active_list (ts);if (!iscsit_global->in_shutdown)iscsi_deallocate_extra_thread_sets ();
@@ -477,7 +460,6 @@ struct iscsi_conn *iscsi_tx_thread_pre_handler(struct iscsi_thread_set *ts)if (ts->delay_inactive && (--ts->thread_count ==0 )) {spin_unlock_bh (&ts->ts_state_lock); -iscsi_del_ts_from_active_list (ts);if (!iscsit_global->in_shutdown)iscsi_deallocate_extra_thread_sets ();
@@ -536,10 +518,8 @@ int iscsi_thread_set_init(void)return -ENOMEM ; } -spin_lock_init (&active_ts_lock);spin_lock_init (&inactive_ts_lock);spin_lock_init (&ts_bitmap_lock); -INIT_LIST_HEAD (&active_ts_list);INIT_LIST_HEAD (&inactive_ts_list);return 0 ;
drivers/target/target_core_pscsi.c +1 -1
@@ -1168,7 +1168,7 @@ static u32 pscsi_get_device_type(struct se_device *dev)struct pscsi_dev_virt *pdv = dev->dev_ptr;struct scsi_device *sd = pdv->pdv_sd; -return sd->type; +return (sd) ? sd->type :TYPE_NO_LUN ; }static sector_t pscsi_get_blocks (struct se_device *dev)
drivers/target/tcm_fc/tfc_io.c +2 -1
@@ -335,7 +335,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd) ep =fc_seq_exch (seq);if (ep) { lport = ep->lp; -if (lport && (ep->xid <= lport->lro_xid)) +if (lport && (ep->xid <= lport->lro_xid)) {/* * "ddp_done" trigger invalidation of HW * specific DDP context
@@ -350,6 +350,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd)* identified using ep->xid) */ cmd->was_ddp_setup =0 ; + } } } }
drivers/tty/pty.c +3 -0
@@ -175,6 +175,9 @@ static int pty_signal(struct tty_struct *tty, int sig)unsigned long flags;struct pid *pgrp; +if (sig !=SIGINT && sig !=SIGQUIT && sig !=SIGTSTP ) +return -EINVAL ; +if (tty->link) {spin_lock_irqsave (&tty->link->ctrl_lock, flags); pgrp =get_pid (tty->link->pgrp);
drivers/tty/serial/8250_pci.c +1 -1
@@ -67,7 +67,7 @@ static void moan_device(const char *str, struct pci_dev *dev)"Please send the output of lspci -vv, this\n" "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" "manufacturer and name of serial board or\n" -"modem board to [email protected].\n" , +"modem board to <[email protected]>.\n" ,pci_name (dev), str, dev->vendor, dev->device, dev->subsystem_vendor, dev->subsystem_device); }
drivers/tty/tty_io.c +2 -2
@@ -943,8 +943,8 @@ EXPORT_SYMBOL(start_tty);/* We limit tty time update visibility to every 8 seconds or so. */ static void tty_update_time (struct timespec *time) { -unsigned long sec =get_seconds () & ~7 ; -if ((long )(sec - time->tv_sec) >0 ) +unsigned long sec =get_seconds (); +if (abs (sec - time->tv_sec) & ~7 ) time->tv_sec = sec; }
drivers/tty/tty_ioctl.c +9 -3
@@ -154,11 +154,17 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout)#endif if (!timeout) timeout =MAX_SCHEDULE_TIMEOUT ; +if (wait_event_interruptible_timeout (tty->write_wait, - !tty_chars_in_buffer (tty), timeout) >=0 ) { -if (tty->ops->wait_until_sent) - tty->ops->wait_until_sent (tty, timeout); + !tty_chars_in_buffer (tty), timeout) <0 ) { +return ; } + +if (timeout ==MAX_SCHEDULE_TIMEOUT ) + timeout =0 ; + +if (tty->ops->wait_until_sent) + tty->ops->wait_until_sent (tty, timeout); }EXPORT_SYMBOL (tty_wait_until_sent);
drivers/tty/vt/vt.c +3 -1
@@ -499,6 +499,7 @@ void invert_screen(struct vc_data *vc, int offset, int count, int viewed)#endif if (DO_UPDATE (vc))do_update_region (vc, (unsigned long ) p, count); +notify_update (vc); }/* used by selection: complement pointer position */
@@ -515,6 +516,7 @@ void complement_pos(struct vc_data *vc, int offset)scr_writew (old,screenpos (vc, old_offset,1 ));if (DO_UPDATE (vc)) vc->vc_sw->con_putc (vc, old, oldy, oldx); +notify_update (vc); } old_offset = offset;
@@ -532,8 +534,8 @@ void complement_pos(struct vc_data *vc, int offset) oldy = (offset >>1 ) / vc->vc_cols; vc->vc_sw->con_putc (vc, new, oldy, oldx); } +notify_update (vc); } - }static void insert_char (struct vc_data *vc,unsigned int nr)
drivers/usb/class/cdc-acm.c +16 -5
@@ -911,6 +911,7 @@ static int acm_probe(struct usb_interface *intf,unsigned long quirks;int num_rx_buf;int i; +unsigned int elength =0 ;int combined_interfaces =0 ;/* normal quirks */
@@ -950,9 +951,12 @@ static int acm_probe(struct usb_interface *intf,dev_err (&intf->dev,"skipping garbage\n" ); goto next_desc; } + elength = buffer[0 ];switch (buffer[2 ]) {case USB_CDC_UNION_TYPE :/* we've found it */ +if (elength <sizeof (struct usb_cdc_union_desc )) + goto next_desc;if (union_header) {dev_err (&intf->dev,"More than one " "union descriptor, skipping ...\n" );
@@ -961,31 +965,38 @@ static int acm_probe(struct usb_interface *intf, union_header = (struct usb_cdc_union_desc *)buffer;break ;case USB_CDC_COUNTRY_TYPE :/* export through sysfs*/ +if (elength <sizeof (struct usb_cdc_country_functional_desc )) + goto next_desc; cfd = (struct usb_cdc_country_functional_desc *)buffer;break ;case USB_CDC_HEADER_TYPE :/* maybe check version */ break ;/* for now we ignore it */ case USB_CDC_ACM_TYPE : +if (elength <4 ) + goto next_desc; ac_management_function = buffer[3 ];break ;case USB_CDC_CALL_MANAGEMENT_TYPE : +if (elength <5 ) + goto next_desc; call_management_function = buffer[3 ]; call_interface_num = buffer[4 ];if ( (quirks &NOT_A_MODEM ) ==0 && (call_management_function &3 ) !=3 )dev_err (&intf->dev,"This device cannot do calls on its own. It is not a modem.\n" );break ;default : -/* there are LOTS more CDC descriptors that +/* +* there are LOTS more CDC descriptors that * could legitimately be found here. */ dev_dbg (&intf->dev,"Ignoring descriptor: " -"type %02x, length %d\n" , - buffer[2 ], buffer[0 ]); +"type %02x, length %ud\n" , + buffer[2 ], elength);break ; } next_desc: - buflen -= buffer[0 ]; - buffer += buffer[0 ]; + buflen -= elength; + buffer += elength; }if (!union_header) {
drivers/usb/core/buffer.c +17 -9
@@ -22,17 +22,25 @@*/ /* FIXME tune these based on pool statistics ... */ -static const size_t pool_max[HCD_BUFFER_POOLS ] = { -/* platforms without dma-friendly caches might need to -* prevent cacheline sharing... -*/ -32 , -128 , -512 , -PAGE_SIZE /2 -/* bigger --> allocate pages */ +static size_t pool_max[HCD_BUFFER_POOLS ] = { +32 ,128 ,512 ,2048 , }; +void __init usb_init_pool_max (void ) +{ +/* +* The pool_max values must never be smaller than +* ARCH_KMALLOC_MINALIGN. +*/ +if (ARCH_KMALLOC_MINALIGN <=32 ) + ;/* Original value is okay */ +else if (ARCH_KMALLOC_MINALIGN <=64 ) + pool_max[0 ] =64 ; +else if (ARCH_KMALLOC_MINALIGN <=128 ) + pool_max[0 ] =0 ;/* Don't use this pool */ +else +BUILD_BUG ();/* We don't allow this */ +}/* SETUP primitives */
drivers/usb/core/devio.c +2 -0
@@ -406,6 +406,7 @@ static void async_completed(struct urb *urb) as->status = urb->status; signr = as->signr;if (signr) { +memset (&sinfo,0 ,sizeof (sinfo)); sinfo.si_signo = as->signr; sinfo.si_errno = as->status; sinfo.si_code =SI_ASYNCIO ;
@@ -2031,6 +2032,7 @@ static void usbdev_remove(struct usb_device *udev)wake_up_all (&ps->wait);list_del_init (&ps->list);if (ps->discsignr) { +memset (&sinfo,0 ,sizeof (sinfo)); sinfo.si_signo = ps->discsignr; sinfo.si_errno =EPIPE ; sinfo.si_code =SI_ASYNCIO ;
drivers/usb/core/driver.c +12 -0
@@ -1664,6 +1664,18 @@ static int autosuspend_check(struct usb_device *udev)dev_dbg (&udev->dev,"remote wakeup needed for autosuspend\n" );return -EOPNOTSUPP ; } + +/* +* If the device is a direct child of the root hub and the HCD +* doesn't handle wakeup requests, don't allow autosuspend when +* wakeup is needed. +*/ +if (w && udev->parent == udev->bus->root_hub && +bus_to_hcd (udev->bus)->cant_recv_wakeups) { +dev_dbg (&udev->dev,"HCD doesn't handle wakeup requests\n" ); +return -EOPNOTSUPP ; + } + udev->do_remote_wakeup = w;return 0 ; }
drivers/usb/core/hcd.c +8 -8
@@ -1542,6 +1542,7 @@ static int unlink1(struct usb_hcd *hcd, struct urb *urb, int status)int usb_hcd_unlink_urb (struct urb *urb,int status) {struct usb_hcd *hcd; +struct usb_device *udev = urb->dev;int retval = -EIDRM ;unsigned long flags;
@@ -1553,20 +1554,19 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)spin_lock_irqsave (&hcd_urb_unlink_lock, flags);if (atomic_read (&urb->use_count) >0 ) { retval =0 ; -usb_get_dev (urb->dev); +usb_get_dev (udev); }spin_unlock_irqrestore (&hcd_urb_unlink_lock, flags);if (retval ==0 ) { hcd =bus_to_hcd (urb->dev->bus); retval =unlink1 (hcd, urb, status); -usb_put_dev (urb->dev); +if (retval ==0 ) + retval = -EINPROGRESS ; +else if (retval != -EIDRM && retval != -EBUSY ) +dev_dbg (&udev->dev,"hcd_unlink_urb %p fail %d\n" , + urb, retval); +usb_put_dev (udev); } - -if (retval ==0 ) - retval = -EINPROGRESS ; -else if (retval != -EIDRM && retval != -EBUSY ) -dev_dbg (&urb->dev->dev,"hcd_unlink_urb %p fail %d\n" , - urb, retval);return retval; }
drivers/usb/core/usb.c +1 -0
@@ -1010,6 +1010,7 @@ static int __init usb_init(void)pr_info ("%s: USB support disabled\n" , usbcore_name);return 0 ; } +usb_init_pool_max (); retval =usb_debugfs_init ();if (retval)
drivers/usb/gadget/inode.c +13 -2
@@ -570,6 +570,7 @@ static ssize_t ep_aio_read_retry(struct kiocb *iocb)break ; }kfree (priv->buf); +kfree (priv->iv);kfree (priv);return len; }
@@ -591,6 +592,7 @@ static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req)*/ if (priv->iv ==NULL ||unlikely (req->actual ==0 )) {kfree (req->buf); +kfree (priv->iv);kfree (priv); iocb->private =NULL ;/* aio_complete() reports bytes-transferred _and_ faults */
@@ -626,7 +628,7 @@ ep_aio_rwtail(struct usb_request *req;ssize_t value; - priv =kmalloc (sizeof *priv,GFP_KERNEL ); + priv =kzalloc (sizeof *priv,GFP_KERNEL );if (!priv) { value = -ENOMEM ; fail:
@@ -634,11 +636,19 @@ fail:return value; } iocb->private = priv; - priv->iv = iv; +if (iv) { + priv->iv =kmemdup (iv, nr_segs *sizeof (struct iovec ), +GFP_KERNEL ); +if (!priv->iv) { +kfree (priv); + goto fail; + } + } priv->nr_segs = nr_segs; value =get_ready_ep (iocb->ki_filp->f_flags, epdata);if (unlikely (value <0 )) { +kfree (priv->iv);kfree (priv); goto fail; }
@@ -672,6 +682,7 @@ fail:mutex_unlock (&epdata->lock);if (unlikely (value)) { +kfree (priv->iv);kfree (priv);put_ep (epdata); }else
drivers/usb/host/isp1760-hcd.c +3 -0
@@ -2254,6 +2254,9 @@ struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, hcd->rsrc_start = res_start; hcd->rsrc_len = res_len; +/* This driver doesn't support wakeup requests */ + hcd->cant_recv_wakeups =1 ; + ret =usb_add_hcd (hcd, irq, irqflags);if (ret) goto err_unmap;
drivers/usb/host/xhci-hub.c +8 -1
@@ -385,6 +385,10 @@ static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue, status =PORT_PLC ; port_change_bit ="link state" ;break ; +case USB_PORT_FEAT_C_PORT_CONFIG_ERROR : + status =PORT_CEC ; + port_change_bit ="config error" ; +break ;default :/* Should never happen */ return ;
@@ -592,6 +596,8 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, status |=USB_PORT_STAT_C_LINK_STATE <<16 ;if ((temp &PORT_WRC )) status |=USB_PORT_STAT_C_BH_RESET <<16 ; +if ((temp &PORT_CEC )) + status |=USB_PORT_STAT_C_CONFIG_ERROR <<16 ; }if (hcd->speed !=HCD_USB3 ) {
@@ -868,6 +874,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,case USB_PORT_FEAT_C_OVER_CURRENT :case USB_PORT_FEAT_C_ENABLE :case USB_PORT_FEAT_C_PORT_LINK_STATE : +case USB_PORT_FEAT_C_PORT_CONFIG_ERROR :xhci_clear_port_change_bit (xhci, wValue, wIndex, port_array[wIndex], temp);break ;
@@ -916,7 +923,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)memset (buf,0 , retval); status =0 ; - mask =PORT_CSC |PORT_PEC |PORT_OCC |PORT_PLC |PORT_WRC ; + mask =PORT_CSC |PORT_PEC |PORT_OCC |PORT_PLC |PORT_WRC |PORT_CEC ;spin_lock_irqsave (&xhci->lock, flags);/* For each port, did anything change? If so, set that bit in buf. */
drivers/usb/host/xhci-pci.c +32 -1
@@ -36,6 +36,9 @@#define PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI 0x8c31#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI 0x9c31 +#define PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI 0x22b5 +#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI 0xa12f +#define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI 0x9d2fstatic const char hcd_name[] ="xhci_hcd" ;
@@ -102,6 +105,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)if (pdev->vendor ==PCI_VENDOR_ID_AMD ) xhci->quirks |=XHCI_TRUST_TX_LENGTH ; +if (pdev->vendor ==PCI_VENDOR_ID_INTEL ) + xhci->quirks |=XHCI_AVOID_BEI ;if (pdev->vendor ==PCI_VENDOR_ID_INTEL && pdev->device ==PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI ) { xhci->quirks |=XHCI_EP_LIMIT_QUIRK ;
@@ -116,7 +121,12 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)* PPT chipsets. */ xhci->quirks |=XHCI_SPURIOUS_REBOOT ; - xhci->quirks |=XHCI_AVOID_BEI ; + } +if (pdev->vendor ==PCI_VENDOR_ID_INTEL && + (pdev->device ==PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || + pdev->device ==PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || + pdev->device ==PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI )) { + xhci->quirks |=XHCI_PME_STUCK_QUIRK ; }if (pdev->vendor ==PCI_VENDOR_ID_ETRON && pdev->device ==PCI_DEVICE_ID_ASROCK_P67 ) {
@@ -128,6 +138,21 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |=XHCI_RESET_ON_RESUME ; } +/* +* Make sure PME works on some Intel xHCI controllers by writing 1 to clear +* the Internal PME flag bit in vendor specific PMCTRL register at offset 0x80a4 +*/ +static void xhci_pme_quirk (struct xhci_hcd *xhci) +{ +u32 val; +void __iomem *reg; + + reg = (void __iomem *) xhci->cap_regs +0x80a4 ; + val =readl (reg); +writel (val |BIT (28 ), reg); +readl (reg); +} +/* called during probe() after chip reset completes */ static int xhci_pci_setup (struct usb_hcd *hcd) {
@@ -235,6 +260,9 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) xhci->shared_hcd->state != HC_STATE_SUSPENDED)return -EINVAL ; +if (xhci->quirks &XHCI_PME_STUCK_QUIRK ) +xhci_pme_quirk (xhci); + retval =xhci_suspend (xhci, do_wakeup);return retval;
@@ -265,6 +293,9 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)if (usb_is_intel_switchable_xhci (pdev))usb_enable_xhci_ports (pdev); +if (xhci->quirks &XHCI_PME_STUCK_QUIRK ) +xhci_pme_quirk (xhci); + retval =xhci_resume (xhci, hibernated);return retval; }
drivers/usb/host/xhci-ring.c +8 -2
@@ -1980,7 +1980,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,if (event_trb != ep_ring->dequeue) {/* The event was for the status stage */ if (event_trb == td->last_trb) { -if (td->urb->actual_length !=0 ) { +if (td->urb_length_set) {/* Don't overwrite a previously set error code */ if ((*status == -EINPROGRESS || *status == 0) &&
@@ -1994,7 +1994,13 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, td->urb->transfer_buffer_length; } }else { -/* Maybe the event was for the data stage? */ +/* +* Maybe the event was for the data stage? If so, update +* already the actual_length of the URB and flag it as +* set, so that it is not overwritten in the event for +* the last TRB. +*/ + td->urb_length_set = true; td->urb->actual_length = td->urb->transfer_buffer_length -EVENT_TRB_LEN (le32_to_cpu (event->transfer_len));
drivers/usb/host/xhci.h +7 -2
@@ -1,3 +1,4 @@ +/* * xHCI host controller driver *
@@ -88,9 +89,10 @@ struct xhci_cap_regs {#define HCS_IST (p) (((p) >> 0) & 0xf)/* bits 4:7, max number of Event Ring segments */ #define HCS_ERST_MAX (p) (((p) >> 4) & 0xf) +/* bits 21:25 Hi 5 bits of Scratchpad buffers SW must allocate for the HW */ /* bit 26 Scratchpad restore - for save/restore HW state - not used yet */ -/* bits 27:31 number of Scratchpad buffers SW must allocate for the HW */ -#define HCS_MAX_SCRATCHPAD (p) (((p) >> 27) & 0x1f) +/* bits 27:31 Lo 5 bits of Scratchpad buffers SW must allocate for the HW */ +#define HCS_MAX_SCRATCHPAD (p) ((((p) >> 16) & 0x3e0) | (((p) >> 27) & 0x1f))/* HCSPARAMS3 - hcs_params3 - bitmasks */ /* bits 0:7, Max U1 to U0 latency for the roothub ports */
@@ -1255,6 +1257,8 @@ struct xhci_td {struct xhci_segment *start_seg;union xhci_trb *first_trb;union xhci_trb *last_trb; +/* actual_length of the URB has already been set */ +bool urb_length_set; };/* xHCI command default timeout value */
@@ -1493,6 +1497,7 @@ struct xhci_hcd {#define XHCI_AVOID_BEI (1 << 15)#define XHCI_SLOW_SUSPEND (1 << 17)#define XHCI_SPURIOUS_WAKEUP (1 << 18) +#define XHCI_PME_STUCK_QUIRK (1 << 20)unsigned int num_active_eps;unsigned int limit_active_eps;/* There are two roothubs to keep track of bus suspend info for */
drivers/usb/serial/Kconfig +2 -2
@@ -578,10 +578,10 @@ config USB_SERIAL_CYBERJACK If unsure, say N. config USB_SERIAL_XIRCOM - tristate "USB Xircom / Entregra Single Port Serial Driver" + tristate "USB Xircom / Entrega Single Port Serial Driver" select USB_EZUSB help - Say Y here if you want to use a Xircom or Entregra single port USB to + Say Y here if you want to use a Xircom or Entrega single port USB to serial converter device. This driver makes use of firmware developed from scratch by Brian Warner.
drivers/usb/serial/bus.c +11 -2
@@ -52,6 +52,7 @@ static int usb_serial_device_probe(struct device *dev) {struct usb_serial_driver *driver;struct usb_serial_port *port; +struct device *tty_dev;int retval =0 ;int minor;
@@ -73,12 +74,20 @@ static int usb_serial_device_probe(struct device *dev) retval =device_create_file (dev, &dev_attr_port_number);if (retval) {if (driver->port_remove) - retval = driver->port_remove (port); + driver->port_remove (port); goto exit; } minor = port->number; -tty_register_device (usb_serial_tty_driver, minor, dev); + tty_dev =tty_register_device (usb_serial_tty_driver, minor, dev); +if (IS_ERR (tty_dev)) { + retval =PTR_ERR (tty_dev); +device_remove_file (dev, &dev_attr_port_number); +if (driver->port_remove) + driver->port_remove (port); + goto exit; + } +dev_info (&port->serial->dev->dev,"%s converter now attached to ttyUSB%d\n" , driver->description, minor);
drivers/usb/serial/cp210x.c +3 -0
@@ -63,6 +63,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x0846, 0x1100) }, /* NetGear Managed Switch M4100 series, M5300 series, M7100 series */ { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */ + { USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console */ { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */ { USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */ { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */
@@ -152,6 +153,8 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */ { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */ { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */ + { USB_DEVICE(0x16C0, 0x09B0) }, /* Lunatico Seletek */ + { USB_DEVICE(0x16C0, 0x09B1) }, /* Lunatico Seletek */ { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */
drivers/usb/serial/ftdi_sio.c +26 -2
@@ -628,6 +628,7 @@ static struct usb_device_id id_table_combined [] = { .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, + { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, /* * ELV devices: */
@@ -823,6 +824,8 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, + { USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID), + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID),
@@ -1000,6 +1003,23 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) },/* GE Healthcare devices */ { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, +/* Active Research (Actisense) devices */ + { USB_DEVICE(FTDI_VID, ACTISENSE_NDC_PID) }, + { USB_DEVICE(FTDI_VID, ACTISENSE_USG_PID) }, + { USB_DEVICE(FTDI_VID, ACTISENSE_NGT_PID) }, + { USB_DEVICE(FTDI_VID, ACTISENSE_NGW_PID) }, + { USB_DEVICE(FTDI_VID, ACTISENSE_D9AC_PID) }, + { USB_DEVICE(FTDI_VID, ACTISENSE_D9AD_PID) }, + { USB_DEVICE(FTDI_VID, ACTISENSE_D9AE_PID) }, + { USB_DEVICE(FTDI_VID, ACTISENSE_D9AF_PID) }, + { USB_DEVICE(FTDI_VID, CHETCO_SEAGAUGE_PID) }, + { USB_DEVICE(FTDI_VID, CHETCO_SEASWITCH_PID) }, + { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_NMEA2000_PID) }, + { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ETHERNET_PID) }, + { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_WIFI_PID) }, + { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) }, + { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) }, + { USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) }, { }, /* Optional parameter entry */ { } /* Terminating entry */ };
@@ -1927,8 +1947,12 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial)dbg ("%s" , __func__); -if ((udev->manufacturer && !strcmp (udev->manufacturer,"CALAO Systems" )) || - (udev->product && !strcmp (udev->product,"BeagleBone/XDS100V2" ))) +if (udev->manufacturer && !strcmp (udev->manufacturer,"CALAO Systems" )) +return ftdi_jtag_probe (serial); + +if (udev->product && + (!strcmp (udev->product,"BeagleBone/XDS100V2" ) || + !strcmp (udev->product,"SNAP Connect E10" )))return ftdi_jtag_probe (serial);return 0 ;
drivers/usb/serial/ftdi_sio_ids.h +29 -0
@@ -38,6 +38,9 @@#define FTDI_LUMEL_PD12_PID 0x6002 +/* Cyber Cortex AV by Fabulous Silicon (http://fabuloussilicon.com) */ +#define CYBER_CORTEX_AV_PID 0x8698 +/* * Marvell OpenRD Base, Client * http://www.open-rd.org
@@ -558,6 +561,12 @@*/ #define FTDI_NT_ORIONLXM_PID 0x7c90/* OrionLXm Substation Automation Platform */ +/* +* Synapse Wireless product ids (FTDI_VID) +* http://www.synapse-wireless.com +*/ +#define FTDI_SYNAPSE_SS200_PID 0x9090/* SS200 - SNAP Stick 200 */ +/********************************/ /** third-party VID/PID combos **/
@@ -1432,3 +1441,23 @@*/ #define GE_HEALTHCARE_VID 0x1901#define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015 + +/* +* Active Research (Actisense) devices +*/ +#define ACTISENSE_NDC_PID 0xD9A8/* NDC USB Serial Adapter */ +#define ACTISENSE_USG_PID 0xD9A9/* USG USB Serial Adapter */ +#define ACTISENSE_NGT_PID 0xD9AA/* NGT NMEA2000 Interface */ +#define ACTISENSE_NGW_PID 0xD9AB/* NGW NMEA2000 Gateway */ +#define ACTISENSE_D9AC_PID 0xD9AC/* Actisense Reserved */ +#define ACTISENSE_D9AD_PID 0xD9AD/* Actisense Reserved */ +#define ACTISENSE_D9AE_PID 0xD9AE/* Actisense Reserved */ +#define ACTISENSE_D9AF_PID 0xD9AF/* Actisense Reserved */ +#define CHETCO_SEAGAUGE_PID 0xA548/* SeaGauge USB Adapter */ +#define CHETCO_SEASWITCH_PID 0xA549/* SeaSwitch USB Adapter */ +#define CHETCO_SEASMART_NMEA2000_PID 0xA54A/* SeaSmart NMEA2000 Gateway */ +#define CHETCO_SEASMART_ETHERNET_PID 0xA54B/* SeaSmart Ethernet Gateway */ +#define CHETCO_SEASMART_WIFI_PID 0xA5AC/* SeaSmart Wifi Gateway */ +#define CHETCO_SEASMART_DISPLAY_PID 0xA5AD/* SeaSmart NMEA2000 Display */ +#define CHETCO_SEASMART_LITE_PID 0xA5AE/* SeaSmart Lite USB Adapter */ +#define CHETCO_SEASMART_ANALOG_PID 0xA5AF/* SeaSmart Analog Adapter */
drivers/usb/serial/keyspan_pda.c +11 -8
@@ -1,5 +1,5 @@/* -* USB Keyspan PDA / Xircom / Entregra Converter driver +* USB Keyspan PDA / Xircom / Entrega Converter driver * * Copyright (C) 1999 - 2001 Greg Kroah-Hartman <[email protected]> * Copyright (C) 1999, 2000 Brian Warner <[email protected]>
@@ -119,11 +119,12 @@ struct keyspan_pda_private {#define KEYSPAN_PDA_FAKE_ID 0x0103#define KEYSPAN_PDA_ID 0x0104/* no clue */ -/* For Xircom PGSDB9 and older Entregra version of the same device */ +/* For Xircom PGSDB9 and older Entrega version of the same device */ #define XIRCOM_VENDOR_ID 0x085a#define XIRCOM_FAKE_ID 0x8027 -#define ENTREGRA_VENDOR_ID 0x1645 -#define ENTREGRA_FAKE_ID 0x8093 +#define XIRCOM_FAKE_ID_2 0x8025/* "PGMFHUB" serial */ +#define ENTREGA_VENDOR_ID 0x1645 +#define ENTREGA_FAKE_ID 0x8093static const struct usb_device_id id_table_combined[] = { #ifdef KEYSPAN
@@ -131,7 +132,8 @@ static const struct usb_device_id id_table_combined[] = {#endif #ifdef XIRCOM { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) }, - { USB_DEVICE(ENTREGRA_VENDOR_ID, ENTREGRA_FAKE_ID) }, + { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID_2) }, + { USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) }, #endif { USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) }, { } /* Terminating entry */
@@ -162,7 +164,8 @@ static const struct usb_device_id id_table_fake[] = {#ifdef XIRCOM static const struct usb_device_id id_table_fake_xircom[] = { {USB_DEVICE (XIRCOM_VENDOR_ID ,XIRCOM_FAKE_ID ) }, - {USB_DEVICE (ENTREGRA_VENDOR_ID ,ENTREGRA_FAKE_ID ) }, + {USB_DEVICE (XIRCOM_VENDOR_ID ,XIRCOM_FAKE_ID_2 ) }, + {USB_DEVICE (ENTREGA_VENDOR_ID ,ENTREGA_FAKE_ID ) }, { } };#endif
@@ -757,7 +760,7 @@ static int keyspan_pda_fake_startup(struct usb_serial *serial)#endif #ifdef XIRCOM else if ((le16_to_cpu(serial->dev->descriptor.idVendor) == XIRCOM_VENDOR_ID) || - (le16_to_cpu(serial->dev->descriptor.idVendor) == ENTREGRA_VENDOR_ID)) + (le16_to_cpu(serial->dev->descriptor.idVendor) == ENTREGA_VENDOR_ID)) fw_name ="keyspan_pda/xircom_pgs.fw" ;#endif else {
@@ -848,7 +851,7 @@ static struct usb_serial_driver xircom_pgs_fake_device = { .owner = THIS_MODULE, .name = "xircom_no_firm", }, - .description = "Xircom / Entregra PGS - (prerenumeration)", + .description = "Xircom / Entrega PGS - (prerenumeration)", .usb_driver = &keyspan_pda_driver, .id_table = id_table_fake_xircom, .num_ports = 1,
drivers/xen/manage.c +7 -1
@@ -110,10 +110,16 @@ static void do_suspend(void) err =freeze_processes ();if (err) { -printk (KERN_ERR "xen suspend: freeze failed %d\n" , err); +pr_err ("%s: freeze processes failed %d\n" , __func__, err); goto out; } + err =freeze_kernel_threads (); +if (err) { +pr_err ("%s: freeze kernel threads failed %d\n" , __func__, err); + goto out_thaw; + } + err =dpm_suspend_start (PMSG_FREEZE );if (err) {printk (KERN_ERR "xen suspend: dpm_suspend_start %d\n" , err);
drivers/xen/xen-pciback/conf_space.c +1 -1
@@ -16,7 +16,7 @@#include "conf_space.h" #include "conf_space_quirks.h" -static int permissive; +bool permissive;module_param (permissive, bool,0644 );/* This is where xen_pcibk_read_config_byte, xen_pcibk_read_config_word,
drivers/xen/xen-pciback/conf_space.h +2 -0
@@ -64,6 +64,8 @@ struct config_field_entry {void *data; }; +extern bool permissive; +#define OFFSET (cfg_entry) ((cfg_entry)->base_offset+(cfg_entry)->field->offset)/* Add fields to a device - the add_fields macro expects to get a pointer to
drivers/xen/xen-pciback/conf_space_header.c +48 -13
94 lines not on this page · raw message
fs/autofs4/dev-ioctl.c +9 -2
@@ -95,7 +95,7 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param)*/ static struct autofs_dev_ioctl *copy_dev_ioctl (struct autofs_dev_ioctl __user *in) { -struct autofs_dev_ioctl tmp; +struct autofs_dev_ioctl tmp, *res;if (copy_from_user (&tmp, in,sizeof (tmp)))return ERR_PTR (-EFAULT );
@@ -103,7 +103,14 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *iif (tmp.size <sizeof (tmp))return ERR_PTR (-EINVAL ); -return memdup_user (in, tmp.size); +if (tmp.size > (PATH_MAX +sizeof (tmp))) +return ERR_PTR (-ENAMETOOLONG ); + + res =memdup_user (in, tmp.size); +if (!IS_ERR (res)) + res->size = tmp.size; + +return res; }static inline void free_dev_ioctl (struct autofs_dev_ioctl *param)
fs/binfmt_elf.c +3 -2
@@ -542,11 +542,12 @@ out:static unsigned long randomize_stack_top (unsigned long stack_top) { -unsigned int random_variable =0 ; +unsigned long random_variable =0 ;if ((current->flags &PF_RANDOMIZE ) && !(current->personality &ADDR_NO_RANDOMIZE )) { - random_variable =get_random_int () &STACK_RND_MASK ; + random_variable = (unsigned long )get_random_int (); + random_variable &=STACK_RND_MASK ; random_variable <<=PAGE_SHIFT ; }#ifdef CONFIG_STACK_GROWSUP
fs/cifs/file.c +1 -0
@@ -1608,6 +1608,7 @@ refind_writable:cifsFileInfo_put (inv_file);spin_lock (&cifs_file_list_lock); ++refind; + inv_file =NULL ; goto refind_writable; } }
fs/debugfs/inode.c +28 -18
62 lines not on this page · raw message
fs/ecryptfs/file.c +32 -4
@@ -307,9 +307,23 @@ ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (ecryptfs_file_to_private (file)) lower_file =ecryptfs_file_to_lower (file); -if (lower_file && lower_file->f_op && lower_file->f_op->unlocked_ioctl) +if (!(lower_file && lower_file->f_op && lower_file->f_op->unlocked_ioctl)) +return rc; + +switch (cmd) { +case FITRIM : +case FS_IOC_GETFLAGS : +case FS_IOC_SETFLAGS : +case FS_IOC_GETVERSION : +case FS_IOC_SETVERSION : rc = lower_file->f_op->unlocked_ioctl (lower_file, cmd, arg); -return rc; +fsstack_copy_attr_all (file->f_path.dentry->d_inode, + lower_file->f_path.dentry->d_inode); + +return rc; +default : +return rc; + } }#ifdef CONFIG_COMPAT
@@ -321,9 +335,23 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)if (ecryptfs_file_to_private (file)) lower_file =ecryptfs_file_to_lower (file); -if (lower_file && lower_file->f_op && lower_file->f_op->compat_ioctl) +if (!(lower_file && lower_file->f_op && lower_file->f_op->compat_ioctl)) +return rc; + +switch (cmd) { +case FITRIM : +case FS_IOC32_GETFLAGS : +case FS_IOC32_SETFLAGS : +case FS_IOC32_GETVERSION : +case FS_IOC32_SETVERSION : rc = lower_file->f_op->compat_ioctl (lower_file, cmd, arg); - return rc; +fsstack_copy_attr_all (file->f_path.dentry->d_inode, + lower_file->f_path.dentry->d_inode); + +return rc; +default : +return rc; + } }#endif
fs/exec.c +40 -25
82 lines not on this page · raw message
fs/fuse/dev.c +5 -2
@@ -717,8 +717,8 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep) newpage = buf->page; -if (WARN_ON (!PageUptodate (newpage))) -return -EIO ; +if (!PageUptodate (newpage)) +SetPageUptodate (newpage);ClearPageMappedToDisk (newpage);
@@ -1570,6 +1570,9 @@ copy_finish:static int fuse_notify (struct fuse_conn *fc,enum fuse_notify_code code,unsigned int size,struct fuse_copy_state *cs) { +/* Don't try to move pages (yet) */ + cs->move_pages =0 ; +switch (code) {case FUSE_NOTIFY_POLL :return fuse_notify_poll (fc, size, cs);
fs/hfsplus/brec.c +11 -9
@@ -130,13 +130,16 @@ skip:hfs_bnode_write (node, entry, data_off + key_len, entry_len);hfs_bnode_dump (node); -if (new_node) { -/* update parent key if we inserted a key -* at the start of the first node -*/ -if (!rec && new_node != node) -hfs_brec_update_parent (fd); +/* +* update parent key if we inserted a key +* at the start of the node and it is not the new node +*/ +if (!rec && new_node != node) { +hfs_bnode_read_key (node, fd->search_key, data_off + size); +hfs_brec_update_parent (fd); + } +if (new_node) {hfs_bnode_put (fd->bnode);if (!new_node->parent) {hfs_btree_inc_height (tree);
@@ -166,9 +169,6 @@ skip: goto again; } -if (!rec) -hfs_brec_update_parent (fd); -return 0 ; }
@@ -368,6 +368,8 @@ again:if (IS_ERR (parent))return PTR_ERR (parent);__hfs_brec_find (parent, fd); +if (fd->record <0 ) +return -ENOENT ;hfs_bnode_dump (parent); rec = fd->record;
fs/jffs2/scan.c +5 -0
@@ -503,6 +503,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo sumlen = c->sector_size -je32_to_cpu (sm->offset); sumptr = buf + buf_size - sumlen; +/* sm->offset maybe wrong but MAGIC maybe right */ +if (sumlen > c->sector_size) + goto full_scan; +/* Now, make sure the summary itself is available */ if (sumlen > buf_size) {/* Need to kmalloc for this. */
@@ -537,6 +541,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo } } +full_scan: buf_ofs = jeb->offset;if (!buf_size) {
fs/jfs/jfs_dtree.c +2 -2
@@ -3103,7 +3103,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)* self "." */ filp->f_pos =1 ; -if (filldir (dirent,"." ,1 ,0 , ip->i_ino, +if (filldir (dirent,"." ,1 ,1 , ip->i_ino,DT_DIR ))return 0 ; }
@@ -3111,7 +3111,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)* parent ".." */ filp->f_pos =2 ; -if (filldir (dirent,".." ,2 ,1 ,PARENT (ip),DT_DIR )) +if (filldir (dirent,".." ,2 ,2 ,PARENT (ip),DT_DIR ))return 0 ;/*
fs/nfs/callback.c +5 -3
@@ -149,22 +149,24 @@ nfs41_callback_svc(void *vrqstp)set_freezable ();while (!kthread_should_stop ()) { -prepare_to_wait (&serv->sv_cb_waitq, &wq,TASK_INTERRUPTIBLE ); +prepare_to_wait (&serv->sv_cb_waitq, &wq,TASK_UNINTERRUPTIBLE );spin_lock_bh (&serv->sv_cb_lock);if (!list_empty (&serv->sv_cb_list)) { req =list_first_entry (&serv->sv_cb_list, struct rpc_rqst, rq_bc_list);list_del (&req->rq_bc_list);spin_unlock_bh (&serv->sv_cb_lock); +finish_wait (&serv->sv_cb_waitq, &wq);dprintk ("Invoking bc_svc_process()\n" ); error =bc_svc_process (serv, req, rqstp);dprintk ("bc_svc_process() returned w/ error code= %d\n" , error); }else {spin_unlock_bh (&serv->sv_cb_lock); -schedule (); +/* schedule_timeout to game the hung task watchdog */ +schedule_timeout (60 *HZ ); +finish_wait (&serv->sv_cb_waitq, &wq); } -finish_wait (&serv->sv_cb_waitq, &wq); }return 0 ; }
fs/nfs/callback_xdr.c +3 -1
@@ -459,8 +459,10 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp,for (i =0 ; i < args->csa_nrclists; i++) { status =decode_rc_list (xdr, &args->csa_rclists[i]); -if (status) +if (status) { + args->csa_nrclists = i; goto out_free; + } } } status =0 ;
fs/nfs/delegation.c +1 -1
@@ -149,8 +149,8 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred, &delegation->flags);NFS_I (inode)->delegation_state = delegation->type;spin_unlock (&delegation->lock); -put_rpccred (oldcred);rcu_read_unlock (); +put_rpccred (oldcred); }else {/* We appear to have raced with a delegation return. */ spin_unlock (&delegation->lock);
fs/nilfs2/btree.c +44 -3
47 lines not on this page · raw message
include/net/netfilter/nf_conntrack_extend.h +2 -2
Lines of this file are not shown. View the raw message.
mm/hugetlb.c +54 -18
72 lines not on this page · raw message
net/ipv4/tcp_output.c +29 -25
54 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.