3.6.11.9-rc1-stable review
Subsystems (119)
Steven Rostedt
maintainerPATCH 149/251 zram: avoid access beyond the zram device
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
[ Upstream commit 12a7ad3b810e77137d0caf97a6dd97591e075b30 ]
Function valid_io_request() should verify the entire request are within the zram device address range. Otherwise it may cause invalid memory access when accessing/modifying zram->meta->table[index] because the 'index' is out of range. Then it may access non-exist memory, randomly modify memory belong to other subsystems, which is hard to track down.
--- drivers/staging/zram/zram_drv.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/staging/zram/zram_drv.c +12 -5
@@ -466,13 +466,20 @@ out:*/ static inline int valid_io_request (struct zram *zram,struct bio *bio) { -if (unlikely ( - (bio->bi_sector >= (zram->disksize >>SECTOR_SHIFT )) || - (bio->bi_sector & (ZRAM_SECTOR_PER_LOGICAL_BLOCK -1 )) || - (bio->bi_size & (ZRAM_LOGICAL_BLOCK_SIZE -1 )))) { +u64 start, end, bound; +/* unaligned request */ +if (unlikely (bio->bi_sector & (ZRAM_SECTOR_PER_LOGICAL_BLOCK -1 ))) +return 0 ; +if (unlikely (bio->bi_size & (ZRAM_LOGICAL_BLOCK_SIZE -1 ))) +return 0 ; + + start = bio->bi_sector; + end = start + (bio->bi_size >>SECTOR_SHIFT ); + bound = zram->disksize >>SECTOR_SHIFT ; +/* out of range range */ +if (unlikely (start >= bound || end >= bound || start > end))return 0 ; - }/* I/O request is valid */ return 1 ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 150/251 zram: protect sysfs handler from invalid memory access
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
[ Upstream commit 5863e10b441e7ea4b492f930f1be180a97d026f3 ]
Use zram->init_lock to protect access to zram->meta, otherwise it may cause invalid memory access if zram->meta has been freed by zram_reset_device().
This issue may be triggered by:
Thread 1:
while true; do cat mem_used_total; done
Thread 2:
while true; do echo 8M > disksize; echo 1 > reset; done
--- drivers/staging/zram/zram_sysfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/zram/zram_sysfs.c +2 -0
@@ -186,8 +186,10 @@ static ssize_t mem_used_total_show(struct device *dev,u64 val =0 ;struct zram *zram =dev_to_zram (dev); +down_read (&zram->init_lock);if (zram->init_done) val =zs_get_total_size_bytes (zram->mem_pool); +up_read (&zram->init_lock);return sprintf (buf,"%llu\n" , val); }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 151/251 ACPI / battery: Fix parsing _BIX return value
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Lan Tianyu <[email protected]>
[ Upstream commit 016d5baad04269e8559332df05f89bd95b52d6ad ]
The _BIX method returns extended battery info as a package. According the ACPI spec (ACPI 5, Section 10.2.2.2), the first member of that package should be "Revision". However, the current ACPI battery driver treats the first member as "Power Unit" which should be the second member. This causes the result of _BIX return data parsing to be incorrect.
Fix this by adding a new member called 'revision' to struct acpi_battery and adding the offsetof() information on it to extended_info_offsets[] as the first row.
References: http://bugzilla.kernel.org/show_bug.cgi?id=60519
--- drivers/acpi/battery.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/acpi/battery.c +2 -0
@@ -117,6 +117,7 @@ struct acpi_battery {struct acpi_device *device;struct notifier_block pm_nb;unsigned long update_time; +int revision;int rate_now;int capacity_now;int voltage_now;
@@ -359,6 +360,7 @@ static struct acpi_offsets info_offsets[] = { };static struct acpi_offsets extended_info_offsets[] = { + {offsetof(struct acpi_battery , revision),0 }, {offsetof(struct acpi_battery , power_unit),0 }, {offsetof(struct acpi_battery , design_capacity),0 }, {offsetof(struct acpi_battery , full_charge_capacity),0 },
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 152/251 fanotify: info leak in copy_event_to_user()
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit de1e0c40aceb9d5bff09c3a3b97b2f1b178af53f ]
The ->reserved field isn't cleared so we leak one byte of stack information to userspace.
--- fs/notify/fanotify/fanotify_user.c | 1 + 1 file changed, 1 insertion(+)
fs/notify/fanotify/fanotify_user.c +1 -0
@@ -116,6 +116,7 @@ static int fill_event_metadata(struct fsnotify_group *group, metadata->event_len =FAN_EVENT_METADATA_LEN ; metadata->metadata_len =FAN_EVENT_METADATA_LEN ; metadata->vers =FANOTIFY_METADATA_VERSION ; + metadata->reserved =0 ; metadata->mask = event->mask &FAN_ALL_OUTGOING_EVENTS ; metadata->pid =pid_vnr (event->tgid);if (unlikely (event->mask &FAN_Q_OVERFLOW ))
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 153/251 cgroup: fix umount vs cgroup_cfts_commit() race
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Li Zefan <[email protected]>
[ Upstream commit 084457f284abf6789d90509ee11dae383842b23b ]
cgroup_cfts_commit() uses dget() to keep cgroup alive after cgroup_mutex is dropped, but dget() won't prevent cgroupfs from being umounted. When the race happens, vfs will see some dentries with non-zero refcnt while umount is in process.
Keep running this:
mount -t cgroup -o blkio xxx /cgroup
umount /cgroup
And this:
modprobe cfq-iosched
rmmod cfs-iosched
After a while, the BUG() in shrink_dcache_for_umount_subtree() may be triggered:
BUG: Dentry xxx{i=0,n=blkio.yyy} still in use (1) [umount of cgroup cgroup]--- kernel/cgroup.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
kernel/cgroup.c +8 -1
@@ -2761,13 +2761,17 @@ static void cgroup_cfts_commit(struct cgroup_subsys *ss, {LIST_HEAD (pending);struct cgroup *cgrp, *n; +struct super_block *sb = ss->root->sb;/* %NULL @cfts indicates abort and don't bother if @ss isn't attached */ -if (cfts && ss->root != &rootnode) { +if (cfts && ss->root != &rootnode && +atomic_inc_not_zero (&sb->s_active)) {list_for_each_entry (cgrp, &ss->root->allcg_list, allcg_node) {dget (cgrp->dentry);list_add_tail (&cgrp->cft_q_node, &pending); } + }else { + sb =NULL ; }mutex_unlock (&cgroup_mutex);
@@ -2790,6 +2794,9 @@ static void cgroup_cfts_commit(struct cgroup_subsys *ss,dput (cgrp->dentry); } +if (sb) +deactivate_super (sb); +mutex_unlock (&cgroup_cft_mutex); }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 154/251 x86, fpu: correct the asm constraints for fxsave, unbreak mxcsr.daz
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: "H.J. Lu" <[email protected]>
[ Upstream commit eaa5a990191d204ba0f9d35dbe5505ec2cdd1460 ]
GCC will optimize mxcsr_feature_mask_init in arch/x86/kernel/i387.c:
memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
asm volatile("fxsave %0" : : "m" (fx_scratch));
mask = fx_scratch.mxcsr_mask;
if (mask == 0)
mask = 0x0000ffbf;to
memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct));
asm volatile("fxsave %0" : : "m" (fx_scratch));
mask = 0x0000ffbf;since asm statement doesn’t say it will update fx_scratch. As the result, the DAZ bit will be cleared. This patch fixes it. This bug dates back to at least kernel 2.6.12.
--- arch/x86/kernel/i387.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/i387.c +1 -1
@@ -132,7 +132,7 @@ static void __cpuinit mxcsr_feature_mask_init(void)clts ();if (cpu_has_fxsr) {memset (&fx_scratch,0 ,sizeof (struct i387_fxsave_struct )); - asmvolatile ("fxsave %0" : :"m" (fx_scratch)); + asmvolatile ("fxsave %0" :"+m" (fx_scratch)); mask = fx_scratch.mxcsr_mask;if (mask ==0 ) mask =0x0000ffbf ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 155/251 userns: limit the maximum depth of user_namespace->parent chain
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
[ Upstream commit 8742f229b635bf1c1c84a3dfe5e47c814c20b5c8 ]
Ensure that user_namespace->parent chain can't grow too much. Currently we use the hardroded 32 as limit.
--- include/linux/user_namespace.h | 1 + kernel/user_namespace.c | 4 ++++ 2 files changed, 5 insertions(+)
include/linux/user_namespace.h +1 -0
@@ -22,6 +22,7 @@ struct user_namespace {struct uid_gid_map gid_map;struct kref kref;struct user_namespace *parent; +int level;kuid_t owner;kgid_t group; };
kernel/user_namespace.c +4 -0
@@ -39,6 +39,9 @@ int create_user_ns(struct cred *new)kuid_t owner = new->euid;kgid_t group = new->egid; +if (parent_ns->level >32 ) +return -EUSERS ; +/* * Verify that we can not violate the policy of which files * may be accessed that is specified by the root directory,
@@ -62,6 +65,7 @@ int create_user_ns(struct cred *new)kref_init (&ns->kref); ns->parent = parent_ns; + ns->level = parent_ns->level +1 ; ns->owner = owner; ns->group = group;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 156/251 x86/iommu/vt-d: Expand interrupt remapping quirk to cover x58 chipset
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Neil Horman <[email protected]>
[ Upstream commit 803075dba31c17af110e1d9a915fe7262165b213 ]
Recently we added an early quirk to detect 5500/5520 chipsets with early revisions that had problems with irq draining with interrupt remapping enabled:
commit 03bbcb2e7e292838bb0244f5a7816d194c911d62
Author: Neil Horman <[email protected]>
Date: Tue Apr 16 16:38:32 2013 -0400
iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets
It turns out this same problem is present in the intel X58 chipset as well. See errata 69 here:
http://www.intel.com/content/www/us/en/chipsets/x58-express-specification-update.html
This patch extends the pci early quirk so that the chip devices/revisions specified in the above update are also covered in the same way:
--- arch/x86/kernel/early-quirks.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
arch/x86/kernel/early-quirks.c +12 -2
@@ -196,15 +196,23 @@ static void __init ati_bugs_contd(int num, int slot, int func)static void __init intel_remapping_check (int num,int slot,int func) {u8 revision; +u16 device; + device =read_pci_config_16 (num, slot, func,PCI_DEVICE_ID ); revision =read_pci_config_byte (num, slot, func,PCI_REVISION_ID );/* -* Revision 0x13 of this chipset supports irq remapping -* but has an erratum that breaks its behavior, flag it as such +* Revision 13 of all triggering devices id in this quirk have +* a problem draining interrupts when irq remapping is enabled, +* and should be flagged as broken. Additionally revisions 0x12 +* and 0x22 of device id 0x3405 has this problem. */ if (revision ==0x13 )set_irq_remapping_broken (); +else if ((device ==0x3405 ) && + ((revision ==0x12 ) || + (revision ==0x22 ))) +set_irq_remapping_broken (); }
@@ -239,6 +247,8 @@ static struct chipset early_qrk[] __initdata = { PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST, PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, + { PCI_VENDOR_ID_INTEL, 0x3405, PCI_CLASS_BRIDGE_HOST, + PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, {}
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 157/251 arcnet: cleanup sizeof parameter
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 087d273caf4f7d3f2159256f255f1f432bc84a5b ]
This patch doesn't change the compiled code because ARC_HDR_SIZE is 4 and sizeof(int) is 4, but the intent was to use the header size and not the sizeof the header size.
--- drivers/net/arcnet/arcnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/arcnet/arcnet.c +1 -1
@@ -1007,7 +1007,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum) soft = &pkt.soft.rfc1201; - lp->hw.copy_from_card (dev, bufnum,0 , &pkt,sizeof (ARC_HDR_SIZE )); + lp->hw.copy_from_card (dev, bufnum,0 , &pkt,ARC_HDR_SIZE );if (pkt.hard.offset[0 ]) { ofs = pkt.hard.offset[0 ]; length =256 - ofs;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 158/251 sysctl net: Keep tcp_syn_retries inside the boundary
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Michal Tesar <[email protected]>
[ Upstream commit 651e92716aaae60fc41b9652f54cb6803896e0da ]
Limit the min/max value passed to the/proc/sys/net/ipv4/tcp_syn_retries.
--- net/ipv4/sysctl_net_ipv4.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/ipv4/sysctl_net_ipv4.c +5 -1
@@ -35,6 +35,8 @@ static int tcp_adv_win_scale_min = -31;static int tcp_adv_win_scale_max =31 ;static int ip_ttl_min =1 ;static int ip_ttl_max =255 ; +static int tcp_syn_retries_min =1 ; +static int tcp_syn_retries_max =MAX_TCP_SYNCNT ;static int ip_ping_group_range_min[] = {0 ,0 };static int ip_ping_group_range_max[] = {GID_T_MAX ,GID_T_MAX };
@@ -277,7 +279,9 @@ static struct ctl_table ipv4_table[] = { .data = &sysctl_tcp_syn_retries, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec + .proc_handler = proc_dointvec_minmax, + .extra1 = &tcp_syn_retries_min, + .extra2 = &tcp_syn_retries_max }, { .procname = "tcp_synack_retries",
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 159/251 ipv6: take rtnl_lock and mark mrt6 table as freed on namespace cleanup
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Hannes Frederic Sowa <[email protected]>
[ Upstream commit 905a6f96a1b18e490a75f810d733ced93c39b0e5 ]
Otherwise we end up dereferencing the already freed net->ipv6.mrt pointer which leads to a panic (from Srivatsa S. Bhat):
BUG: unable to handle kernel paging request at ffff882018552020 IP: [<ffffffffa0366b02>] ip6mr_sk_done+0x32/0xb0 [ipv6] PGD 290a067 PUD 207ffe0067 PMD 207ff1d067 PTE 8000002018552060 Oops: 0000 [#1] SMP DEBUG_PAGEALLOC Modules linked in: ebtable_nat ebtables nfs fscache nf_conntrack_ipv4 nf_defrag_ipv4 ipt_REJECT xt_CHECKSUM iptable_mangle iptable_filter ip_tables nfsd lockd nfs_acl exportfs auth_rpcgss autofs4 sunrpc 8021q garp bridge stp llc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter +ip6_tables ipv6 vfat fat vhost_net macvtap macvlan vhost tun kvm_intel kvm uinput iTCO_wdt iTCO_vendor_support cdc_ether usbnet mii microcode i2c_i801 i2c_core lpc_ich mfd_core shpchp ioatdma dca mlx4_core be2net wmi acpi_cpufreq mperf ext4 jbd2 mbcache dm_mirror dm_region_hash dm_log dm_mod CPU: 0 PID: 7 Comm: kworker/u33:0 Not tainted 3.11.0-rc1-ea45e-a #4 Hardware name: IBM -[8737R2A]-/00Y2738, BIOS -[B2E120RUS-1.20]- 11/30/2012 Workqueue: netns cleanup_net task: ffff8810393641c0 ti: ffff881039366000 task.ti: ffff881039366000 RIP: 0010:[<ffffffffa0366b02>] [<ffffffffa0366b02>] ip6mr_sk_done+0x32/0xb0 [ipv6] RSP: 0018:ffff881039367bd8 EFLAGS: 00010286 RAX: ffff881039367fd8 RBX: ffff882018552000 RCX: dead000000200200 RDX: 0000000000000000 RSI: ffff881039367b68 RDI: ffff881039367b68 RBP: ffff881039367bf8 R08: ffff881039367b68 R09: 2222222222222222 R10: 2222222222222222 R11: 2222222222222222 R12: ffff882015a7a040 R13: ffff882014eb89c0 R14: ffff8820289e2800 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff88103fc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff882018552020 CR3: 0000000001c0b000 CR4: 00000000000407f0 Stack: ffff881039367c18 ffff882014eb89c0 ffff882015e28c00 0000000000000000 ffff881039367c18 ffffffffa034d9d1 ffff8820289e2800 ffff882014eb89c0 ffff881039367c58 ffffffff815bdecb ffffffff815bddf2 ffff882014eb89c0 Call Trace: [<ffffffffa034d9d1>] rawv6_close+0x21/0x40 [ipv6] [<ffffffff815bdecb>] inet_release+0xfb/0x220 [<ffffffff815bddf2>] ? inet_release+0x22/0x220 [<ffffffffa032686f>] inet6_release+0x3f/0x50 [ipv6] [<ffffffff8151c1d9>] sock_release+0x29/0xa0 [<ffffffff81525520>] sk_release_kernel+0x30/0x70 [<ffffffffa034f14b>] icmpv6_sk_exit+0x3b/0x80 [ipv6] [<ffffffff8152fff9>] ops_exit_list+0x39/0x60 [<ffffffff815306fb>] cleanup_net+0xfb/0x1a0 [<ffffffff81075e3a>] process_one_work+0x1da/0x610 [<ffffffff81075dc9>] ? process_one_work+0x169/0x610 [<ffffffff81076390>] worker_thread+0x120/0x3a0 [<ffffffff81076270>] ? process_one_work+0x610/0x610 [<ffffffff8107da2e>] kthread+0xee/0x100 [<ffffffff8107d940>] ? __init_kthread_worker+0x70/0x70 [<ffffffff8162a99c>] ret_from_fork+0x7c/0xb0 [<ffffffff8107d940>] ? __init_kthread_worker+0x70/0x70 Code: 20 48 89 5d e8 4c 89 65 f0 4c 89 6d f8 66 66 66 66 90 4c 8b 67 30 49 89 fd e8 db 3c 1e e1 49 8b 9c 24 90 08 00 00 48 85 db 74 06 <4c> 39 6b 20 74 20 bb f3 ff ff ff e8 8e 3c 1e e1 89 d8 4c 8b 65 RIP [<ffffffffa0366b02>] ip6mr_sk_done+0x32/0xb0 [ipv6] RSP <ffff881039367bd8>
CR2: ffff882018552020
--- net/ipv6/ip6mr.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ipv6/ip6mr.c +5 -0
@@ -256,10 +256,12 @@ static void __net_exit ip6mr_rules_exit(struct net *net) {struct mr6_table *mrt, *next; +rtnl_lock ();list_for_each_entry_safe (mrt, next, &net->ipv6.mr6_tables, list) {list_del (&mrt->list);ip6mr_free_table (mrt); } +rtnl_unlock ();fib_rules_unregister (net->ipv6.mr6_rules_ops); }#else
@@ -286,7 +288,10 @@ static int __net_init ip6mr_rules_init(struct net *net) static void __net_exit ip6mr_rules_exit(struct net *net) { +rtnl_lock ();ip6mr_free_table (net->ipv6.mrt6); + net->ipv6.mrt6 =NULL ; +rtnl_unlock (); }#endif
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 160/251 net_sched: Fix stack info leak in cbq_dump_wrr().
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: "David S. Miller" <[email protected]>
[ Upstream commit a0db856a95a29efb1c23db55c02d9f0ff4f0db48 ]
Make sure the reserved fields, and padding (if any), are fully initialized.
Based upon a patch by Dan Carpenter and feedback from Joe Perches.
--- net/sched/sch_cbq.c | 1 + 1 file changed, 1 insertion(+)
net/sched/sch_cbq.c +1 -0
@@ -1469,6 +1469,7 @@ static int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl)unsigned char *b =skb_tail_pointer (skb);struct tc_cbq_wrropt opt; +memset (&opt,0 ,sizeof (opt)); opt.flags =0 ; opt.allot = cl->allot; opt.priority = cl->priority +1 ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 161/251 af_key: more info leaks in pfkey messages
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit ff862a4668dd6dba962b1d2d8bd344afa6375683 ]
This is inspired by a5cc68f3d6 "af_key: fix info leaks in notify messages". There are some struct members which don't get initialized and could disclose small amounts of private information.
--- net/key/af_key.c | 4 ++++ 1 file changed, 4 insertions(+)
net/key/af_key.c +4 -0
@@ -2072,6 +2072,7 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, const struct xfrm_policy * pol->sadb_x_policy_type =IPSEC_POLICY_NONE ; } pol->sadb_x_policy_dir = dir+1 ; + pol->sadb_x_policy_reserved =0 ; pol->sadb_x_policy_id = xp->index; pol->sadb_x_policy_priority = xp->priority;
@@ -3106,7 +3107,9 @@ static int pfkey_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *t, struct pol->sadb_x_policy_exttype =SADB_X_EXT_POLICY ; pol->sadb_x_policy_type =IPSEC_POLICY_IPSEC ; pol->sadb_x_policy_dir = dir+1 ; + pol->sadb_x_policy_reserved =0 ; pol->sadb_x_policy_id = xp->index; + pol->sadb_x_policy_priority = xp->priority;/* Set sadb_comb's. */ if (x->id.proto ==IPPROTO_AH )
@@ -3494,6 +3497,7 @@ static int pfkey_send_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, pol->sadb_x_policy_exttype =SADB_X_EXT_POLICY ; pol->sadb_x_policy_type =IPSEC_POLICY_IPSEC ; pol->sadb_x_policy_dir = dir +1 ; + pol->sadb_x_policy_reserved =0 ; pol->sadb_x_policy_id =0 ; pol->sadb_x_policy_priority =0 ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 162/251 atl1c: Fix misuse of netdev_alloc_skb in refilling rx ring
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7b70176421993866e616f1cbc4d0dd4054f1bf78 ]
Quoted 8 lines · Eric Dumazet
Quoted 3 lines · Luis Henriques
I confirm that I can't reproduce the issue using this patch.
Thanks, I'll send a polished patch, as this one had an error if
build_skb()returns NULL (in casesk_buffallocation fails)
Please try the following patch : It should use 2K frags instead of 4K for normal 1500 mtu
Thanks !
[PATCH] atl1c: use custom skb allocator
We had reports ( https://bugzilla.kernel.org/show_bug.cgi?id=54021 ) that using high order pages for skb allocations is problematic for atl1c
We do not know exactly what the problem is, but we suspect that crossing 4K pages is not well supported by this hardware.
Use a custom allocator, using page allocator and 2K fragments for optimal stack behavior. We might make this allocator generic in future kernels.
--- drivers/net/ethernet/atheros/atl1c/atl1c.h | 3 ++ drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 40 ++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-)
drivers/net/ethernet/atheros/atl1c/atl1c.h +3 -0
@@ -520,6 +520,9 @@ struct atl1c_adapter {struct net_device *netdev;struct pci_dev *pdev;struct napi_struct napi; +struct page *rx_page; +unsigned int rx_page_offset; +unsigned int rx_frag_size;struct atl1c_hw hw;struct atl1c_hw_stats hw_stats;struct mii_if_info mii;/* MII interface info */
drivers/net/ethernet/atheros/atl1c/atl1c_main.c +39 -1
@@ -482,10 +482,15 @@ static int atl1c_set_mac_addr(struct net_device *netdev, void *p)static void atl1c_set_rxbufsize (struct atl1c_adapter *adapter,struct net_device *dev) { +unsigned int head_size;int mtu = dev->mtu; adapter->rx_buffer_len = mtu >AT_RX_BUF_SIZE ?roundup (mtu +ETH_HLEN +ETH_FCS_LEN +VLAN_HLEN ,8 ) :AT_RX_BUF_SIZE ; + + head_size =SKB_DATA_ALIGN (adapter->rx_buffer_len +NET_SKB_PAD ) + +SKB_DATA_ALIGN (sizeof (struct skb_shared_info )); + adapter->rx_frag_size =roundup_pow_of_two (head_size); } static netdev_features_t atl1c_fix_features(struct net_device *netdev,
@@ -953,6 +958,10 @@ static void atl1c_free_ring_resources(struct atl1c_adapter *adapter)kfree (adapter->tpd_ring[0 ].buffer_info); adapter->tpd_ring[0 ].buffer_info =NULL ; } +if (adapter->rx_page) { +put_page (adapter->rx_page); + adapter->rx_page =NULL ; + } }/**
@@ -1642,6 +1651,35 @@ static inline void atl1c_rx_checksum(struct atl1c_adapter *adapter,skb_checksum_none_assert (skb); } +static struct sk_buff *atl1c_alloc_skb (struct atl1c_adapter *adapter) +{ +struct sk_buff *skb; +struct page *page; + +if (adapter->rx_frag_size >PAGE_SIZE ) +return netdev_alloc_skb (adapter->netdev, + adapter->rx_buffer_len); + + page = adapter->rx_page; +if (!page) { + adapter->rx_page = page =alloc_page (GFP_ATOMIC ); +if (unlikely (!page)) +return NULL ; + adapter->rx_page_offset =0 ; + } + + skb =build_skb (page_address (page) + adapter->rx_page_offset, + adapter->rx_frag_size); +if (likely (skb)) { + adapter->rx_page_offset += adapter->rx_frag_size; +if (adapter->rx_page_offset >=PAGE_SIZE ) + adapter->rx_page =NULL ; +else +get_page (page); + } +return skb; +} +static int atl1c_alloc_rx_buffer (struct atl1c_adapter *adapter) {struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring;
@@ -1662,7 +1700,7 @@ static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter)while (next_info->flags &ATL1C_BUFFER_FREE ) { rfd_desc =ATL1C_RFD_DESC (rfd_ring, rfd_next_to_use); - skb =netdev_alloc_skb (adapter->netdev, adapter->rx_buffer_len); + skb =atl1c_alloc_skb (adapter);if (unlikely (!skb)) {if (netif_msg_rx_err (adapter))dev_warn (&pdev->dev,"alloc rx buffer failed\n" );
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 163/251 net_sched: info leak in atm_tc_dump_class()
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 8cb3b9c3642c0263d48f31d525bcee7170eedc20 ]
The "pvc" struct has a hole after pvc.sap_family which is not cleared.
--- net/sched/sch_atm.c | 1 + 1 file changed, 1 insertion(+)
net/sched/sch_atm.c +1 -0
@@ -605,6 +605,7 @@ static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl,struct sockaddr_atmpvc pvc;int state; +memset (&pvc,0 ,sizeof (pvc)); pvc.sap_family =AF_ATMPVC ; pvc.sap_addr.itf = flow->vcc->dev ? flow->vcc->dev->number :-1 ; pvc.sap_addr.vpi = flow->vcc->vpi;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 164/251 ndisc: Add missing inline to ndisc_addr_option_pad
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Joe Perches <[email protected]>
[ Upstream commit d9d10a30964504af834d8d250a0c76d4ae91eb1e ]
--- include/net/ndisc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/ndisc.h +1 -1
@@ -118,7 +118,7 @@ extern struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len,* if RFC 3831 IPv6-over-Fibre Channel is ever implemented it may * also need a pad of 2. */ -static int ndisc_addr_option_pad (unsigned short type) +static inline int ndisc_addr_option_pad (unsigned short type) {switch (type) {case ARPHRD_INFINIBAND :return 2 ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 165/251 8139cp: Add dma_mapping_error checking
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Neil Horman <[email protected]>
[ Upstream commit cf3c4c03060b688cbc389ebc5065ebcce5653e96 ]
Self explanitory dma_mapping_error addition to the 8139 driver, based on this:
https://bugzilla.redhat.com/show_bug.cgi?id=947250
It showed several backtraces arising for dma_map_* usage without checking the return code on the mapping. Add the check and abort the rx/tx operation if its failed. Untested as I have no hardware and the reporter has wandered off, but seems pretty straightforward.
--- drivers/net/ethernet/realtek/8139cp.c | 48 ++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-)
drivers/net/ethernet/realtek/8139cp.c +45 -3
@@ -478,7 +478,7 @@ rx_status_loop:while (1 ) {u32 status, len; -dma_addr_t mapping; +dma_addr_t mapping, new_mapping;struct sk_buff *skb, *new_skb;struct cp_desc *desc;const unsigned buflen = cp->rx_buf_sz;
@@ -520,6 +520,13 @@ rx_status_loop: goto rx_next; } + new_mapping =dma_map_single (&cp->pdev->dev, new_skb->data, buflen, +PCI_DMA_FROMDEVICE ); +if (dma_mapping_error (&cp->pdev->dev, new_mapping)) { + dev->stats.rx_dropped++; + goto rx_next; + } +dma_unmap_single (&cp->pdev->dev, mapping, buflen,PCI_DMA_FROMDEVICE );
@@ -531,12 +538,11 @@ rx_status_loop:skb_put (skb, len); - mapping =dma_map_single (&cp->pdev->dev, new_skb->data, buflen, -PCI_DMA_FROMDEVICE ); cp->rx_skb[rx_tail] = new_skb;cp_rx_skb (cp, skb, desc); rx++; + mapping = new_mapping; rx_next: cp->rx_ring[rx_tail].opts2 =0 ;
@@ -707,6 +713,22 @@ static inline u32 cp_tx_vlan_tag(struct sk_buff *skb) TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; } +static void unwind_tx_frag_mapping (struct cp_private *cp,struct sk_buff *skb, +int first,int entry_last) +{ +int frag, index; +struct cp_desc *txd; +skb_frag_t *this_frag; +for (frag =0 ; frag+first < entry_last; frag++) { + index = first+frag; + cp->tx_skb[index] =NULL ; + txd = &cp->tx_ring[index]; + this_frag = &skb_shinfo (skb)->frags[frag]; +dma_unmap_single (&cp->pdev->dev,le64_to_cpu (txd->addr), +skb_frag_size (this_frag),PCI_DMA_TODEVICE ); + } +} +static netdev_tx_t cp_start_xmit (struct sk_buff *skb,struct net_device *dev) {
@@ -740,6 +762,9 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, len = skb->len; mapping =dma_map_single (&cp->pdev->dev, skb->data, len,PCI_DMA_TODEVICE ); +if (dma_mapping_error (&cp->pdev->dev, mapping)) + goto out_dma_error; + txd->opts2 = opts2; txd->addr =cpu_to_le64 (mapping);wmb ();
@@ -777,6 +802,9 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, first_len =skb_headlen (skb); first_mapping =dma_map_single (&cp->pdev->dev, skb->data, first_len,PCI_DMA_TODEVICE ); +if (dma_mapping_error (&cp->pdev->dev, first_mapping)) + goto out_dma_error; + cp->tx_skb[entry] = skb; entry =NEXT_TX (entry);
@@ -790,6 +818,11 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, mapping =dma_map_single (&cp->pdev->dev,skb_frag_address (this_frag), len,PCI_DMA_TODEVICE ); +if (dma_mapping_error (&cp->pdev->dev, mapping)) { +unwind_tx_frag_mapping (cp, skb, first_entry, entry); + goto out_dma_error; + } + eor = (entry == (CP_TX_RING_SIZE -1 )) ? RingEnd :0 ; ctrl = eor | len | DescOwn;
@@ -848,11 +881,16 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb,if (TX_BUFFS_AVAIL (cp) <= (MAX_SKB_FRAGS +1 ))netif_stop_queue (dev); +out_unlock:spin_unlock_irqrestore (&cp->lock, intr_flags);cpw8 (TxPoll, NormalTxPoll);return NETDEV_TX_OK ; +out_dma_error: +kfree_skb (skb); + cp->dev->stats.tx_dropped++; + goto out_unlock; }/* Set or clear the multicast filter for this adaptor.
@@ -1023,6 +1061,10 @@ static int cp_refill_rx(struct cp_private *cp) mapping =dma_map_single (&cp->pdev->dev, skb->data, cp->rx_buf_sz,PCI_DMA_FROMDEVICE ); +if (dma_mapping_error (&cp->pdev->dev, mapping)) { +kfree_skb (skb); + goto err_out; + } cp->rx_skb[i] = skb; cp->rx_ring[i].opts2 =0 ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 166/251 Dont attempt to send extended INQUIRY command if skip_vpd_pages is set
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: "Martin K. Petersen" <[email protected]>
[ Upstream commit 7562523e84ddc742fe1f9db8bd76b01acca89f6b ]
If a device has the skip_vpd_pages flag set we should simply fail the scsi_get_vpd_page() call.
--- drivers/scsi/scsi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/scsi.c +3 -0
@@ -1030,6 +1030,9 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf, {int i, result; +if (sdev->skip_vpd_pages) + goto fail; +/* Ask for all the pages supported by this device */ result =scsi_vpd_inquiry (sdev, buf,0 , buf_len);if (result)
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 167/251 megaraid_sas: megaraid_sas driver init fails in kdump kernel
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
[ Upstream commit 6431f5d7c6025f8b007af06ea090de308f7e6881 ]
Problem: When Hardware IOMMU is on, megaraid_sas driver initialization fails in kdump kernel with LSI MegaRAID controller(device id-0x73).
Actually this issue needs fix in firmware, but for firmware running in field, this driver fix is proposed to resolve the issue. At firmware initialization time, if firmware does not come to ready state, driver will reset the adapter and retry for firmware transition to ready state unconditionally(not only executed for kdump kernel).
--- drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +15 -5
@@ -3493,11 +3493,21 @@ static int megasas_init_fw(struct megasas_instance *instance)break ; } -/* -* We expect the FW state to be READY -*/ -if (megasas_transition_to_ready (instance,0 )) - goto fail_ready_state; +if (megasas_transition_to_ready (instance,0 )) { +atomic_set (&instance->fw_reset_no_pci_access,1 ); + instance->instancet->adp_reset + (instance, instance->reg_set); +atomic_set (&instance->fw_reset_no_pci_access,0 ); +dev_info (&instance->pdev->dev, +"megasas: FW restarted successfully from %s!\n" , + __func__); + +/*waitting for about 30 second before retry*/ +ssleep (30 ); + +if (megasas_transition_to_ready (instance,0 )) + goto fail_ready_state; + }/* Check if MSI-X is supported while in ready state */ msix_enable = (instance->instancet->read_fw_status_reg(reg_set) &
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 168/251 ext4: make sure group number is bumped after a inode allocation race
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
[ Upstream commit a34eb503742fd25155fd6cff6163daacead9fbc3 ]
When we try to allocate an inode, and there is a race between two CPU's trying to grab the same inode, _and_ this inode is the last free inode in the block group, make sure the group number is bumped before we continue searching the rest of the block groups. Otherwise, we end up searching the current block group twice, and we end up skipping searching the last block group. So in the unlikely situation where almost all of the inodes are allocated, it's possible that we will return ENOSPC even though there might be free inodes in that last block group.
--- fs/ext4/ialloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/ext4/ialloc.c +5 -5
@@ -706,11 +706,8 @@ repeat_in_this_group: ino =ext4_find_next_zero_bit ((unsigned long *) inode_bitmap_bh->b_data,EXT4_INODES_PER_GROUP (sb), ino); -if (ino >=EXT4_INODES_PER_GROUP (sb)) { -if (++group == ngroups) - group =0 ; -continue ; - } +if (ino >=EXT4_INODES_PER_GROUP (sb)) + goto next_group;if (group ==0 && (ino+1 ) <EXT4_FIRST_INO (sb)) {ext4_error (sb,"reserved inode found cleared - " "inode=%lu" , ino +1 );
@@ -728,6 +725,9 @@ repeat_in_this_group: goto got;/* we grabbed the inode! */ if (ino <EXT4_INODES_PER_GROUP (sb)) goto repeat_in_this_group; +next_group: +if (++group == ngroups) + group =0 ; } err = -ENOSPC ; goto out;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 169/251 regmap: Add missing header for !CONFIG_REGMAP stubs
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Mateusz Krawczuk <[email protected]>
[ Upstream commit 49ccc142f9cbc33fdda18e8fa90c1c5b4a79c0ad ]
regmap.h requires linux/err.h if CONFIG_REGMAP is not defined. Without it I get
error.
CC drivers/media/platform/exynos4-is/fimc-reg.o
In file included from drivers/media/platform/exynos4-is/fimc-reg.c:14:0:include/linux/regmap.h: In function ‘regmap_write’:include/linux/regmap.h:525:10: error: ‘EINVAL’ undeclared (first use in this function) include/linux/regmap.h:525:10: note: each undeclared identifier is reported only once for each function it appears in
--- include/linux/regmap.h | 1 + 1 file changed, 1 insertion(+)
include/linux/regmap.h +1 -0
@@ -15,6 +15,7 @@#include <linux/list.h> #include <linux/rbtree.h> +#include <linux/err.h> struct module ;struct device ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 170/251 hwmon: (adt7470) Fix incorrect return code check
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Curt Brune <[email protected]>
[ Upstream commit 93d783bcca69bfacc8dc739d8a050498402587b5 ]
In adt7470_write_word_data(), which writes two bytes using i2c_smbus_write_byte_data(), the return codes are incorrectly AND-ed together when they should be OR-ed together.
The return code of i2c_smbus_write_byte_data() is zero for success.
The upshot is only the first byte was ever written to the hardware. The 2nd byte was never written out.
I noticed that trying to set the fan speed limits was not working correctly on my system. Setting the fan speed limits is the only code that uses adt7470_write_word_data(). After making the change the limit settings work and the alarms work also.
--- drivers/hwmon/adt7470.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/adt7470.c +1 -1
@@ -215,7 +215,7 @@ static inline int adt7470_write_word_data(struct i2c_client *client, u8 reg, u16 value) {return i2c_smbus_write_byte_data (client, reg, value &0xFF ) - &&i2c_smbus_write_byte_data (client, reg +1 , value >>8 ); + ||i2c_smbus_write_byte_data (client, reg +1 , value >>8 ); }static void adt7470_init_client (struct i2c_client *client)
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 171/251 tracing: Fix fields of struct trace_iterator that are zeroed by mistake
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Andrew Vagin <[email protected]>
[ Upstream commit ed5467da0e369e65b247b99eb6403cb79172bcda ]
tracing_read_pipe zeros all fields bellow "seq". The declaration contains a comment about that, but it doesn't help.
The first field is "snapshot", it's true when current open file is snapshot. Looks obvious, that it should not be zeroed.
The second field is "started". It was converted from cpumask_t to cpumask_var_t (v2.6.28-4983-g4462344), in other words it was converted from cpumask to pointer on cpumask.
Currently the reference on "started" memory is lost after the first read from tracing_read_pipe and a proper object will never be freed.
The "started" is never dereferenced for trace_pipe, because trace_pipe can't have the TRACE_FILE_ANNOTATE options.
--- include/linux/ftrace_event.h | 4 +++- kernel/trace/trace.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-)
include/linux/ftrace_event.h +3 -1
@@ -71,6 +71,8 @@ struct trace_iterator {/* trace_seq for __print_flags() and __print_symbolic() etc. */ struct trace_seq tmp_seq; +cpumask_var_t started; +/* The below is zeroed out in pipe_read */ struct trace_seq seq;struct trace_entry *ent;
@@ -83,7 +85,7 @@ struct trace_iterator {loff_t pos;long idx; -cpumask_var_t started; +/* All new field here will be zeroed out in pipe_read */ };
kernel/trace/trace.c +1 -0
@@ -3542,6 +3542,7 @@ waitagain:memset (&iter->seq,0 ,sizeof (struct trace_iterator ) - offsetof(struct trace_iterator , seq)); +cpumask_clear (iter->started); iter->pos =-1 ;trace_event_read_lock ();
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 172/251 ALSA: usb-audio: do not trust too-big wMaxPacketSize values
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Clemens Ladisch <[email protected]>
[ Upstream commit 57e6dae1087bbaa6b33d3dd8a8e90b63888939a3 ]
The driver used to assume that the streaming endpoint's wMaxPacketSize value would be an indication of how much data the endpoint expects or sends, and compute the number of packets per URB using this value.
However, the Focusrite Scarlett 2i4 declares a value of 1024 bytes, while only about 88 or 44 bytes are be actually used. This discrepancy would result in URBs with far too few packets, which would not work correctly on the EHCI driver.
To get correct URBs, use wMaxPacketSize only as an upper limit on the packet size.
--- sound/usb/endpoint.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
sound/usb/endpoint.c +6 -7
@@ -599,17 +599,16 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep, ep->stride = frame_bits >>3 ; ep->silence_value = format ==SNDRV_PCM_FORMAT_U8 ?0x80 :0 ; -/* calculate max. frequency */ -if (ep->maxpacksize) { +/* assume max. frequency is 25% higher than nominal */ + ep->freqmax = ep->freqn + (ep->freqn >>2 ); + maxsize = ((ep->freqmax +0xffff ) * (frame_bits >>3 )) + >> (16 - ep->datainterval); +/* but wMaxPacketSize might reduce this */ +if (ep->maxpacksize && ep->maxpacksize < maxsize) {/* whatever fits into a max. size packet */ maxsize = ep->maxpacksize; ep->freqmax = (maxsize / (frame_bits >>3 )) << (16 - ep->datainterval); - }else { -/* no max. packet size: just take 25% higher than nominal */ - ep->freqmax = ep->freqn + (ep->freqn >>2 ); - maxsize = ((ep->freqmax +0xffff ) * (frame_bits >>3 )) - >> (16 - ep->datainterval); }if (ep->fill_max)
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 173/251 ALSA: 6fire: fix DMA issues with URB transfer_buffer usage
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jussi Kivilinna <[email protected]>
[ Upstream commit ddb6b5a964371e8e52e696b2b258bda144c8bd3f ]
Patch fixes 6fire not to use stack as URB transfer_buffer. URB buffers need to be DMA-able, which stack is not. Furthermore, transfer_buffer should not be allocated as part of larger device structure because DMA coherency issues and patch fixes this issue too.
--- sound/usb/6fire/comm.c | 38 +++++++++++++++++++++++++++++++++----- sound/usb/6fire/comm.h | 2 +- 2 files changed, 34 insertions(+), 6 deletions(-)
sound/usb/6fire/comm.c +33 -5
@@ -110,19 +110,37 @@ static int usb6fire_comm_send_buffer(u8 *buffer, struct usb_device *dev)static int usb6fire_comm_write8 (struct comm_runtime *rt,u8 request,u8 reg,u8 value) { -u8 buffer[13 ];/* 13: maximum length of message */ +u8 *buffer; +int ret; + +/* 13: maximum length of message */ + buffer =kmalloc (13 ,GFP_KERNEL ); +if (!buffer) +return -ENOMEM ;usb6fire_comm_init_buffer (buffer,0x00 , request, reg, value,0x00 ); -return usb6fire_comm_send_buffer (buffer, rt->chip->dev); + ret =usb6fire_comm_send_buffer (buffer, rt->chip->dev); + +kfree (buffer); +return ret; }static int usb6fire_comm_write16 (struct comm_runtime *rt,u8 request,u8 reg,u8 vl,u8 vh) { -u8 buffer[13 ];/* 13: maximum length of message */ +u8 *buffer; +int ret; + +/* 13: maximum length of message */ + buffer =kmalloc (13 ,GFP_KERNEL ); +if (!buffer) +return -ENOMEM ;usb6fire_comm_init_buffer (buffer,0x00 , request, reg, vl, vh); -return usb6fire_comm_send_buffer (buffer, rt->chip->dev); + ret =usb6fire_comm_send_buffer (buffer, rt->chip->dev); + +kfree (buffer); +return ret; }int __devinit usb6fire_comm_init (struct sfire_chip *chip)
@@ -135,6 +153,12 @@ int __devinit usb6fire_comm_init(struct sfire_chip *chip)if (!rt)return -ENOMEM ; + rt->receiver_buffer =kzalloc (COMM_RECEIVER_BUFSIZE ,GFP_KERNEL ); +if (!rt->receiver_buffer) { +kfree (rt); +return -ENOMEM ; + } + rt->serial =1 ; rt->chip = chip;usb_init_urb (urb);
@@ -152,6 +176,7 @@ int __devinit usb6fire_comm_init(struct sfire_chip *chip) urb->interval =1 ; ret =usb_submit_urb (urb,GFP_KERNEL );if (ret <0 ) { +kfree (rt->receiver_buffer);kfree (rt); snd_printk(KERN_ERR PREFIX "cannot create comm data receiver.");return ret;
@@ -170,6 +195,9 @@ void usb6fire_comm_abort(struct sfire_chip *chip)void usb6fire_comm_destroy (struct sfire_chip *chip) { -kfree (chip->comm); +struct comm_runtime *rt = chip->comm; + +kfree (rt->receiver_buffer); +kfree (rt); chip->comm =NULL ; }
sound/usb/6fire/comm.h +1 -1
@@ -24,7 +24,7 @@ struct comm_runtime {struct sfire_chip *chip;struct urb receiver; -u8 receiver_buffer[COMM_RECEIVER_BUFSIZE ]; +u8 *receiver_buffer;u8 serial;/* urb serial */
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 174/251 virtio: console: fix race with port unplug and open/close
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Amit Shah <[email protected]>
[ Upstream commit 057b82be3ca3d066478e43b162fc082930a746c9 ]
There's a window between find_port_by_devt() returning a port and us taking a kref on the port, where the port could get unplugged. Fix it by taking the reference in find_port_by_devt() itself.
Problem reported and analyzed by Mateusz Guzik.
--- drivers/char/virtio_console.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/char/virtio_console.c +6 -7
@@ -257,9 +257,12 @@ static struct port *find_port_by_devt_in_portdev(struct ports_device *portdev,unsigned long flags;spin_lock_irqsave (&portdev->ports_lock, flags); -list_for_each_entry (port, &portdev->ports, list) -if (port->cdev->dev == dev) +list_for_each_entry (port, &portdev->ports, list) { +if (port->cdev->dev == dev) { +kref_get (&port->kref); goto out; + } + } port =NULL ; out:spin_unlock_irqrestore (&portdev->ports_lock, flags);
@@ -793,14 +796,10 @@ static int port_fops_open(struct inode *inode, struct file *filp)struct port *port;int ret; +/* We get the port with a kref here */ port =find_port_by_devt (cdev->dev); filp->private_data = port; -/* Prevent against a port getting hot-unplugged at the same time */ -spin_lock_irq (&port->portdev->ports_lock); -kref_get (&port->kref); -spin_unlock_irq (&port->portdev->ports_lock); -/* * Don't allow opening of console port devices -- that's done * via /dev/hvc
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 175/251 virtio: console: fix race in port_fops_open() and port unplug
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Amit Shah <[email protected]>
[ Upstream commit 671bdea2b9f210566610603ecbb6584c8a201c8c ]
Between open() being called and processed, the port can be unplugged. Check if this happened, and bail out.
A simple test script to reproduce this is:
while true; do for i in $(seq 1 100); do echo $i > /dev/vport0p3; done; done;
This opens and closes the port a lot of times; unplugging the port while this is happening triggers the bug.
--- drivers/char/virtio_console.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/char/virtio_console.c +4 -0
@@ -798,6 +798,10 @@ static int port_fops_open(struct inode *inode, struct file *filp)/* We get the port with a kref here */ port =find_port_by_devt (cdev->dev); +if (!port) { +/* Port was unplugged before we could proceed */ +return -ENXIO ; + } filp->private_data = port;/*
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 176/251 virtio: console: clean up port data immediately at time of unplug
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Amit Shah <[email protected]>
[ Upstream commit ea3768b4386a8d1790f4cc9a35de4f55b92d6442 ]
We used to keep the port's char device structs and the /sys entries around till the last reference to the port was dropped. This is actually unnecessary, and resulted in buggy behaviour:
1. Open port in guest
2. Hot-unplug port
3. Hot-plug a port with the same 'name' property as the unplugged one
This resulted in hot-plug being unsuccessful, as a port with the same name already exists (even though it was unplugged).
This behaviour resulted in a warning message like this one:
-------------------8<---------------------------------------
WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xc9/0x130() (Not tainted) Hardware name: KVM
sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:04.0/virtio0/virtio-ports/vport0p1'
Call Trace: [<ffffffff8106b607>] ? warn_slowpath_common+0x87/0xc0 [<ffffffff8106b6f6>] ? warn_slowpath_fmt+0x46/0x50 [<ffffffff811f2319>] ? sysfs_add_one+0xc9/0x130 [<ffffffff811f23e8>] ? create_dir+0x68/0xb0 [<ffffffff811f2469>] ? sysfs_create_dir+0x39/0x50 [<ffffffff81273129>] ? kobject_add_internal+0xb9/0x260 [<ffffffff812733d8>] ? kobject_add_varg+0x38/0x60 [<ffffffff812734b4>] ? kobject_add+0x44/0x70 [<ffffffff81349de4>] ? get_device_parent+0xf4/0x1d0 [<ffffffff8134b389>] ? device_add+0xc9/0x650
-------------------8<---------------------------------------
Instead of relying on guest applications to release all references to the ports, we should go ahead and unregister the port from all the core layers. Any open/read calls on the port will then just return errors, and an unplug/plug operation on the host will succeed as expected.
This also caused buggy behaviour in case of the device removal (not just a port): when the device was removed (which means all ports on that device are removed automatically as well), the ports with active users would clean up only when the last references were dropped -- and it would be too late then to be referencing char device pointers, resulting in oopses:
-------------------8<---------------------------------------
PID: 6162 TASK: ffff8801147ad500 CPU: 0 COMMAND: "cat"
#0 [ffff88011b9d5a90] machine_kexec at ffffffff8103232b #1 [ffff88011b9d5af0] crash_kexec at ffffffff810b9322 #2 [ffff88011b9d5bc0] oops_end at ffffffff814f4a50
#3 [ffff88011b9d5bf0] die at ffffffff8100f26b
#4 [ffff88011b9d5c20] do_general_protection at ffffffff814f45e2 #5 [ffff88011b9d5c50] general_protection at ffffffff814f3db5
[exception RIP: strlen+2]
RIP: ffffffff81272ae2 RSP: ffff88011b9d5d00 RFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff880118901c18 RCX: 0000000000000000
RDX: ffff88011799982c RSI: 00000000000000d0 RDI: 3a303030302f3030
RBP: ffff88011b9d5d38 R8: 0000000000000006 R9: ffffffffa0134500
R10: 0000000000001000 R11: 0000000000001000 R12: ffff880117a1cc10
R13: 00000000000000d0 R14: 0000000000000017 R15: ffffffff81aff700
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #6 [ffff88011b9d5d00] kobject_get_path at ffffffff8126dc5d #7 [ffff88011b9d5d40] kobject_uevent_env at ffffffff8126e551 #8 [ffff88011b9d5dd0] kobject_uevent at ffffffff8126e9eb #9 [ffff88011b9d5de0] device_del at ffffffff813440c7
-------------------8<---------------------------------------
So clean up when we have all the context, and all that's left to do when the references to the port have dropped is to free up the port struct itself.
--- drivers/char/virtio_console.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/char/virtio_console.c +8 -8
@@ -1261,14 +1261,6 @@ static void remove_port(struct kref *kref) port = container_of(kref, struct port, kref); -sysfs_remove_group (&port->dev->kobj, &port_attribute_group); -device_destroy (pdrvdata.class, port->dev->devt); -cdev_del (port->cdev); - -kfree (port->name); - -debugfs_remove (port->debugfs_file); -kfree (port); }
@@ -1322,6 +1314,14 @@ static void unplug_port(struct port *port)*/ port->portdev =NULL ; +sysfs_remove_group (&port->dev->kobj, &port_attribute_group); +device_destroy (pdrvdata.class, port->dev->devt); +cdev_del (port->cdev); + +kfree (port->name); + +debugfs_remove (port->debugfs_file); +/* * Locks around here are not necessary - a port can't be * opened after we removed the port struct from ports_list
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 177/251 virtio: console: fix raising SIGIO after port unplug
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Amit Shah <[email protected]>
[ Upstream commit 92d3453815fbe74d539c86b60dab39ecdf01bb99 ]
SIGIO should be sent when a port gets unplugged. It should only be sent to prcesses that have the port opened, and have asked for SIGIO to be delivered. We were clearing out guest_connected before calling send_sigio_to_port(), resulting in a sigio not getting sent to processes.
Fix by setting guest_connected to false after invoking the sigio function.
--- drivers/char/virtio_console.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/char/virtio_console.c +5 -3
@@ -1290,12 +1290,14 @@ static void unplug_port(struct port *port)spin_unlock_irq (&port->portdev->ports_lock);if (port->guest_connected) { +/* Let the app know the port is going down. */ +send_sigio_to_port (port); + +/* Do this after sigio is actually sent */ port->guest_connected = false; port->host_connected = false; -wake_up_interruptible (&port->waitqueue); -/* Let the app know the port is going down. */ -send_sigio_to_port (port); +wake_up_interruptible (&port->waitqueue); }if (is_console_port (port)) {
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 178/251 virtio: console: return -ENODEV on all read operations after unplug
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Amit Shah <[email protected]>
[ Upstream commit 96f97a83910cdb9d89d127c5ee523f8fc040a804 ]
If a port gets unplugged while a user is blocked on read(), -ENODEV is returned. However, subsequent read()s returned 0, indicating there's no host-side connection (but not indicating the device went away).
This also happened when a port was unplugged and the user didn't have any blocking operation pending. If the user didn't monitor the SIGIO signal, they won't have a chance to find out if the port went away.
Fix by returning -ENODEV on all read()s after the port gets unplugged. write() already behaves this way.
--- drivers/char/virtio_console.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/char/virtio_console.c +5 -1
@@ -637,6 +637,10 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf, port = filp->private_data; +/* Port is hot-unplugged. */ +if (!port->guest_connected) +return -ENODEV ; +if (!port_has_data (port)) {/* * If nothing's connected on the host just return 0 in
@@ -653,7 +657,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,if (ret <0 )return ret; } -/* Port got hot-unplugged. */ +/* Port got hot-unplugged while we were waiting above. */ if (!port->guest_connected)return -ENODEV ;/*
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 179/251 drm/cirrus: Invalidate page tables when pinning a BO
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Michal Srb <[email protected]>
[ Upstream commit 109a51598869a39fdcec2d49672a9a39b6d89481 ]
This is a cirrus version of Egbert Eich's patch for mgag200.
Without bo.bdev->dev_mapping set, the ttm_bo_unmap_virtual_locked called from ttm_bo_handle_move_mem returns with no effect. If any application accessed the memory before it was moved, it will access wrong memory next time. This causes crashes when changing resolution down.
--- drivers/gpu/drm/cirrus/cirrus_ttm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/cirrus/cirrus_ttm.c +1 -0
@@ -353,6 +353,7 @@ int cirrus_bo_create(struct drm_device *dev, int size, int align, cirrusbo->gem.driver_private =NULL ; cirrusbo->bo.bdev = &cirrus->ttm.bdev; + cirrusbo->bo.bdev->dev_mapping = dev->dev_mapping;cirrus_ttm_placement (cirrusbo,TTM_PL_FLAG_VRAM |TTM_PL_FLAG_SYSTEM );
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 180/251 drm/mgag200: Invalidate page tables when pinning a BO
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Egbert Eich <[email protected]>
[ Upstream commit ecaac1c866bcda4780a963b3d18cd310d971aea3 ]
When a BO gets pinned the placement may get changed. If the memory is mapped into user space and user space has already accessed the mapped range the page tables are set up but now point to the wrong memory. Set bo.mdev->dev_mapping in mgag200_bo_create() to make sure that ttm_bo_unmap_virtual() called from ttm_bo_handle_move_mem() will take care of this.
v2: Don't call ttm_bo_unmap_virtual() in mgag200_bo_pin(), fix comment.
--- drivers/gpu/drm/mgag200/mgag200_ttm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/mgag200/mgag200_ttm.c +1 -0
@@ -347,6 +347,7 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align, mgabo->gem.driver_private =NULL ; mgabo->bo.bdev = &mdev->ttm.bdev; + mgabo->bo.bdev->dev_mapping = dev->dev_mapping;mgag200_ttm_placement (mgabo,TTM_PL_FLAG_VRAM |TTM_PL_FLAG_SYSTEM );
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 181/251 drm/ast: invalidate page tables when pinning a BO
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
[ Upstream commit 3ac65259328324de323dc006b52ff7c1a5b18d19 ]
same fix as cirrus and mgag200.
--- drivers/gpu/drm/ast/ast_ttm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/ast/ast_ttm.c +1 -0
@@ -348,6 +348,7 @@ int ast_bo_create(struct drm_device *dev, int size, int align, astbo->gem.driver_private =NULL ; astbo->bo.bdev = &ast->ttm.bdev; + astbo->bo.bdev->dev_mapping = dev->dev_mapping;ast_ttm_placement (astbo,TTM_PL_FLAG_VRAM |TTM_PL_FLAG_SYSTEM );
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 182/251 ext4: allow the mount options nodelalloc and data=journal
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
[ Upstream commit 59d9fa5c2e9086db11aa287bb4030151d0095a17 ]
Commit 26092bf ("ext4: use a table-driven handler for mount options") wrongly disallows the specifying the mount options nodelalloc and data=journal simultaneously. This is incorrect; it should have only disallowed the combination of delalloc and data=journal simultaneously.
--- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/super.c +1 -1
@@ -1422,7 +1422,7 @@ static const struct mount_opts { {Opt_discard, EXT4_MOUNT_DISCARD, MOPT_SET}, {Opt_nodiscard, EXT4_MOUNT_DISCARD, MOPT_CLEAR}, {Opt_delalloc, EXT4_MOUNT_DELALLOC, MOPT_SET | MOPT_EXPLICIT}, - {Opt_nodelalloc, EXT4_MOUNT_DELALLOC, MOPT_CLEAR | MOPT_EXPLICIT}, + {Opt_nodelalloc, EXT4_MOUNT_DELALLOC, MOPT_CLEAR}, {Opt_journal_checksum, EXT4_MOUNT_JOURNAL_CHECKSUM, MOPT_SET}, {Opt_journal_async_commit, (EXT4_MOUNT_JOURNAL_ASYNC_COMMIT | EXT4_MOUNT_JOURNAL_CHECKSUM), MOPT_SET},
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 183/251 ext4: fix mount/remount error messages for incompatible mount options
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Piotr Sarna <[email protected]>
[ Upstream commit 6ae6514b33f941d3386da0dfbe2942766eab1577 ]
Commit 5688978 ("ext4: improve handling of conflicting mount options") introduced incorrect messages shown while choosing wrong mount options.
First of all, both cases of incorrect mount options, "data=journal,delalloc" and "data=journal,dioread_nolock" result in the same error message.
Secondly, the problem above isn't solved for remount option: the mismatched parameter is simply ignored. Moreover, ext4_msg states that remount with options "data=journal,delalloc" succeeded, which is not true.
To fix it up, I added a simple check after parse_options() call to ensure that data=journal and delalloc/dioread_nolock parameters are not present at the same time.
--- fs/ext4/super.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
fs/ext4/super.c +16 -1
@@ -3405,7 +3405,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) }if (test_opt (sb,DIOREAD_NOLOCK )) {ext4_msg (sb,KERN_ERR ,"can't mount with " -"both data=journal and delalloc" ); +"both data=journal and dioread_nolock" ); goto failed_mount; }if (test_opt (sb,DELALLOC ))
@@ -4583,6 +4583,21 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) goto restore_opts; } +if (test_opt (sb,DATA_FLAGS ) ==EXT4_MOUNT_JOURNAL_DATA ) { +if (test_opt2 (sb,EXPLICIT_DELALLOC )) { +ext4_msg (sb,KERN_ERR ,"can't mount with " +"both data=journal and delalloc" ); + err = -EINVAL ; + goto restore_opts; + } +if (test_opt (sb,DIOREAD_NOLOCK )) { +ext4_msg (sb,KERN_ERR ,"can't mount with " +"both data=journal and dioread_nolock" ); + err = -EINVAL ; + goto restore_opts; + } + } +if (sbi->s_mount_flags &EXT4_MF_FS_ABORTED )ext4_abort (sb,"Abort forced by user" );
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 184/251 cifs: extend the buffer length enought for sprintf() using
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Chen Gang <[email protected]>
[ Upstream commit 057d6332b24a4497c55a761c83c823eed9e3f23b ]
For cifs_set_cifscreds() in "fs/cifs/connect.c", 'desc' buffer length is 'CIFSCREDS_DESC_SIZE' (56 is less than 256), and 'ses->domainName' length may be "255 + '\0'".
The related sprintf() may cause memory overflow, so need extend related buffer enough to hold all things.
It is also necessary to be sure of 'ses->domainName' must be less than 256, and define the related macro instead of hard code number '256'.
--- fs/cifs/cifsencrypt.c | 2 +- fs/cifs/cifsglob.h | 1 + fs/cifs/connect.c | 7 ++++--- fs/cifs/sess.c | 6 +++--- 4 files changed, 9 insertions(+), 7 deletions(-)
fs/cifs/cifsencrypt.c +1 -1
@@ -369,7 +369,7 @@ find_domain_name(struct cifs_ses *ses, const struct nls_table *nls_cp)if (blobptr + attrsize > blobend)break ;if (type ==NTLMSSP_AV_NB_DOMAIN_NAME ) { -if (!attrsize) +if (!attrsize || attrsize >=CIFS_MAX_DOMAINNAME_LEN )break ;if (!ses->domainName) { ses->domainName =
fs/cifs/cifsglob.h +1 -0
@@ -42,6 +42,7 @@#define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1)#define MAX_SERVER_SIZE 15#define MAX_SHARE_SIZE 80 +#define CIFS_MAX_DOMAINNAME_LEN 256/* max domain name length */ #define MAX_USERNAME_SIZE 256/* reasonable maximum for current servers */ #define MAX_PASSWORD_SIZE 512/* max for windows seems to be 256 wide chars */
fs/cifs/connect.c +4 -3
@@ -1611,7 +1611,8 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,if (string ==NULL ) goto out_nomem; -if (strnlen (string,256 ) ==256 ) { +if (strnlen (string,CIFS_MAX_DOMAINNAME_LEN ) + ==CIFS_MAX_DOMAINNAME_LEN ) {printk (KERN_WARNING "CIFS: domain name too" " long\n" ); goto cifs_parse_mount_err;
@@ -2298,8 +2299,8 @@ cifs_put_smb_ses(struct cifs_ses *ses)#ifdef CONFIG_KEYS -/* strlen("cifs:a:") + INET6_ADDRSTRLEN + 1 */ -#define CIFSCREDS_DESC_SIZE (7 + INET6_ADDRSTRLEN + 1) +/* strlen("cifs:a:") + CIFS_MAX_DOMAINNAME_LEN + 1 */ +#define CIFSCREDS_DESC_SIZE (7 + CIFS_MAX_DOMAINNAME_LEN + 1)/* Populate username and pw fields from keyring if possible */ static int
fs/cifs/sess.c +3 -3
@@ -198,7 +198,7 @@ static void unicode_domain_string(char **pbcc_area, struct cifs_ses *ses, bytes_ret =0 ; }else bytes_ret =cifs_strtoUTF16 ((__le16 *) bcc_ptr, ses->domainName, -256 , nls_cp); +CIFS_MAX_DOMAINNAME_LEN , nls_cp); bcc_ptr +=2 * bytes_ret; bcc_ptr +=2 ;/* account for null terminator */
@@ -256,8 +256,8 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses,/* copy domain */ if (ses->domainName !=NULL ) { -strncpy (bcc_ptr, ses->domainName,256 ); - bcc_ptr +=strnlen (ses->domainName,256 ); +strncpy (bcc_ptr, ses->domainName,CIFS_MAX_DOMAINNAME_LEN ); + bcc_ptr +=strnlen (ses->domainName,CIFS_MAX_DOMAINNAME_LEN ); }/* else we will send a null domain name so the server will default to its own domain */ *bcc_ptr =0 ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 185/251 zram: allow request end to coincide with disksize
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sergey Senozhatsky <[email protected]>
[ Upstream commit 75c7caf5a052ffd8db3312fa7864ee2d142890c4 ]
Pass valid_io_request() checks if request end coincides with disksize (end equals bound), only fail if we attempt to read beyond the bound.
mkfs.ext2 produces numerous errors:
[ 2164.632747] quiet_error: 1 callbacks suppressed [ 2164.633260] Buffer I/O error on device zram0, logical block 153599 [ 2164.633265] lost page write due to I/O error on zram0
--- drivers/staging/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/zram/zram_drv.c +1 -1
@@ -478,7 +478,7 @@ static inline int valid_io_request(struct zram *zram, struct bio *bio) end = start + (bio->bi_size >>SECTOR_SHIFT ); bound = zram->disksize >>SECTOR_SHIFT ;/* out of range range */ -if (unlikely (start >= bound || end >= bound || start > end)) +if (unlikely (start >= bound || end > bound || start > end))return 0 ;/* I/O request is valid */
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 186/251 debugfs: debugfs_remove_recursive() must not rely on list_empty(d_subdirs)
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
[ Upstream commit 776164c1faac4966ab14418bb0922e1820da1d19 ]
debugfs_remove_recursive() is wrong,
1. it wrongly assumes that !list_empty(d_subdirs) means that this dir should be removed.
This is not that bad by itself, but:
2. if d_subdirs does not becomes empty after __debugfs_remove() it gives up and silently fails, it doesn't even try to remove other entries.
However ->d_subdirs can be non-empty because it still has the already deleted !debugfs_positive() entries.
3. simple_release_fs() is called even if __debugfs_remove() fails.
Suppose we have
dir1/ dir2/ file2 file1
and someone opens dir1/dir2/file2.
Now, debugfs_remove_recursive(dir1/dir2) succeeds, and dir1/dir2 goes away.
But debugfs_remove_recursive(dir1) silently fails and doesn't remove this directory. Because it tries to delete (the already deleted) dir1/dir2/file2 again and then fails due to "Avoid infinite loop" logic.
Test-case:
#!/bin/sh
cd /sys/kernel/debug/tracing
echo 'p:probe/sigprocmask sigprocmask' >> kprobe_events sleep 1000 < events/probe/sigprocmask/id & echo -n >| kprobe_events
[ -d events/probe ] && echo "ERR!! failed to rm probe"
And after that it is not possible to create another probe entry.
With this patch debugfs_remove_recursive() skips !debugfs_positive() files although this is not strictly needed. The most important change is that it does not try to make ->d_subdirs empty, it simply scans the whole list(s) recursively and removes as much as possible.
--- fs/debugfs/inode.c | 69 +++++++++++++++++----------------------------------- 1 file changed, 22 insertions(+), 47 deletions(-)
fs/debugfs/inode.c +22 -47
@@ -524,8 +524,7 @@ EXPORT_SYMBOL_GPL(debugfs_remove);*/ void debugfs_remove_recursive (struct dentry *dentry) { -struct dentry *child; -struct dentry *parent; +struct dentry *child, *next, *parent;if (IS_ERR_OR_NULL (dentry))return ;
@@ -535,61 +534,37 @@ void debugfs_remove_recursive(struct dentry *dentry)return ; parent = dentry; + down:mutex_lock (&parent->d_inode->i_mutex); +list_for_each_entry_safe (child, next, &parent->d_subdirs, d_u.d_child) { +if (!debugfs_positive (child)) +continue ; -while (1 ) { -/* -* When all dentries under "parent" has been removed, -* walk up the tree until we reach our starting point. -*/ -if (list_empty (&parent->d_subdirs)) { -mutex_unlock (&parent->d_inode->i_mutex); -if (parent == dentry) -break ; - parent = parent->d_parent; -mutex_lock (&parent->d_inode->i_mutex); - } - child = list_entry(parent->d_subdirs.next, struct dentry, - d_u.d_child); - next_sibling: - -/* -* If "child" isn't empty, walk down the tree and -* remove all its descendants first. -*/ +/* perhaps simple_empty(child) makes more sense */ if (!list_empty (&child->d_subdirs)) {mutex_unlock (&parent->d_inode->i_mutex); parent = child; -mutex_lock (&parent->d_inode->i_mutex); -continue ; + goto down; } -__debugfs_remove (child, parent); -if (parent->d_subdirs.next == &child->d_u.d_child) { -/* -* Try the next sibling. -*/ -if (child->d_u.d_child.next != &parent->d_subdirs) { - child =list_entry (child->d_u.d_child.next, - struct dentry, - d_u.d_child); - goto next_sibling; - } - -/* -* Avoid infinite loop if we fail to remove -* one dentry. -*/ -mutex_unlock (&parent->d_inode->i_mutex); -break ; - } -simple_release_fs (&debugfs_mount, &debugfs_mount_count); + up: +if (!__debugfs_remove (child, parent)) +simple_release_fs (&debugfs_mount, &debugfs_mount_count); } - parent = dentry->d_parent; +mutex_unlock (&parent->d_inode->i_mutex); + child = parent; + parent = parent->d_parent;mutex_lock (&parent->d_inode->i_mutex); -__debugfs_remove (dentry, parent); + +if (child != dentry) { + next = list_entry(child->d_u.d_child.next, struct dentry, + d_u.d_child); + goto up; + } + +if (!__debugfs_remove (child, parent)) +simple_release_fs (&debugfs_mount, &debugfs_mount_count);mutex_unlock (&parent->d_inode->i_mutex); -simple_release_fs (&debugfs_mount, &debugfs_mount_count); }EXPORT_SYMBOL_GPL (debugfs_remove_recursive);
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 187/251 reiserfs: fix deadlock in umount
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 672fe15d091ce76d6fb98e489962e9add7c1ba4c ]
Since remove_proc_entry() started to wait for IO in progress (i.e. since 2007 or so), the locking in fs/reiserfs/proc.c became wrong; if procfs read happens between the moment when umount() locks the victim superblock and removal of /proc/fs/reiserfs/<device>/*, we'll get a deadlock - read will wait for s_umount (in sget(), called by r_start()), while umount will wait in remove_proc_entry() for that read to finish, holding s_umount all along.
Fortunately, the same change allows a much simpler race avoidance - all we need to do is remove the procfs entries in the very beginning of reiserfs ->kill_sb(); that'll guarantee that pointer to superblock will remain valid for the duration for procfs IO, so we don't need sget() to keep the sucker alive. As the matter of fact, we can get rid of the home-grown iterator completely, and use single_open() instead.
--- fs/reiserfs/procfs.c | 92 +++++++++++--------------------------------------- fs/reiserfs/super.c | 3 +- 2 files changed, 20 insertions(+), 75 deletions(-)
fs/reiserfs/procfs.c +19 -73
@@ -19,12 +19,13 @@/* * LOCKING: * -* We rely on new Alexander Viro's super-block locking. +* These guys are evicted from procfs as the very first step in ->kill_sb(). * */ -static int show_version (struct seq_file *m,struct super_block *sb) +static int show_version (struct seq_file *m,void *unused) { +struct super_block *sb = m->private;char *format;if (REISERFS_SB (sb)->s_properties & (1 <<REISERFS_3_6 )) {
@@ -66,8 +67,9 @@ static int show_version(struct seq_file *m, struct super_block *sb)#define DJP ( x ) le32_to_cpu( jp -> x )#define JF ( x ) ( r -> s_journal -> x ) -static int show_super (struct seq_file *m,struct super_block *sb) +static int show_super (struct seq_file *m,void *unused) { +struct super_block *sb = m->private;struct reiserfs_sb_info *r =REISERFS_SB (sb); seq_printf(m, "state: \t%s\n"
@@ -128,8 +130,9 @@ static int show_super(struct seq_file *m, struct super_block *sb)return 0 ; } -static int show_per_level (struct seq_file *m,struct super_block *sb) +static int show_per_level (struct seq_file *m,void *unused) { +struct super_block *sb = m->private;struct reiserfs_sb_info *r =REISERFS_SB (sb);int level;
@@ -186,8 +189,9 @@ static int show_per_level(struct seq_file *m, struct super_block *sb)return 0 ; } -static int show_bitmap (struct seq_file *m,struct super_block *sb) +static int show_bitmap (struct seq_file *m,void *unused) { +struct super_block *sb = m->private;struct reiserfs_sb_info *r =REISERFS_SB (sb); seq_printf(m, "free_block: %lu\n"
@@ -218,8 +222,9 @@ static int show_bitmap(struct seq_file *m, struct super_block *sb)return 0 ; } -static int show_on_disk_super (struct seq_file *m,struct super_block *sb) +static int show_on_disk_super (struct seq_file *m,void *unused) { +struct super_block *sb = m->private;struct reiserfs_sb_info *sb_info =REISERFS_SB (sb);struct reiserfs_super_block *rs = sb_info->s_rs;int hash_code =DFL (s_hash_function_code);
@@ -261,8 +266,9 @@ static int show_on_disk_super(struct seq_file *m, struct super_block *sb)return 0 ; } -static int show_oidmap (struct seq_file *m,struct super_block *sb) +static int show_oidmap (struct seq_file *m,void *unused) { +struct super_block *sb = m->private;struct reiserfs_sb_info *sb_info =REISERFS_SB (sb);struct reiserfs_super_block *rs = sb_info->s_rs;unsigned int mapsize =le16_to_cpu (rs->s_v1.s_oid_cursize);
@@ -291,8 +297,9 @@ static int show_oidmap(struct seq_file *m, struct super_block *sb)return 0 ; } -static int show_journal (struct seq_file *m,struct super_block *sb) +static int show_journal (struct seq_file *m,void *unused) { +struct super_block *sb = m->private;struct reiserfs_sb_info *r =REISERFS_SB (sb);struct reiserfs_super_block *rs = r->s_rs;struct journal_params *jp = &rs->s_v1.s_journal;
@@ -383,85 +390,24 @@ static int show_journal(struct seq_file *m, struct super_block *sb)return 0 ; } -/* iterator */ -static int test_sb (struct super_block *sb,void *data) -{ -return data == sb; -} - -static int set_sb (struct super_block *sb,void *data) -{ -return -ENOENT ; -} - -static void *r_start (struct seq_file *m,loff_t * pos) -{ -struct proc_dir_entry *de = m->private; -struct super_block *s = de->parent->data; -loff_t l = *pos; - -if (l) -return NULL ; - -if (IS_ERR (sget (&reiserfs_fs_type, test_sb, set_sb,0 , s))) -return NULL ; - -up_write (&s->s_umount); -return s; -} - -static void *r_next (struct seq_file *m,void *v,loff_t * pos) -{ - ++*pos; -if (v) -deactivate_super (v); -return NULL ; -} - -static void r_stop (struct seq_file *m,void *v) -{ -if (v) -deactivate_super (v); -} - -static int r_show (struct seq_file *m,void *v) -{ -struct proc_dir_entry *de = m->private; -int (*show) (struct seq_file *,struct super_block *) = de->data; -return show (m, v); -} - -static const struct seq_operations r_ops = { - .start = r_start, - .next = r_next, - .stop = r_stop, - .show = r_show, -}; -static int r_open (struct inode *inode,struct file *file) { -int ret =seq_open (file, &r_ops); - -if (!ret) { -struct seq_file *m = file->private_data; - m->private =PDE (inode); - } -return ret; +return single_open (file,PDE (inode)->data, +PDE (inode)->parent->data); }static const struct file_operations r_file_operations = { .open = r_open, .read = seq_read, .llseek = seq_lseek, - .release = seq_release, - .owner =THIS_MODULE , + .release = single_release, };static struct proc_dir_entry *proc_info_root =NULL ;static const char proc_info_root_name[] ="fs/reiserfs" ;static void add_file (struct super_block *sb,char *name, -int (*func) (struct seq_file *,struct super_block *)) +int (*func) (struct seq_file *,void *)) {proc_create_data (name,0 ,REISERFS_SB (sb)->procdir, &r_file_operations, func);
fs/reiserfs/super.c +1 -2
@@ -499,6 +499,7 @@ int remove_save_link(struct inode *inode, int truncate)static void reiserfs_kill_sb (struct super_block *s) {if (REISERFS_SB (s)) { +reiserfs_proc_info_done (s);/* * Force any pending inode evictions to occur now. Any * inodes to be removed that have extended attributes
@@ -554,8 +555,6 @@ static void reiserfs_put_super(struct super_block *s) REISERFS_SB(s)->reserved_blocks); } -reiserfs_proc_info_done (s); -reiserfs_write_unlock (s);mutex_destroy (&REISERFS_SB (s)->lock);kfree (s->s_fs_info);
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 188/251 nsp32: use mdelay instead of large udelay constants
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit b497ceb964a80ebada3b9b3cea4261409039e25a ]
ARM cannot handle udelay for more than 2 miliseconds, so we should use mdelay instead for those.
--- drivers/scsi/nsp32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/nsp32.c +1 -1
@@ -2926,7 +2926,7 @@ static void nsp32_do_bus_reset(nsp32_hw_data *data)* reset SCSI bus */ nsp32_write1 (base,SCSI_BUS_CONTROL ,BUSCTL_RST ); -udelay (RESET_HOLD_TIME ); +mdelay (RESET_HOLD_TIME /1000 );nsp32_write1 (base,SCSI_BUS_CONTROL ,0 );for (i =0 ; i <5 ; i++) { intrdat =nsp32_read2 (base,IRQ_STATUS );/* dummy read */
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 189/251 mtd: omap2: allow bulding as a module
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 930d800bded771b26d9944c47810829130ff7c8c ]
The omap2 nand device driver calls into the the elm code, which can be a loadable module, and in that case it cannot be built-in itself. I can see no reason why the omap2 driver cannot also be a module, so let's make the option "tristate" in Kconfig to fix this allmodconfig build error:
ERROR: "elm_config" [drivers/mtd/nand/omap2.ko] undefined!
ERROR: "elm_decode_bch_error_page" [drivers/mtd/nand/omap2.ko] undefined!
--- drivers/mtd/nand/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/Kconfig +1 -1
@@ -117,7 +117,7 @@ config MTD_NAND_OMAP2 config MTD_NAND_OMAP_BCH depends on MTD_NAND && MTD_NAND_OMAP2 && ARCH_OMAP3 - bool "Enable support for hardware BCH error correction" + tristate "Enable support for hardware BCH error correction" default n select BCH select BCH_CONST_PARAMS
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 190/251 MIPS: Expose missing pci_io{map,unmap} declarations
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Markos Chandras <[email protected]>
[ Upstream commit 78857614104a26cdada4c53eea104752042bf5a1 ]
The GENERIC_PCI_IOMAP does not depend on CONFIG_PCI so move it to the CONFIG_MIPS symbol so it's always selected for MIPS. This fixes the missing pci_iomap declaration for MIPS. Moreover, the pci_iounmap function was not defined in the io.h header file if the CONFIG_PCI symbol is not set, but it should since MIPS is not using CONFIG_GENERIC_IOMAP.
This fixes the following problem on a allyesconfig:
drivers/net/ethernet/3com/3c59x.c:1031:2: error: implicit declaration of function 'pci_iomap' [-Werror=implicit-function-declaration] drivers/net/ethernet/3com/3c59x.c:1044:3: error: implicit declaration of function 'pci_iounmap' [-Werror=implicit-function-declaration]
Patchwork: https://patchwork.linux-mips.org/patch/5478/
--- arch/mips/Kconfig | 2 +- arch/mips/include/asm/io.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
arch/mips/Kconfig +1 -1
@@ -26,6 +26,7 @@ config MIPS select HAVE_GENERIC_HARDIRQS select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW + select GENERIC_PCI_IOMAP select HAVE_ARCH_JUMP_LABEL select ARCH_WANT_IPC_PARSE_VERSION select IRQ_FORCED_THREADING
@@ -2392,7 +2393,6 @@ config PCI bool "Support for PCI controller" depends on HW_HAS_PCI select PCI_DOMAINS - select GENERIC_PCI_IOMAP select NO_GENERIC_PCI_IOPORT_MAP help Find out whether you have a PCI motherboard. PCI is the name of a
arch/mips/include/asm/io.h +5 -0
@@ -169,6 +169,11 @@ static inline void * isa_bus_to_virt(unsigned long address)extern void __iomem *__ioremap (phys_t offset,phys_t size,unsigned long flags);extern void __iounmap (const volatile void __iomem *addr); +#ifndef CONFIG_PCI +struct pci_dev ; +static inline void pci_iounmap (struct pci_dev *dev,void __iomem *addr) {} +#endif +static inline void __iomem *__ioremap_mode (phys_t offset,unsigned long size,unsigned long flags) {
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 191/251 perf/x86: Fix intel QPI uncore event definitions
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Vince Weaver <[email protected]>
[ Upstream commit c9601247f8f3fdc18aed7ed7e490e8dfcd07f122 ]
John McCalpin reports that the "drs_data" and "ncb_data" QPI uncore events are missing the "extra bit" and always return zero values unless the bit is properly set.
More details from him:
According to the Xeon E5-2600 Product Family Uncore Performance Monitoring Guide, Table 2-94, about 1/2 of the QPI Link Layer events (including the ones that "perf" calls "drs_data" and "ncb_data") require that the "extra bit" be set.
This was confusing for a while -- a note at the bottom of page 94 says that the "extra bit" is bit 16 of the control register. Unfortunately, Table 2-86 clearly says that bit 16 is reserved and must be zero. Looking around a bit, I found that bit 21 appears to be the correct "extra bit", and further investigation shows that "perf" actually agrees with me:
[[email protected]]# cat /sys/bus/event_source/devices/uncore_qpi_0/format/event config:0-7,21
So the command
# perf -e "uncore_qpi_0/event=drs_data/" Is the same as # perf -e "uncore_qpi_0/event=0x02,umask=0x08/" While it should be # perf -e "uncore_qpi_0/event=0x102,umask=0x08/"
I confirmed that this last version gives results that agree with the amount of data that I expected the STREAM benchmark to move across the QPI link in the second (cross-chip) test of the original script.
--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +2 -2
@@ -313,8 +313,8 @@ static struct uncore_event_desc snbep_uncore_imc_events[] = {static struct uncore_event_desc snbep_uncore_qpi_events[] = {INTEL_UNCORE_EVENT_DESC (clockticks,"event=0x14" ),INTEL_UNCORE_EVENT_DESC (txl_flits_active,"event=0x00,umask=0x06" ), -INTEL_UNCORE_EVENT_DESC (drs_data,"event=0x02,umask=0x08" ), -INTEL_UNCORE_EVENT_DESC (ncb_data,"event=0x03,umask=0x04" ), +INTEL_UNCORE_EVENT_DESC (drs_data,"event=0x102,umask=0x08" ), +INTEL_UNCORE_EVENT_DESC (ncb_data,"event=0x103,umask=0x04" ), {/* end: all zeroes */ }, };
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 192/251 perf/arm: Fix armpmu_map_hw_event()
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Stephen Boyd <[email protected]>
[ Upstream commit b88a2595b6d8aedbd275c07dfa784657b4f757eb ]
Fix constraint check in armpmu_map_hw_event().
--- arch/arm/kernel/perf_event.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/kernel/perf_event.c +6 -1
@@ -106,7 +106,12 @@ armpmu_map_cache_event(const unsigned (*cache_map)static int armpmu_map_event (const unsigned (*event_map)[PERF_COUNT_HW_MAX ],u64 config) { -int mapping = (*event_map)[config]; +int mapping; + +if (config >=PERF_COUNT_HW_MAX ) +return -ENOENT ; + + mapping = (*event_map)[config];return mapping ==HW_OP_UNSUPPORTED ? -ENOENT : mapping; }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 193/251 x86 get_unmapped_area(): use proper mmap base for bottom-up direction
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Radu Caragea <[email protected]>
[ Upstream commit df54d6fa54275ce59660453e29d1228c2b45a826 ]
When the stack is set to unlimited, the bottomup direction is used for mmap-ings but the mmap_base is not used and thus effectively renders ASLR for mmapings along with PIE useless.
--- arch/x86/kernel/sys_x86_64.c | 2 +- arch/x86/mm/mmap.c | 2 +- include/linux/sched.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)
arch/x86/kernel/sys_x86_64.c +1 -1
@@ -115,7 +115,7 @@ static void find_start_end(unsigned long flags, unsigned long *begin, *begin = new_begin; } }else { - *begin =TASK_UNMAPPED_BASE ; + *begin =mmap_legacy_base (); *end =TASK_SIZE ; } }
arch/x86/mm/mmap.c +1 -1
@@ -98,7 +98,7 @@ static unsigned long mmap_base(void)* Bottom-up (legacy) layout on X86_32 did not support randomization, X86_64 * does, but not when emulating X86_32 */ -static unsigned long mmap_legacy_base (void ) +unsigned long mmap_legacy_base (void ) {if (mmap_is_ia32 ())return TASK_UNMAPPED_BASE ;
include/linux/sched.h +1 -0
@@ -388,6 +388,7 @@ extern int sysctl_max_map_count;#include <linux/aio.h> #ifdef CONFIG_MMU +extern unsigned long mmap_legacy_base (void );extern void arch_pick_mmap_layout (struct mm_struct *mm); extern unsigned long arch_get_unmapped_area(struct file *, unsigned long, unsigned long,
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 194/251 fs/proc/task_mmu.c: fix buffer overflow in add_page_map()
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: yonghua zheng <[email protected]>
[ Upstream commit 8c8296223f3abb142be8fc31711b18a704c0e7d8 ]
Recently we met quite a lot of random kernel panic issues after enabling CONFIG_PROC_PAGE_MONITOR. After debuggind we found this has something to do with following bug in pagemap:
In struct pagemapread:
struct pagemapread {
int pos, len;
pagemap_entry_t *buffer;
bool v2;
};pos is number of PM_ENTRY_BYTES in buffer, but len is the size of buffer, it is a mistake to compare pos and len in add_page_map() for checking buffer is full or not, and this can lead to buffer overflow and random kernel panic issue.
Correct len to be total number of PM_ENTRY_BYTES in buffer.
--- fs/proc/task_mmu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/proc/task_mmu.c +4 -4
@@ -693,14 +693,14 @@ typedef struct { } pagemap_entry_t;struct pagemapread { -int pos, len; +int pos, len;/* units: PM_ENTRY_BYTES, not bytes */ pagemap_entry_t *buffer; };#define PAGEMAP_WALK_SIZE (PMD_SIZE)#define PAGEMAP_WALK_MASK (PMD_MASK) -#define PM_ENTRY_BYTES sizeof(u64) +#define PM_ENTRY_BYTES sizeof(pagemap_entry_t)#define PM_STATUS_BITS 3#define PM_STATUS_OFFSET (64 - PM_STATUS_BITS)#define PM_STATUS_MASK (((1LL << PM_STATUS_BITS) - 1) << PM_STATUS_OFFSET)
@@ -939,8 +939,8 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,if (!count) goto out_task; - pm.len =PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >>PAGE_SHIFT ); - pm.buffer =kmalloc (pm.len,GFP_TEMPORARY ); + pm.len = (PAGEMAP_WALK_SIZE >>PAGE_SHIFT ); + pm.buffer =kmalloc (pm.len *PM_ENTRY_BYTES ,GFP_TEMPORARY ); ret = -ENOMEM ;if (!pm.buffer) goto out_task;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 195/251 elevator: Fix a race in elevator switching
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jianpeng Ma <[email protected]>
[ Upstream commit d50235b7bc3ee0a0427984d763ea7534149531b4 ]
There's a race between elevator switching and normal io operation.
Because the allocation of struct elevator_queue and struct elevator_data don't in a atomic operation.So there are have chance to use NULL ->elevator_data.
For example:
Thread A: Thread B
blk_queu_bio elevator_switch
spin_lock_irq(q->queue_block) elevator_alloc
elv_merge elevator_init_fn
Because call elevator_alloc, it can't hold queue_lock and the ->elevator_data is NULL.So at the same time, threadA call elv_merge and nedd some info of elevator_data.So the crash happened.
Move the elevator_alloc into func elevator_init_fn, it make the operations in a atomic operation.
Using the follow method can easy reproduce this bug
1:dd if=/dev/sdb of=/dev/null
2:while true;do echo noop > scheduler;echo deadline > scheduler;done
The test method also use this method.
--- block/cfq-iosched.c | 17 ++++++++++++++--- block/deadline-iosched.c | 16 +++++++++++++--- block/elevator.c | 25 +++++-------------------- block/noop-iosched.c | 17 ++++++++++++++--- include/linux/elevator.h | 6 +++++- 5 files changed, 51 insertions(+), 30 deletions(-)
block/cfq-iosched.c +14 -3
@@ -3959,18 +3959,28 @@ static void cfq_exit_queue(struct elevator_queue *e)kfree (cfqd); } -static int cfq_init_queue (struct request_queue *q) +static int cfq_init_queue (struct request_queue *q,struct elevator_type *e) {struct cfq_data *cfqd;struct blkcg_gq *blkg__maybe_unused ;int i, ret; +struct elevator_queue *eq; + + eq =elevator_alloc (q, e); +if (!eq) +return -ENOMEM ; cfqd =kmalloc_node (sizeof (*cfqd),GFP_KERNEL | __GFP_ZERO, q->node); -if (!cfqd) +if (!cfqd) { +kobject_put (&eq->kobj);return -ENOMEM ; + } + eq->elevator_data = cfqd; cfqd->queue = q; - q->elevator->elevator_data = cfqd; +spin_lock_irq (q->queue_lock); + q->elevator = eq; +spin_unlock_irq (q->queue_lock);/* Init root service tree */ cfqd->grp_service_tree =CFQ_RB_ROOT ;
@@ -4044,6 +4054,7 @@ static int cfq_init_queue(struct request_queue *q) out_free:kfree (cfqd); +kobject_put (&eq->kobj);return ret; }
block/deadline-iosched.c +13 -3
@@ -337,13 +337,21 @@ static void deadline_exit_queue(struct elevator_queue *e)/* * initialize elevator private data (deadline_data). */ -static int deadline_init_queue (struct request_queue *q) +static int deadline_init_queue (struct request_queue *q,struct elevator_type *e) {struct deadline_data *dd; +struct elevator_queue *eq; + + eq =elevator_alloc (q, e); +if (!eq) +return -ENOMEM ; dd =kmalloc_node (sizeof (*dd),GFP_KERNEL | __GFP_ZERO, q->node); -if (!dd) +if (!dd) { +kobject_put (&eq->kobj);return -ENOMEM ; + } + eq->elevator_data = dd;INIT_LIST_HEAD (&dd->fifo_list[READ ]);INIT_LIST_HEAD (&dd->fifo_list[WRITE ]);
@@ -355,7 +363,9 @@ static int deadline_init_queue(struct request_queue *q) dd->front_merges =1 ; dd->fifo_batch = fifo_batch; - q->elevator->elevator_data = dd; +spin_lock_irq (q->queue_lock); + q->elevator = eq; +spin_unlock_irq (q->queue_lock);return 0 ; }
block/elevator.c +5 -20
@@ -138,7 +138,7 @@ __setup("elevator=", elevator_setup);static struct kobj_type elv_ktype; -static struct elevator_queue *elevator_alloc (struct request_queue *q, +struct elevator_queue *elevator_alloc (struct request_queue *q,struct elevator_type *e) {struct elevator_queue *eq;
@@ -166,6 +166,7 @@ err:elevator_put (e);return NULL ; } +EXPORT_SYMBOL (elevator_alloc);static void elevator_release (struct kobject *kobj) {
@@ -213,16 +214,7 @@ int elevator_init(struct request_queue *q, char *name) } } - q->elevator =elevator_alloc (q, e); -if (!q->elevator) -return -ENOMEM ; - - err = e->ops.elevator_init_fn (q); -if (err) { -kobject_put (&q->elevator->kobj); -return err; - } - + err = e->ops.elevator_init_fn (q, e);return 0 ; }EXPORT_SYMBOL (elevator_init);
@@ -897,16 +889,9 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e)spin_unlock_irq (q->queue_lock);/* allocate, init and register new elevator */ - err = -ENOMEM ; - q->elevator =elevator_alloc (q, new_e); -if (!q->elevator) - goto fail_init; - - err = new_e->ops.elevator_init_fn (q); -if (err) { -kobject_put (&q->elevator->kobj); + err = new_e->ops.elevator_init_fn (q, new_e); +if (err) goto fail_init; - }if (registered) { err =elv_register_queue (q);
block/noop-iosched.c +14 -3
@@ -59,16 +59,27 @@ noop_latter_request(struct request_queue *q, struct request *rq) return list_entry(rq->queuelist.next, struct request, queuelist); } -static int noop_init_queue (struct request_queue *q) +static int noop_init_queue (struct request_queue *q,struct elevator_type *e) {struct noop_data *nd; +struct elevator_queue *eq; + + eq =elevator_alloc (q, e); +if (!eq) +return -ENOMEM ; nd =kmalloc_node (sizeof (*nd),GFP_KERNEL , q->node); -if (!nd) +if (!nd) { +kobject_put (&eq->kobj);return -ENOMEM ; + } + eq->elevator_data = nd;INIT_LIST_HEAD (&nd->queue); - q->elevator->elevator_data = nd; + +spin_lock_irq (q->queue_lock); + q->elevator = eq; +spin_unlock_irq (q->queue_lock);return 0 ; }
include/linux/elevator.h +5 -1
@@ -6,6 +6,7 @@#ifdef CONFIG_BLOCK struct io_cq ; +struct elevator_type ;typedef int (elevator_merge_fn ) (struct request_queue *,struct request **,struct bio *);
@@ -34,7 +35,8 @@ typedef void (elevator_put_req_fn) (struct request *);typedef void (elevator_activate_req_fn ) (struct request_queue *,struct request *);typedef void (elevator_deactivate_req_fn ) (struct request_queue *,struct request *); -typedef int (elevator_init_fn ) (struct request_queue *); +typedef int (elevator_init_fn ) (struct request_queue *, +struct elevator_type *e);typedef void (elevator_exit_fn ) (struct elevator_queue *);struct elevator_ops
@@ -151,6 +153,8 @@ extern int elevator_init(struct request_queue *, char *);extern void elevator_exit (struct elevator_queue *);extern int elevator_change (struct request_queue *,const char *);extern bool elv_rq_merge_ok (struct request *,struct bio *); +extern struct elevator_queue *elevator_alloc (struct request_queue *, +struct elevator_type *);/* * Helper functions.
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 196/251 iwl4965: set power mode early
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
[ Upstream commit eca396d7a5bdcc1fd67b1b12f737c213ac78a6f4 ]
If device was put into a sleep and system was restarted or module reloaded, we have to wake device up before sending other commands. Otherwise it will fail to start with Microcode error.
--- drivers/net/wireless/iwlegacy/4965-mac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/iwlegacy/4965-mac.c +3 -3
@@ -5285,6 +5285,9 @@ il4965_alive_start(struct il_priv *il) il->active_rate =RATES_MASK ; +il_power_update_mode (il, true); +D_INFO ("Updated power mode\n" ); +if (il_is_associated (il)) {struct il_rxon_cmd *active_rxon = (struct il_rxon_cmd *)&il->active;
@@ -5315,9 +5318,6 @@ il4965_alive_start(struct il_priv *il)D_INFO ("ALIVE processing complete.\n" );wake_up (&il->wait_command_queue); -il_power_update_mode (il, true); -D_INFO ("Updated power mode\n" ); -return ; restart:
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 197/251 iwl4965: reset firmware after rfkill off
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
[ Upstream commit 788f7a56fce1bcb2067b62b851a086fca48a0056 ]
Using rfkill switch can make firmware unstable, what cause various Microcode errors and kernel warnings. Reseting firmware just after rfkill off (radio on) helped with that.
Resolve:
https://bugzilla.redhat.com/show_bug.cgi?id=977053
--- drivers/net/wireless/iwlegacy/4965-mac.c | 10 +++++----- drivers/net/wireless/iwlegacy/common.c | 1 + 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlegacy/4965-mac.c +5 -5
@@ -4411,12 +4411,12 @@ il4965_irq_tasklet(struct il_priv *il)* is killed. Hence update the killswitch state here. The * rfkill handler will care about restarting if needed. */ -if (!test_bit (S_ALIVE , &il->status)) { -if (hw_rf_kill) -set_bit (S_RFKILL , &il->status); -else -clear_bit (S_RFKILL , &il->status); +if (hw_rf_kill) { +set_bit (S_RFKILL , &il->status); + }else { +clear_bit (S_RFKILL , &il->status);wiphy_rfkill_set_hw_state (il->hw->wiphy, hw_rf_kill); +il_force_reset (il, true); } handled |=CSR_INT_BIT_RF_KILL ;
drivers/net/wireless/iwlegacy/common.c +1 -0
@@ -4658,6 +4658,7 @@ il_force_reset(struct il_priv *il, bool external)return 0 ; } +EXPORT_SYMBOL (il_force_reset); int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
Signature · 1 line
1.7.10.4
Re: [197/251] iwl4965: reset firmware after rfkill off
Quoted 8 lines · Steven Rostedt
3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.------------------
From: Stanislaw Gruszka <[email protected]>
[ Upstream commit
788f7a56fce1bcb2067b62b851a086fca48a0056]
This require follow up - upstream commit:
commit b2fcc0aee58a3435566dd6d8501a0b355552f28b
Author: Stanislaw Gruszka <[email protected]> Date: Wed Aug 21 10:18:19 2013 +0200
iwl4965: fix rfkill set state regression
which seems to be missed on the set.
Stanislaw
Steven Rostedt
maintainerRe: [197/251] iwl4965: reset firmware after rfkill off
Quoted 12 lines · On Wed, 11 Sep 2013 09:46:00 +0200 Stanislaw Gruszka <[email protected]>…
Quoted 8 lines · Steven Rostedt
3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.------------------
From: Stanislaw Gruszka <[email protected]>
[ Upstream commit
788f7a56fce1bcb2067b62b851a086fca48a0056]This require follow up - upstream commit:
Quoted 8 lines
commit
b2fcc0aee58a3435566dd6d8501a0b355552f28bAuthor: Stanislaw Gruszka <[email protected]> Date: Wed Aug 21 10:18:19 2013 +0200iwl4965: fix rfkill set state regression
which seems to be missed on the set.
Thanks! I added this:
Quoted 1 line
From
7bde0f4f59e18d5fceadeb6447addfb65ac6c539Mon Sep 17 00:00:00 2001
From: Stanislaw Gruszka <[email protected]>
Date: Wed, 21 Aug 2013 10:18:19 +0200
Subject: [PATCH] iwl4965: fix rfkill set state regression
[ Upstream commit b2fcc0aee58a3435566dd6d8501a0b355552f28b ]
My current 3.11 fix:
commit 788f7a56fce1bcb2067b62b851a086fca48a0056
Author: Stanislaw Gruszka <[email protected]> Date: Thu Aug 1 12:07:55 2013 +0200
iwl4965: reset firmware after rfkill off
broke rfkill notification to user-space . I missed that bug, because I compiled without CONFIG_RFKILL, sorry about that.
--- drivers/net/wireless/iwlegacy/4965-mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/iwlegacy/4965-mac.c +1 -1
@@ -4415,9 +4415,9 @@ il4965_irq_tasklet(struct il_priv *il)set_bit (S_RFKILL , &il->status); }else {clear_bit (S_RFKILL , &il->status); -wiphy_rfkill_set_hw_state (il->hw->wiphy, hw_rf_kill);il_force_reset (il, true); } +wiphy_rfkill_set_hw_state (il->hw->wiphy, hw_rf_kill); handled |=CSR_INT_BIT_RF_KILL ; }
Signature · 4 lines
1.7.10.4 -- Steve
Steven Rostedt
maintainerPATCH 198/251 can: pcan_usb: fix wrong memcpy() bytes length
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Stephane Grosjean <[email protected]>
[ Upstream commit 3c322a56b01695df15c70bfdc2d02e0ccd80654e ]
Fix possibly wrong memcpy() bytes length since some CAN records received from PCAN-USB could define a DLC field in range [9..15].
In that case, the real DLC value MUST be used to move forward the record pointer but, only 8 bytes max. MUST be copied into the data field of the struct can_frame object of the skb given to the network core.
--- drivers/net/can/usb/peak_usb/pcan_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/peak_usb/pcan_usb.c +1 -1
@@ -649,7 +649,7 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len)if ((mc->ptr + rec_len) > mc->end) goto decode_failed; -memcpy (cf->data, mc->ptr, rec_len); +memcpy (cf->data, mc->ptr, cf->can_dlc); mc->ptr += rec_len; }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 199/251 genetlink: fix family dump race
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 58ad436fcf49810aa006016107f494c9ac9013db ]
When dumping generic netlink families, only the first dump call is locked with genl_lock(), which protects the list of families, and thus subsequent calls can access the data without locking, racing against family addition/removal. This can cause a crash. Fix it - the locking needs to be conditional because the first time around it's already locked.
A similar bug was reported to me on an old kernel (3.4.47) but the exact scenario that happened there is no longer possible, on those kernels the first round wasn't locked either. Looking at the current code I found the race described above, which had also existed on the old kernel.
--- net/netlink/genetlink.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/netlink/genetlink.c +7 -0
@@ -749,6 +749,10 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)struct net *net =sock_net (skb->sk);int chains_to_skip = cb->args[0 ];int fams_to_skip = cb->args[1 ]; +bool need_locking = chains_to_skip || fams_to_skip; + +if (need_locking) +genl_lock ();for (i = chains_to_skip; i <GENL_FAM_TAB_SIZE ; i++) { n =0 ;
@@ -770,6 +774,9 @@ errout: cb->args[0 ] = i; cb->args[1 ] = n; +if (need_locking) +genl_unlock (); +return skb->len; }
Signature · 1 line
1.7.10.4
RE: [199/251] genetlink: fix family dump race
Quoted 2 lines
3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
Yes, this patch is broken and we reverted it upstream.
johannes
Signature · 8 lines
Intel GmbH Dornacher Strasse 1 85622 Feldkirchen/Muenchen, Deutschland Sitz der Gesellschaft: Feldkirchen bei Muenchen Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk Registergericht: Muenchen HRB 47456 Ust.-IdNr./VAT Registration No.: DE129385895 Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052
Steven Rostedt
maintainerRe: [199/251] genetlink: fix family dump race
Quoted 4 lines · Johannes
Quoted 2 lines
3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.Yes, this patch is broken and we reverted it upstream.
Thanks! I'll revert it.
-- Steve
Steven Rostedt
maintainerPATCH 200/251 cfg80211: fix P2P GO interface teardown
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 74418edec915d0f446debebde08d170c7b8ba0ee ]
When a P2P GO interface goes down, cfg80211 doesn't properly tear it down, leading to warnings later. Add the GO interface type to the enumeration to tear it down like AP interfaces. Otherwise, we leave it pending and mac80211's state can get very confused, leading to warnings later.
--- net/wireless/core.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/core.c +1 -0
@@ -846,6 +846,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,cfg80211_leave_mesh (rdev, dev);break ;case NL80211_IFTYPE_AP : +case NL80211_IFTYPE_P2P_GO :cfg80211_stop_ap (rdev, dev);break ;default :
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 201/251 ASoC: cs42l52: Reorder Min/Max and update to SX_TLV for Beep Volume
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Brian Austin <[email protected]>
[ Upstream commit e2c98a8bba958045bde861fe1d66be54315c7790 ]
Beep Volume Min/Max was backwards.
Change to SOC_SONGLE_SX_TLV for correct volume representation
--- sound/soc/codecs/cs42l52.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs42l52.c +1 -1
@@ -450,7 +450,7 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = {SOC_ENUM ("Beep Pitch" , beep_pitch_enum),SOC_ENUM ("Beep on Time" , beep_ontime_enum),SOC_ENUM ("Beep off Time" , beep_offtime_enum), -SOC_SINGLE_TLV ("Beep Volume" ,CS42L52_BEEP_VOL ,0 ,0x1f ,0x07 , hl_tlv), +SOC_SINGLE_SX_TLV ("Beep Volume" ,CS42L52_BEEP_VOL ,0 ,0x07 ,0x1f , hl_tlv),SOC_SINGLE ("Beep Mixer Switch" ,CS42L52_BEEP_TONE_CTL ,5 ,1 ,1 ),SOC_ENUM ("Beep Treble Corner Freq" , beep_treble_enum), SOC_ENUM("Beep Bass Corner Freq", beep_bass_enum),
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 202/251 ASoC: tegra: fix Tegra30 I2S capture parameter setup
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Stephen Warren <[email protected]>
[ Upstream commit c90c0d7a96e634a73ef1580f1d20993606545647 ]
The Tegra30 I2S driver was writing the AHUB interface parameters to the playback path register rather than the capture path register. This caused the capture parameters not to be configured at all, so if capturing using non-HW-default parameters (e.g. 16-bit stereo rather than 8-bit mono) the audio would be corrupted.
With this fixed, audio capture from an analog microphone works correctly on the Cardhu board.
--- sound/soc/tegra/tegra30_i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/tegra/tegra30_i2s.c +1 -1
@@ -227,7 +227,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, reg =TEGRA30_I2S_CIF_RX_CTRL ; }else { val |=TEGRA30_AUDIOCIF_CTRL_DIRECTION_TX ; - reg =TEGRA30_I2S_CIF_RX_CTRL ; + reg =TEGRA30_I2S_CIF_TX_CTRL ; }regmap_write (i2s->regmap, reg, val);
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 203/251 ALSA: 6fire: make buffers DMA-able (pcm)
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Torsten Schenk <[email protected]>
[ Upstream commit 5ece263f1d93fba8d992e67e3ab8a71acf674db9 ]
Patch makes pcm buffers DMA-able by allocating each one separately.
--- sound/usb/6fire/pcm.c | 41 ++++++++++++++++++++++++++++++++++++++++- sound/usb/6fire/pcm.h | 2 +- 2 files changed, 41 insertions(+), 2 deletions(-)
sound/usb/6fire/pcm.c +40 -1
@@ -578,6 +578,33 @@ static void __devinit usb6fire_pcm_init_urb(struct pcm_urb *urb, urb->instance.number_of_packets =PCM_N_PACKETS_PER_URB ; } +static int usb6fire_pcm_buffers_init (struct pcm_runtime *rt) +{ +int i; + +for (i =0 ; i <PCM_N_URBS ; i++) { + rt->out_urbs[i].buffer =kzalloc (PCM_N_PACKETS_PER_URB + *PCM_MAX_PACKET_SIZE ,GFP_KERNEL ); +if (!rt->out_urbs[i].buffer) +return -ENOMEM ; + rt->in_urbs[i].buffer =kzalloc (PCM_N_PACKETS_PER_URB + *PCM_MAX_PACKET_SIZE ,GFP_KERNEL ); +if (!rt->in_urbs[i].buffer) +return -ENOMEM ; + } +return 0 ; +} + +static void usb6fire_pcm_buffers_destroy (struct pcm_runtime *rt) +{ +int i; + +for (i =0 ; i <PCM_N_URBS ; i++) { +kfree (rt->out_urbs[i].buffer); +kfree (rt->in_urbs[i].buffer); + } +} +int __devinit usb6fire_pcm_init (struct sfire_chip *chip) {int i;
@@ -589,6 +616,13 @@ int __devinit usb6fire_pcm_init(struct sfire_chip *chip)if (!rt)return -ENOMEM ; + ret =usb6fire_pcm_buffers_init (rt); +if (ret) { +usb6fire_pcm_buffers_destroy (rt); +kfree (rt); +return ret; + } + rt->chip = chip; rt->stream_state =STREAM_DISABLED ; rt->rate =ARRAY_SIZE (rates);
@@ -610,6 +644,7 @@ int __devinit usb6fire_pcm_init(struct sfire_chip *chip) ret =snd_pcm_new (chip->card,"DMX6FireUSB" ,0 ,1 ,1 , &pcm);if (ret <0 ) { +usb6fire_pcm_buffers_destroy (rt);kfree (rt); snd_printk(KERN_ERR PREFIX "cannot create pcm instance.\n");return ret;
@@ -625,6 +660,7 @@ int __devinit usb6fire_pcm_init(struct sfire_chip *chip)snd_dma_continuous_data (GFP_KERNEL ), MAX_BUFSIZE, MAX_BUFSIZE);if (ret) { +usb6fire_pcm_buffers_destroy (rt);kfree (rt); snd_printk(KERN_ERR PREFIX "error preallocating pcm buffers.\n");
@@ -669,6 +705,9 @@ void usb6fire_pcm_abort(struct sfire_chip *chip)void usb6fire_pcm_destroy (struct sfire_chip *chip) { -kfree (chip->pcm); +struct pcm_runtime *rt = chip->pcm; + +usb6fire_pcm_buffers_destroy (rt); +kfree (rt); chip->pcm =NULL ; }
sound/usb/6fire/pcm.h +1 -1
@@ -32,7 +32,7 @@ struct pcm_urb {struct urb instance;struct usb_iso_packet_descriptor packets[PCM_N_PACKETS_PER_URB ];/* END DO NOT SEPARATE */ -u8 buffer[PCM_N_PACKETS_PER_URB *PCM_MAX_PACKET_SIZE ]; +u8 *buffer;struct pcm_urb *peer; };
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 204/251 ALSA: 6fire: make buffers DMA-able (midi)
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Torsten Schenk <[email protected]>
[ Upstream commit 4c2aee0032b70083dafebd733ed9c774633b2fa3 ]
Patch makes midi output buffer DMA-able by allocating it separately.
--- sound/usb/6fire/midi.c | 16 +++++++++++++++- sound/usb/6fire/midi.h | 6 +----- 2 files changed, 16 insertions(+), 6 deletions(-)
sound/usb/6fire/midi.c +15 -1
@@ -19,6 +19,10 @@#include "chip.h" #include "comm.h" +enum { +MIDI_BUFSIZE =64 +}; +static void usb6fire_midi_out_handler (struct urb *urb) {struct midi_runtime *rt = urb->context;
@@ -156,6 +160,12 @@ int __devinit usb6fire_midi_init(struct sfire_chip *chip)if (!rt)return -ENOMEM ; + rt->out_buffer =kzalloc (MIDI_BUFSIZE ,GFP_KERNEL ); +if (!rt->out_buffer) { +kfree (rt); +return -ENOMEM ; + } + rt->chip = chip; rt->in_received = usb6fire_midi_in_received; rt->out_buffer[0 ] =0x80 ;/* 'send midi' command */
@@ -169,6 +179,7 @@ int __devinit usb6fire_midi_init(struct sfire_chip *chip) ret =snd_rawmidi_new (chip->card,"6FireUSB" ,0 ,1 ,1 , &rt->instance);if (ret <0 ) { +kfree (rt->out_buffer);kfree (rt); snd_printk(KERN_ERR PREFIX "unable to create midi.\n");return ret;
@@ -197,6 +208,9 @@ void usb6fire_midi_abort(struct sfire_chip *chip)void usb6fire_midi_destroy (struct sfire_chip *chip) { -kfree (chip->midi); +struct midi_runtime *rt = chip->midi; + +kfree (rt->out_buffer); +kfree (rt); chip->midi =NULL ; }
sound/usb/6fire/midi.h +1 -5
@@ -16,10 +16,6 @@#include "common.h" -enum { -MIDI_BUFSIZE =64 -}; -struct midi_runtime {struct sfire_chip *chip;struct snd_rawmidi *instance;
@@ -32,7 +28,7 @@ struct midi_runtime {struct snd_rawmidi_substream *out;struct urb out_urb;u8 out_serial;/* serial number of out packet */ -u8 out_buffer[MIDI_BUFSIZE ]; +u8 *out_buffer;int buffer_offset;void (*in_received)(struct midi_runtime *rt,u8 *data,int length);
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 205/251 ALSA: hda - Add a fixup for Gateway LT27
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 1801928e0f99d94c55e33c584c5eb2ff5e246ee6 ]
Gateway LT27 needs a fixup for the inverted digital mic.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -6863,6 +6863,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {SND_PCI_QUIRK (0x1025 ,0x0308 ,"Acer Aspire 8942G" ,ALC662_FIXUP_ASPIRE ),SND_PCI_QUIRK (0x1025 ,0x031c ,"Gateway NV79" ,ALC662_FIXUP_SKU_IGNORE ),SND_PCI_QUIRK (0x1025 ,0x0349 ,"eMachines eM250" ,ALC662_FIXUP_INV_DMIC ), +SND_PCI_QUIRK (0x1025 ,0x034a ,"Gateway LT27" ,ALC662_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1025 ,0x038b ,"Acer Aspire 8943G" ,ALC662_FIXUP_ASPIRE ),SND_PCI_QUIRK (0x103c ,0x1632 ,"HP RP5800" ,ALC662_FIXUP_HP_RP5800 ), SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 206/251 usb: add two quirky touchscreen
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
[ Upstream commit 304ab4ab079a8ed03ce39f1d274964a532db036b ]
These devices tend to become unresponsive after S3
--- drivers/usb/core/quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/core/quirks.c +6 -0
@@ -75,6 +75,12 @@ static const struct usb_device_id usb_quirk_list[] = { { USB_DEVICE(0x04d8, 0x000c), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* CarrolTouch 4000U */ + { USB_DEVICE(0x04e7, 0x0009), .driver_info = USB_QUIRK_RESET_RESUME }, + + /* CarrolTouch 4500U */ + { USB_DEVICE(0x04e7, 0x0030), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Samsung Android phone modem - ID conflict with SPH-I500 */ { USB_DEVICE(0x04e8, 0x6601), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 207/251 USB: ti_usb_3410_5052: fix big-endian firmware handling
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit e877dd2f2581628b7119df707d4cf03d940cff49 ]
Fix endianess bugs in firmware handling introduced by commits cb7a7c6a ("ti_usb_3410_5052: add Multi-Tech modem support") and 05a3d905 ("ti_usb_3410_5052: support alternate firmware") which made the driver use the wrong firmware for certain devices on big-endian machines.
--- drivers/usb/serial/ti_usb_3410_5052.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/usb/serial/ti_usb_3410_5052.c +5 -4
@@ -1639,14 +1639,15 @@ static int ti_download_firmware(struct ti_device *tdev)char buf[32 ];/* try ID specific firmware first, then try generic firmware */ -sprintf (buf,"ti_usb-v%04x-p%04x.fw" , dev->descriptor.idVendor, - dev->descriptor.idProduct); +sprintf (buf,"ti_usb-v%04x-p%04x.fw" , +le16_to_cpu (dev->descriptor.idVendor), +le16_to_cpu (dev->descriptor.idProduct)); status =request_firmware (&fw_p, buf, &dev->dev);if (status !=0 ) { buf[0 ] ='\0' ; -if (dev->descriptor.idVendor ==MTS_VENDOR_ID ) { -switch (dev->descriptor.idProduct) { +if (le16_to_cpu (dev->descriptor.idVendor) ==MTS_VENDOR_ID ) { +switch (le16_to_cpu (dev->descriptor.idProduct)) {case MTS_CDMA_PRODUCT_ID :strcpy (buf,"mts_cdma.fw" );break ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 208/251 USB: mos7840: fix big-endian probe
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit d551ec9b690f3de65b0091a2e767f1382adc792d ]
Fix bug in device-type detection on big-endian machines originally introduced by commit 0eafe4de ("USB: serial: mos7840: add support for MCS7810 devices") which always matched on little-endian product ids.
--- drivers/usb/serial/mos7840.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/mos7840.c +1 -1
@@ -2407,7 +2407,7 @@ static int mos7810_check(struct usb_serial *serial)static int mos7840_probe (struct usb_serial *serial,const struct usb_device_id *id) { -u16 product = serial->dev->descriptor.idProduct; +u16 product =le16_to_cpu (serial->dev->descriptor.idProduct);u8 *buf;int device_type;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 209/251 USB: mos7720: fix broken control requests
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit ef6c8c1d733e244f0499035be0dabe1f4ed98c6f ]
The parallel-port code of the drivers used a stack allocated control-request buffer for asynchronous (and possibly deferred) control requests. This not only violates the no-DMA-from-stack requirement but could also lead to corrupt control requests being submitted.
--- drivers/usb/serial/mos7720.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/usb/serial/mos7720.c +14 -7
@@ -97,6 +97,7 @@ struct urbtracker {struct list_head urblist_entry;struct kref ref_count;struct urb *urb; +struct usb_ctrlrequest *setup; };enum mos7715_pp_modes {
@@ -278,6 +279,7 @@ static void destroy_urbtracker(struct kref *kref)struct mos7715_parport *mos_parport = urbtrack->mos_parport;usb_free_urb (urbtrack->urb); +kfree (urbtrack->setup);kfree (urbtrack);kref_put (&mos_parport->ref_count, destroy_mos_parport); }
@@ -360,7 +362,6 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,struct urbtracker *urbtrack;int ret_val;unsigned long flags; -struct usb_ctrlrequest setup;struct usb_serial *serial = mos_parport->serial;struct usb_device *usbdev = serial->dev;
@@ -378,14 +379,20 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,kfree (urbtrack);return -ENOMEM ; } - setup.bRequestType = (__u8 )0x40 ; - setup.bRequest = (__u8 )0x0e ; - setup.wValue =get_reg_value (reg, dummy); - setup.wIndex =get_reg_index (reg); - setup.wLength =0 ; + urbtrack->setup =kmalloc (sizeof (*urbtrack->setup),GFP_KERNEL ); +if (!urbtrack->setup) { +usb_free_urb (urbtrack->urb); +kfree (urbtrack); +return -ENOMEM ; + } + urbtrack->setup->bRequestType = (__u8 )0x40 ; + urbtrack->setup->bRequest = (__u8 )0x0e ; + urbtrack->setup->wValue =get_reg_value (reg, dummy); + urbtrack->setup->wIndex =get_reg_index (reg); + urbtrack->setup->wLength =0 ;usb_fill_control_urb (urbtrack->urb, usbdev,usb_sndctrlpipe (usbdev,0 ), - (unsigned char *)&setup, + (unsigned char *)urbtrack->setup,NULL ,0 , async_complete, urbtrack);kref_init (&urbtrack->ref_count);INIT_LIST_HEAD (&urbtrack->urblist_entry);
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 210/251 USB: keyspan: fix null-deref at disconnect and release
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit ff8a43c10f1440f07a5faca0c1556921259f7f76 ]
Make sure to fail properly if the device is not accepted during attach in order to avoid null-pointer derefs (of missing interface private data) at disconnect or release.
--- drivers/usb/serial/keyspan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/keyspan.c +1 -1
@@ -2389,7 +2389,7 @@ static int keyspan_startup(struct usb_serial *serial)if (d_details ==NULL ) {dev_err (&serial->dev->dev,"%s - unknown product id %x\n" , __func__,le16_to_cpu (serial->dev->descriptor.idProduct)); -return 1 ; +return -ENODEV ; }/* Setup private data for serial driver */
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 211/251 USB-Serial: Fix error handling of usb_wwan
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Matt Burtch <[email protected]>
[ Upstream commit 6c1ee66a0b2bdbd64c078fba684d640cf2fd38a9 ]
This fixes an issue where the bulk-in urb used for incoming data transfer is not resubmitted if the packet recieved contains an error status. This results in the driver locking until the port is closed and re-opened.
Tested on a custom board with a Cinterion GSM module.
--- drivers/usb/serial/usb_wwan.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/usb/serial/usb_wwan.c +10 -10
@@ -299,18 +299,18 @@ static void usb_wwan_indat_callback(struct urb *urb)tty_kref_put (tty); } -/* Resubmit urb so we continue receiving */ - err =usb_submit_urb (urb,GFP_ATOMIC ); -if (err) { -if (err != -EPERM ) { -printk (KERN_ERR "%s: resubmit read urb failed. " -"(%d)" , __func__, err); -/* busy also in error unless we are killed */ -usb_mark_last_busy (port->serial->dev); - } - }else { + } +/* Resubmit urb so we continue receiving */ + err =usb_submit_urb (urb,GFP_ATOMIC ); +if (err) { +if (err != -EPERM ) { +printk (KERN_ERR "%s: resubmit read urb failed. (%d)\n" , + __func__, err); +/* busy also in error unless we are killed */ usb_mark_last_busy (port->serial->dev); } + }else { +usb_mark_last_busy (port->serial->dev); } }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 212/251 wusbcore: fix kernel panic when disconnecting a wireless USB->serial device
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Thomas Pugliese <[email protected]>
[ Upstream commit ec58fad1feb76c323ef47efff1d1e8660ed4644c ]
This patch fixes a kernel panic that can occur when disconnecting a wireless USB->serial device. When the serial device disconnects, the device cleanup procedure ends up calling usb_hcd_disable_endpoint on the serial device's endpoints. The wusbcore uses the ABORT_RPIPE command to abort all transfers on the given endpoint but it does not properly give back the URBs when the transfer results return from the HWA. This patch prevents the transfer result processing code from bailing out when it sees a WA_XFER_STATUS_ABORTED result code so that these urbs are flushed properly by usb_hcd_disable_endpoint. It also updates wa_urb_dequeue to handle the case where the endpoint has already been cleaned up when usb_kill_urb is called which is where the panic originally occurred.
--- drivers/usb/wusbcore/wa-xfer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/usb/wusbcore/wa-xfer.c +7 -2
@@ -1110,6 +1110,12 @@ int wa_urb_dequeue(struct wahc *wa, struct urb *urb) }spin_lock_irqsave (&xfer->lock, flags); rpipe = xfer->ep->hcpriv; +if (rpipe ==NULL ) { +pr_debug ("%s: xfer id 0x%08X has no RPIPE. %s" , + __func__,wa_xfer_id (xfer), +"Probably already aborted.\n" ); + goto out_unlock; + }/* Check the delayed list -> if there, release and complete */ spin_lock_irqsave (&wa->xfer_list_lock, flags2);if (!list_empty (&xfer->list_node) && xfer->seg ==NULL )
@@ -1493,8 +1499,7 @@ static void wa_xfer_result_cb(struct urb *urb)break ; } usb_status = xfer_result->bTransferStatus &0x3f ; -if (usb_status ==WA_XFER_STATUS_ABORTED - || usb_status ==WA_XFER_STATUS_NOT_FOUND ) +if (usb_status ==WA_XFER_STATUS_NOT_FOUND )/* taken care of already */ break ; xfer_id = xfer_result->dwTransferID;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 213/251 ARM: 7809/1: perf: fix event validation for software group leaders
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
[ Upstream commit c95eb3184ea1a3a2551df57190c81da695e2144b ]
It is possible to construct an event group with a software event as a group leader and then subsequently add a hardware event to the group. This results in the event group being validated by adding all members of the group to a fake PMU and attempting to allocate each event on their respective PMU.
Unfortunately, for software events wthout a corresponding arm_pmu, this results in a kernel crash attempting to dereference the ->get_event_idx function pointer.
This patch fixes the problem by checking explicitly for software events and ignoring those in event validation (since they can always be scheduled). We will probably want to revisit this for 3.12, since the validation checks don't appear to work correctly when dealing with multiple hardware PMUs anyway.
--- arch/arm/kernel/perf_event.c | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/kernel/perf_event.c +3 -0
@@ -321,6 +321,9 @@ validate_event(struct pmu_hw_events *hw_events,struct hw_perf_event fake_event = event->hw;struct pmu *leader_pmu = event->group_leader->pmu; +if (is_software_event (event)) +return 1 ; +if (event->pmu != leader_pmu || event->state <PERF_EVENT_STATE_OFF )return 1 ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 214/251 m68k/atari: ARAnyM - Fix NatFeat module support
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit e8184e10f89736a23ea6eea8e24cd524c5c513d2 ]
As pointed out by Andreas Schwab, pointers passed to ARAnyM NatFeat calls should be physical addresses, not virtual addresses.
Fortunately on Atari, physical and virtual kernel addresses are the same, as long as normal kernel memory is concerned, so this usually worked fine without conversion.
But for modules, pointers to literal strings are located in vmalloc()ed memory. Depending on the version of ARAnyM, this causes the nf_get_id() call to just fail, or worse, crash ARAnyM itself with e.g.
Gotcha! Illegal memory access. Atari PC = $968c
This is a big issue for distro kernels, who want to have all drivers as loadable modules in an initrd.
Add a wrapper for nf_get_id() that copies the literal to the stack to work around this issue.
--- arch/m68k/emu/natfeat.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
arch/m68k/emu/natfeat.c +19 -4
@@ -18,9 +18,11 @@#include <asm/machdep.h> #include <asm/natfeat.h> +extern long nf_get_id2 (const char *feature_name); + asm("\n" -" .global nf_get_id,nf_call\n" -"nf_get_id:\n" +" .global nf_get_id2,nf_call\n" +"nf_get_id2:\n" " .short 0x7300\n" " rts\n" "nf_call:\n"
@@ -29,12 +31,25 @@ asm("\n""1: moveq.l #0,%d0\n" " rts\n" " .section __ex_table,\"a\"\n" -" .long nf_get_id,1b\n" +" .long nf_get_id2,1b\n" " .long nf_call,1b\n" " .previous"); -EXPORT_SYMBOL_GPL (nf_get_id);EXPORT_SYMBOL_GPL (nf_call); +long nf_get_id (const char *feature_name) +{ +/* feature_name may be in vmalloc()ed memory, so make a copy */ +char name_copy[32 ]; +size_t n; + + n =strlcpy (name_copy, feature_name,sizeof (name_copy)); +if (n >=sizeof (name_copy)) +return 0 ; + +return nf_get_id2 (name_copy); +} +EXPORT_SYMBOL_GPL (nf_get_id); +void nfprint (const char *fmt, ...) {static char buf[256 ];
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 215/251 jbd2: Fix use after free after error in jbd2_journal_dirty_metadata()
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit 91aa11fae1cf8c2fd67be0609692ea9741cdcc43 ]
When jbd2_journal_dirty_metadata() returns error, __ext4_handle_dirty_metadata() stops the handle. However callers of this function do not count with that fact and still happily used now freed handle. This use after free can result in various issues but very likely we oops soon.
The motivation of adding __ext4_journal_stop() into __ext4_handle_dirty_metadata() in commit 9ea7a0df seems to be only to improve error reporting. So replace __ext4_journal_stop() with ext4_journal_abort_handle() which was there before that commit and add WARN_ON_ONCE() to dump stack to provide useful information.
--- fs/ext4/ext4_jbd2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/ext4/ext4_jbd2.c +4 -4
@@ -109,10 +109,10 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,if (ext4_handle_valid (handle)) { err =jbd2_journal_dirty_metadata (handle, bh); -if (err) { -/* Errors can only happen if there is a bug */ - handle->h_err = err; -__ext4_journal_stop (where, line, handle); +/* Errors can only happen if there is a bug */ +if (WARN_ON_ONCE (err)) { +ext4_journal_abort_handle (where, line, __func__, bh, + handle, err); } }else {if (inode)
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 216/251 ACPI: add _STA evaluation at do_acpi_find_child()
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jeff Wu <[email protected]>
[ Upstream commit c7d9ca90aa9497f0b6e301ec67c52dd4b57a7852 ]
Once do_acpi_find_child() has found the first matching handle, it makes the acpi_get_child() loop stop and return that handle. On some platforms, though, there are multiple devices with the same value of "_ADR" in the same namespace scope, and if one of them is enabled, the others will be disabled. For example:
Address : 0x1FFFF ; path : SB_PCI0.SATA.DEV0
Address : 0x1FFFF ; path : SB_PCI0.SATA.DEV1
Address : 0x1FFFF ; path : SB_PCI0.SATA.DEV2
If DEV0 and DEV1 are disabled and DEV2 is enabled, the handle of DEV2 should be returned, but actually the function always returns the handle of DEV0.
To address that issue, make do_acpi_find_child() evaluate _STA to check the device status. If a matching device object exists, but is disabled, acpi_get_child() will continue to walk the namespace in the hope of finding an enabled one. If one is found, its handle will be returned, but otherwise the function will return the handle of the disabled object found before (in case it is enabled going forward).
--- drivers/acpi/glue.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/acpi/glue.c +4 -2
@@ -91,13 +91,15 @@ static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle)static acpi_status do_acpi_find_child (acpi_handle handle,u32 lvl_not_used,void *addr_p,void **ret_p) { -unsigned long long addr; +unsigned long long addr, sta;acpi_status status; status =acpi_evaluate_integer (handle,METHOD_NAME__ADR ,NULL , &addr);if (ACPI_SUCCESS (status) && addr == *((u64 *)addr_p)) { *ret_p = handle; -return AE_CTRL_TERMINATE ; + status =acpi_bus_get_status_handle (handle, &sta); +if (ACPI_SUCCESS (status) && (sta &ACPI_STA_DEVICE_ENABLED )) +return AE_CTRL_TERMINATE ; }return AE_OK ; }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 217/251 xen/smp: initialize IPI vectors before marking CPU online
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Chuck Anderson <[email protected]>
[ Upstream commit fc78d343fa74514f6fd117b5ef4cd27e4ac30236 ]
An older PVHVM guest (v3.0 based) crashed during vCPU hot-plug with:
kernel BUG at drivers/xen/events.c:1328!
RCU has detected that a CPU has not entered a quiescent state within the grace period. It needs to send the CPU a reschedule IPI if it is not offline. rcu_implicit_offline_qs() does this check:
/*
* If the CPU is offline, it is in a quiescent state. We can
* trust its state not to change because interrupts are disabled.
*/
if (cpu_is_offline(rdp->cpu)) {
rdp->offline_fqs++;
return 1;
}
Else the CPU is online. Send it a reschedule IPI.The CPU is in the middle of being hot-plugged and has been marked online (!cpu_is_offline()). See start_secondary():
set_cpu_online(smp_processor_id(), true); ... per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
start_secondary() then waits for the CPU bringing up the hot-plugged CPU to mark it as active:
/*
* Wait until the cpu which brought this one up marked it
* online before enabling interrupts. If we don't do that then
* we can end up waking up the softirq thread before this cpu
* reached the active state, which makes the scheduler unhappy
* and schedule the softirq thread on the wrong cpu. This is
* only observable with forced threaded interrupts, but in
* theory it could also happen w/o them. It's just way harder
* to achieve.
*/
while (!cpumask_test_cpu(smp_processor_id(), cpu_active_mask))
cpu_relax();
/* enable local interrupts */
local_irq_enable();
The CPU being hot-plugged will be marked active after it has been fully initialized by the CPU managing the hot-plug. In the Xen PVHVM case xen_smp_intr_init() is called to set up the hot-plugged vCPU's XEN_RESCHEDULE_VECTOR.
The hot-plugging CPU is marked online, not marked active and does not have its IPI vectors set up. rcu_implicit_offline_qs() sees the hot-plugging cpu is !cpu_is_offline() and tries to send it a reschedule IPI:
This will lead to:
kernel BUG at drivers/xen/events.c:1328! xen_send_IPI_one() xen_smp_send_reschedule() rcu_implicit_offline_qs() rcu_implicit_dynticks_qs() force_qs_rnp() force_quiescent_state() __rcu_process_callbacks() rcu_process_callbacks() __do_softirq() call_softirq() do_softirq() irq_exit() xen_evtchn_do_upcall()
because xen_send_IPI_one() will attempt to use an uninitialized IRQ for the XEN_RESCHEDULE_VECTOR.
There is at least one other place that has caused the same crash:
xen_smp_send_reschedule() wake_up_idle_cpu() add_timer_on() clocksource_watchdog() call_timer_fn() run_timer_softirq() __do_softirq() call_softirq() do_softirq() irq_exit() xen_evtchn_do_upcall() xen_hvm_callback_vector()
clocksource_watchdog() uses cpu_online_mask to pick the next CPU to handle a watchdog timer:
/* * Cycle through CPUs to check if the CPUs stay synchronized * to each other. */ next_cpu = cpumask_next(raw_smp_processor_id(), cpu_online_mask); if (next_cpu >= nr_cpu_ids) next_cpu = cpumask_first(cpu_online_mask); watchdog_timer.expires += WATCHDOG_INTERVAL; add_timer_on(&watchdog_timer, next_cpu);
This resulted in an attempt to send an IPI to a hot-plugging CPU that had not initialized its reschedule vector. One option would be to make the RCU code check to not check for CPU offline but for CPU active. As becoming active is done after a CPU is online (in older kernels).
But Srivatsa pointed out that "the cpu_active vs cpu_online ordering has been completely reworked - in the online path, cpu_active is set *before* cpu_online, and also, in the cpu offline path, the cpu_active bit is reset in the CPU_DYING notification instead of CPU_DOWN_PREPARE." Drilling in this the bring-up
path: "[brought up CPU].. send out a CPU_STARTING notification, and in response to that, the scheduler sets the CPU in the cpu_active_mask. Again, this mask is better left to the scheduler alone, since it has the intelligence to use it judiciously."
The conclusion was that:
"
1. At the IPI sender side:
It is incorrect to send an IPI to an offline CPU (cpu not present in the cpu_online_mask). There are numerous places where we check this and warn/complain.
2. At the IPI receiver side:
It is incorrect to let the world know of our presence (by setting ourselves in global bitmasks) until our initialization steps are complete to such an extent that we can handle the consequences (such as receiving interrupts without crashing the sender etc.)
" (from Srivatsa)
As the native code enables the interrupts at some point we need to be able to service them. In other words a CPU must have valid IPI vectors if it has been marked online.
It doesn't need to handle the IPI (interrupts may be disabled) but needs to have valid IPI vectors because another CPU may find it in cpu_online_mask and attempt to send it an IPI.
This patch will change the order of the Xen vCPU bring-up functions so that Xen vectors have been set up before start_secondary() is called. It also will not continue to bring up a Xen vCPU if xen_smp_intr_init() fails to initialize it.
Orabug 13823853
Signed-off-by Chuck Anderson <[email protected]>
--- arch/x86/xen/smp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/x86/xen/smp.c +9 -2
@@ -663,8 +663,15 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)static int __cpuinit xen_hvm_cpu_up (unsigned int cpu,struct task_struct *tidle) {int rc; - rc =native_cpu_up (cpu, tidle); -WARN_ON (xen_smp_intr_init (cpu)); +/* +* xen_smp_intr_init() needs to run before native_cpu_up() +* so that IPI vectors are set up on the booting CPU before +* it is marked online in native_cpu_up(). +*/ + rc =xen_smp_intr_init (cpu); +WARN_ON (rc); +if (!rc) + rc =native_cpu_up (cpu, tidle);return rc; }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 218/251 zd1201: do not use stack as URB transfer_buffer
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jussi Kivilinna <[email protected]>
[ Upstream commit 1206ff4ff9d2ef7468a355328bc58ac6ebf5be44 ]
Patch fixes zd1201 not to use stack as URB transfer_buffer. URB buffers need to be DMA-able, which stack is not.
Patch is only compile tested.
--- drivers/net/wireless/zd1201.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/zd1201.c +3 -1
@@ -98,10 +98,12 @@ static int zd1201_fw_upload(struct usb_device *dev, int apfw) goto exit; err =usb_control_msg (dev,usb_rcvctrlpipe (dev,0 ),0x4 , -USB_DIR_IN |0x40 ,0 ,0 , &ret,sizeof (ret),ZD1201_FW_TIMEOUT ); +USB_DIR_IN |0x40 ,0 ,0 , buf,sizeof (ret),ZD1201_FW_TIMEOUT );if (err <0 ) goto exit; +memcpy (&ret, buf,sizeof (ret)); +if (ret &0x80 ) { err = -EIO ; goto exit;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 219/251 xen/events: initialize local per-cpu mask for all possible events
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: David Vrabel <[email protected]>
[ Upstream commit 84ca7a8e45dafb49cd5ca90a343ba033e2885c17 ]
The sizeof() argument in init_evtchn_cpu_bindings() is incorrect resulting in only the first 64 (or 32 in 32-bit guests) ports having their bindings being initialized to VCPU 0.
In most cases this does not cause a problem as request_irq() will set the irq affinity which will set the correct local per-cpu mask. However, if the request_irq() is called on a VCPU other than 0, there is a window between the unmasking of the event and the affinity being set were an event may be lost because it is not locally unmasked on any VCPU. If request_irq() is called on VCPU 0 then local irqs are disabled during the window and the race does not occur.
Fix this by initializing all NR_EVENT_CHANNEL bits in the local per-cpu masks.
--- drivers/xen/events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/events.c +1 -1
@@ -324,7 +324,7 @@ static void init_evtchn_cpu_bindings(void)for_each_possible_cpu (i)memset (per_cpu (cpu_evtchn_mask, i), - (i ==0 ) ? ~0 :0 ,sizeof (*per_cpu (cpu_evtchn_mask, i))); + (i ==0 ) ? ~0 :0 ,NR_EVENT_CHANNELS /8 ); }static inline void clear_evtchn (int port)
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 220/251 ARM: davinci: nand: specify ecc strength
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sekhar Nori <[email protected]>
[ Upstream commit acd36357edc08649e85ff15dc4ed62353c912eff ]
Starting with kernel v3.5, it is mandatory to specify ECC strength when using hardware ECC. Without this, kernel panics with a warning of the sort:
Driver must set ecc.strength when using hardware ECC
------------[ cut here ]------------ kernel BUG at drivers/mtd/nand/nand_base.c:3519!
Fix this by specifying ECC strength for the boards which were missing this.
--- arch/arm/mach-davinci/board-dm355-leopard.c | 1 + arch/arm/mach-davinci/board-dm644x-evm.c | 1 + arch/arm/mach-davinci/board-dm646x-evm.c | 1 + arch/arm/mach-davinci/board-neuros-osd2.c | 1 + 4 files changed, 4 insertions(+)
arch/arm/mach-davinci/board-dm355-leopard.c +1 -0
@@ -75,6 +75,7 @@ static struct davinci_nand_pdata davinci_nand_data = { .parts = davinci_nand_partitions, .nr_parts = ARRAY_SIZE(davinci_nand_partitions), .ecc_mode = NAND_ECC_HW_SYNDROME, + .ecc_bits = 4, .bbt_options = NAND_BBT_USE_FLASH, };
arch/arm/mach-davinci/board-dm644x-evm.c +1 -0
@@ -152,6 +152,7 @@ static struct davinci_nand_pdata davinci_evm_nandflash_data = { .parts = davinci_evm_nandflash_partition, .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition), .ecc_mode = NAND_ECC_HW, + .ecc_bits = 1, .bbt_options = NAND_BBT_USE_FLASH, .timing = &davinci_evm_nandflash_timing, };
arch/arm/mach-davinci/board-dm646x-evm.c +1 -0
@@ -89,6 +89,7 @@ static struct davinci_nand_pdata davinci_nand_data = { .parts = davinci_nand_partitions, .nr_parts = ARRAY_SIZE(davinci_nand_partitions), .ecc_mode = NAND_ECC_HW, + .ecc_bits = 1, .options = 0, };
arch/arm/mach-davinci/board-neuros-osd2.c +1 -0
@@ -88,6 +88,7 @@ static struct davinci_nand_pdata davinci_ntosd2_nandflash_data = { .parts = davinci_ntosd2_nandflash_partition, .nr_parts = ARRAY_SIZE(davinci_ntosd2_nandflash_partition), .ecc_mode = NAND_ECC_HW, + .ecc_bits = 1, .bbt_options = NAND_BBT_USE_FLASH, };
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 221/251 ARM: at91/DT: fix at91sam9n12ek memory node
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Nicolas Ferre <[email protected]>
[ Upstream commit a57603ca2871ee0773b00839c1ea35c4a2d3eeb0 ]
--- arch/arm/boot/dts/at91sam9n12ek.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/at91sam9n12ek.dts +2 -2
@@ -14,11 +14,11 @@ compatible = "atmel,at91sam9n12ek", "atmel,at91sam9n12", "atmel,at91sam9"; chosen { - bootargs = "mem=128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"; + bootargs = "console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"; }; memory { - reg = <0x20000000 0x10000000>; + reg = <0x20000000 0x8000000>; }; clocks {
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 222/251 ARM: 7816/1: CONFIG_KUSER_HELPERS: fix help text
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Nicolas Pitre <[email protected]>
[ Upstream commit ac124504ecf6b20a2457d873d0728a8b991a5b0c ]
Commit f6f91b0d9fd9 ("ARM: allow kuser helpers to be removed from the vector page") introduced some help text for the CONFIG_KUSER_HELPERS option which is rather contradictory.
Let's fix that, and improve it a little.
--- arch/arm/mm/Kconfig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/arm/mm/Kconfig +6 -3
@@ -768,15 +768,18 @@ config KUSER_HELPERS the CPU type fitted to the system. This permits binaries to be run on ARMv4 through to ARMv7 without modification. + See Documentation/arm/kernel_user_helpers.txt for details. + However, the fixed address nature of these helpers can be used by ROP (return orientated programming) authors when creating exploits. If all of the binaries and libraries which run on your platform are built specifically for your platform, and make no use of - these helpers, then you can turn this option off. However, - when such an binary or library is run, it will receive a SIGILL - signal, which will terminate the program. + these helpers, then you can turn this option off to hinder + such exploits. However, in that case, if a binary or library + relying on those helpers is run, it will receive a SIGILL signal, + which will terminate the program. Say N here only if you are absolutely certain that you do not need these helpers; otherwise, the safe option is to say Y.
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 223/251 drm/i915: Invalidate TLBs for the rings after a reset
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
[ Upstream commit 884020bf3d2a3787a1cc6df902e98e0eec60330b ]
After any "soft gfx reset" we must manually invalidate the TLBs associated with each ring. Empirically, it seems that a suspend/resume or D3-D0 cycle count as a "soft reset". The symptom is that the hardware would fail to note the new address for its status page, and so it would continue to write the shadow registers and breadcrumbs into the old physical address (now used by something completely different, scary). Whereas the driver would read the new status page and never see any progress, it would appear that the GPU hung immediately upon resume.
Based on a patch by naresh kumar kachhi <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64725
--- drivers/gpu/drm/i915/i915_reg.h | 2 ++ drivers/gpu/drm/i915/intel_ringbuffer.c | 12 ++++++++++++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -575,6 +575,8 @@will not assert AGPBUSY# and will only be delivered when out of C3. */ #define INSTPM_FORCE_ORDERING (1<<7)/* GEN6+ */ +#define INSTPM_TLB_INVALIDATE (1<<9) +#define INSTPM_SYNC_FLUSH (1<<5)#define ACTHD 0x020c8#define FW_BLC 0x020d8#define FW_BLC2 0x020dc
drivers/gpu/drm/i915/intel_ringbuffer.c +12 -0
@@ -793,6 +793,18 @@ void intel_ring_setup_status_page(struct intel_ring_buffer *ring)I915_WRITE (mmio, (u32 )ring->status_page.gfx_addr);POSTING_READ (mmio); + +/* Flush the TLB for this page */ +if (INTEL_INFO (dev)->gen >=6 ) { +u32 reg =RING_INSTPM (ring->mmio_base); +I915_WRITE (reg, +_MASKED_BIT_ENABLE (INSTPM_TLB_INVALIDATE | +INSTPM_SYNC_FLUSH )); +if (wait_for ((I915_READ (reg) &INSTPM_SYNC_FLUSH ) ==0 , +1000 )) +DRM_ERROR ("%s: wait for SyncFlush to complete for TLB invalidation timed out\n" , + ring->name); + } } static int
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 224/251 of: fdt: fix memory initialization for expanded DT
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Wladislav Wiebe <[email protected]>
[ Upstream commit 9e40127526e857fa3f29d51e83277204fbdfc6ba ]
Already existing property flags are filled wrong for properties created from initial FDT. This could cause problems if this DYNAMIC device-tree functions are used later, i.e. properties are attached/detached/replaced. Simply dumping flags from the running system show, that some initial static (not allocated via kzmalloc()) nodes are marked as dynamic.
I putted some debug extensions to property_proc_show(..) :
..
+ if (OF_IS_DYNAMIC(pp))
+ pr_err("DEBUG: xxx : OF_IS_DYNAMIC\n");
+ if (OF_IS_DETACHED(pp))
+ pr_err("DEBUG: xxx : OF_IS_DETACHED\n");
when you operate on the nodes (e.g.: ~$ cat /proc/device-tree/*some_node*) you will see that those flags are filled wrong, basically in most cases it will dump a DYNAMIC or DETACHED status, which is in not true.
(BTW. this OF_IS_DETACHED is a own define for debug purposes which which just make a test_bit(OF_DETACHED, &x->_flags)
If nodes are dynamic kernel is allowed to kfree() them. But it will crash attempting to do so on the nodes from FDT -- they are not allocated via kzmalloc().
--- drivers/of/fdt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/of/fdt.c +2 -0
@@ -390,6 +390,8 @@ static void __unflatten_device_tree(struct boot_param_header *blob, mem = (unsigned long )dt_alloc (size +4 , __alignof__(struct device_node )); +memset ((void *)mem,0 , size); + ((__be32 *)mem)[size /4 ] =cpu_to_be32 (0xdeadbeef );pr_debug (" unflattening %lx...\n" , mem);
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 225/251 nilfs2: remove double bio_put() in nilfs_end_bio_write() for BIO_EOPNOTSUPP error
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Vyacheslav Dubeyko <[email protected]>
[ Upstream commit 2df37a19c686c2d7c4e9b4ce1505b5141e3e5552 ]
Remove double call of bio_put() in nilfs_end_bio_write() for the case of BIO_EOPNOTSUPP error detection. The issue was found by Dan Carpenter and he suggests first version of the fix too.
--- fs/nilfs2/segbuf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nilfs2/segbuf.c +1 -2
@@ -345,8 +345,7 @@ static void nilfs_end_bio_write(struct bio *bio, int err)if (err == -EOPNOTSUPP ) {set_bit (BIO_EOPNOTSUPP , &bio->bi_flags); -bio_put (bio); -/* to be detected by submit_seg_bio() */ +/* to be detected by nilfs_segbuf_submit_bio() */ }if (!uptodate)
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 226/251 nilfs2: fix issue with counting number of bio requests for BIO_EOPNOTSUPP error detection
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Vyacheslav Dubeyko <[email protected]>
[ Upstream commit 4bf93b50fd04118ac7f33a3c2b8a0a1f9fa80bc9 ]
Fix the issue with improper counting number of flying bio requests for BIO_EOPNOTSUPP error detection case.
The sb_nbio must be incremented exactly the same number of times as complete() function was called (or will be called) because nilfs_segbuf_wait() will call wail_for_completion() for the number of times set to sb_nbio:
do {
wait_for_completion(&segbuf->sb_bio_event);
} while (--segbuf->sb_nbio > 0);Two functions complete() and wait_for_completion() must be called the same number of times for the same sb_bio_event. Otherwise, wait_for_completion() will hang or leak.
--- fs/nilfs2/segbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nilfs2/segbuf.c +1 -1
@@ -376,12 +376,12 @@ static int nilfs_segbuf_submit_bio(struct nilfs_segment_buffer *segbuf, bio->bi_private = segbuf;bio_get (bio);submit_bio (mode, bio); + segbuf->sb_nbio++;if (bio_flagged (bio,BIO_EOPNOTSUPP )) {bio_put (bio); err = -EOPNOTSUPP ; goto failed; } - segbuf->sb_nbio++;bio_put (bio); wi->bio =NULL ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 227/251 drivers/platform/olpc/olpc-ec.c: initialise earlier
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Daniel Drake <[email protected]>
[ Upstream commit 93dbc1b3b506e16c1f6d5b5dcfe756a85cb1dc58 ]
Being a low-level component, various drivers (e.g. olpc-battery) assume that it is ok to communicate with the OLPC Embedded Controller during probe. Therefore the OLPC EC driver must be initialised before other drivers try to use it. This was the case until it was recently moved out of arch/x86 and restructured around commits ac2504151f5a ("Platform:
OLPC: turn EC driver into a platform_driver") and 85f90cf6ca56 ("x86:
OLPC: switch over to using new EC driver on x86").
Use arch_initcall so that olpc-ec is readied earlier, matching the previous behaviour.
Fixes a regression introduced in Linux-3.6 where various drivers such as olpc-battery and olpc-xo1-sci failed to load due to an inability to communicate with the EC. The user-visible effect was a lack of battery monitoring, missing ebook/lid switch input devices, etc.
--- drivers/platform/olpc/olpc-ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/olpc/olpc-ec.c +1 -1
@@ -330,7 +330,7 @@ static int __init olpc_ec_init_module(void)return platform_driver_register (&olpc_ec_plat_driver); } -module_init (olpc_ec_init_module); +arch_initcall (olpc_ec_init_module);MODULE_AUTHOR ("Andres Salomon <[email protected]>" );MODULE_LICENSE ("GPL" );
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 228/251 sata_fsl: save irqs while coalescing
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Anthony Foiani <[email protected]>
[ Upstream commit 99bbdfa6bdcb4bdf5be914a48e9b46941bf30819 ]
Before this patch, I was seeing the following lockdep splat on my MPC8315 (PPC32) target:
[ 9.086051] =================================
[ 9.090393] [ INFO: inconsistent lock state ]
[ 9.094744] 3.9.7-ajf-gc39503d #1 Not tainted
[ 9.099087] ---------------------------------
[ 9.103432] inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
[ 9.109431] scsi_eh_1/39 [HC1[1]:SC0[0]:HE0:SE1] takes:
[ 9.114642] (&(&host->lock)->rlock){?.+...}, at: [<c02f4168>] sata_fsl_interrupt+0x50/0x250
[ 9.123137] {HARDIRQ-ON-W} state was registered at:
[ 9.128004] [<c006cdb8>] lock_acquire+0x90/0xf4
[ 9.132737] [<c043ef04>] _raw_spin_lock+0x34/0x4c
[ 9.137645] [<c02f3560>] fsl_sata_set_irq_coalescing+0x68/0x100
[ 9.143750] [<c02f36a0>] sata_fsl_init_controller+0xa8/0xc0
[ 9.149505] [<c02f3f10>] sata_fsl_probe+0x17c/0x2e8
[ 9.154568] [<c02acc90>] driver_probe_device+0x90/0x248
[ 9.159987] [<c02acf0c>] __driver_attach+0xc4/0xc8
[ 9.164964] [<c02aae74>] bus_for_each_dev+0x5c/0xa8
[ 9.170028] [<c02ac218>] bus_add_driver+0x100/0x26c
[ 9.175091] [<c02ad638>] driver_register+0x88/0x198
[ 9.180155] [<c0003a24>] do_one_initcall+0x58/0x1b4
[ 9.185226] [<c05aeeac>] kernel_init_freeable+0x118/0x1c0
[ 9.190823] [<c0004110>] kernel_init+0x18/0x108
[ 9.195542] [<c000f6b8>] ret_from_kernel_thread+0x64/0x6c
[ 9.201142] irq event stamp: 160
[ 9.204366] hardirqs last enabled at (159): [<c043f778>] _raw_spin_unlock_irq+0x30/0x50
[ 9.212469] hardirqs last disabled at (160): [<c000f414>] reenable_mmu+0x30/0x88
[ 9.219867] softirqs last enabled at (144): [<c002ae5c>] __do_softirq+0x168/0x218
[ 9.227435] softirqs last disabled at (137): [<c002b0d4>] irq_exit+0xa8/0xb4
[ 9.234481]
[ 9.234481] other info that might help us debug this:
[ 9.240995] Possible unsafe locking scenario:
[ 9.240995]
[ 9.246898] CPU0
[ 9.249337] ----
[ 9.251776] lock(&(&host->lock)->rlock);
[ 9.255878] <Interrupt>
[ 9.258492] lock(&(&host->lock)->rlock);
[ 9.262765]
[ 9.262765] *** DEADLOCK ***
[ 9.262765]
[ 9.268684] no locks held by scsi_eh_1/39.
[ 9.272767]
[ 9.272767] stack backtrace:
[ 9.277117] Call Trace:
[ 9.279589] [cfff9da0] [c0008504] show_stack+0x48/0x150 (unreliable)
[ 9.285972] [cfff9de0] [c0447d5c] print_usage_bug.part.35+0x268/0x27c
[ 9.292425] [cfff9e10] [c006ace4] mark_lock+0x2ac/0x658
[ 9.297660] [cfff9e40] [c006b7e4] __lock_acquire+0x754/0x1840
[ 9.303414] [cfff9ee0] [c006cdb8] lock_acquire+0x90/0xf4
[ 9.308745] [cfff9f20] [c043ef04] _raw_spin_lock+0x34/0x4c
[ 9.314250] [cfff9f30] [c02f4168] sata_fsl_interrupt+0x50/0x250
[ 9.320187] [cfff9f70] [c0079ff0] handle_irq_event_percpu+0x90/0x254
[ 9.326547] [cfff9fc0] [c007a1fc] handle_irq_event+0x48/0x78
[ 9.332220] [cfff9fe0] [c007c95c] handle_level_irq+0x9c/0x104
[ 9.337981] [cfff9ff0] [c000d978] call_handle_irq+0x18/0x28
[ 9.343568] [cc7139f0] [c000608c] do_IRQ+0xf0/0x1a8
[ 9.348464] [cc713a20] [c000fc8c] ret_from_except+0x0/0x14
[ 9.353983] --- Exception: 501 at _raw_spin_unlock_irq+0x40/0x50
[ 9.353983] LR = _raw_spin_unlock_irq+0x30/0x50
[ 9.364839] [cc713af0] [c043db10] wait_for_common+0xac/0x188
[ 9.370513] [cc713b30] [c02ddee4] ata_exec_internal_sg+0x2b0/0x4f0
[ 9.376699] [cc713be0] [c02de18c] ata_exec_internal+0x68/0xa8
[ 9.382454] [cc713c20] [c02de4b8] ata_dev_read_id+0x158/0x594
[ 9.388205] [cc713ca0] [c02ec244] ata_eh_recover+0xd88/0x13d0
[ 9.393962] [cc713d20] [c02f2520] sata_pmp_error_handler+0xc0/0x8ac
[ 9.400234] [cc713dd0] [c02ecdc8] ata_scsi_port_error_handler+0x464/0x5e8
[ 9.407023] [cc713e10] [c02ecfd0] ata_scsi_error+0x84/0xb8
[ 9.412528] [cc713e40] [c02c4974] scsi_error_handler+0xd8/0x47c
[ 9.418457] [cc713eb0] [c004737c] kthread+0xa8/0xac
[ 9.423355] [cc713f40] [c000f6b8] ret_from_kernel_thread+0x64/0x6cThis fix was suggested by Bhushan Bharat <[email protected]>, and was discussed in email at:
Same patch successfully tested with 3.9.7. linux-next compiled but not tested on hardware.
This patch is based off linux-next tag next-20130819 (which is commit 66a01bae29d11916c09f9f5a937cafe7d402e4a5 )
--- drivers/ata/sata_fsl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/sata_fsl.c +3 -2
@@ -290,6 +290,7 @@ static void fsl_sata_set_irq_coalescing(struct ata_host *host, {struct sata_fsl_host_priv *host_priv = host->private_data;void __iomem *hcr_base = host_priv->hcr_base; +unsigned long flags;if (count >ICC_MAX_INT_COUNT_THRESHOLD ) count =ICC_MAX_INT_COUNT_THRESHOLD ;
@@ -302,12 +303,12 @@ static void fsl_sata_set_irq_coalescing(struct ata_host *host, (count > ICC_MIN_INT_COUNT_THRESHOLD)) ticks =ICC_SAFE_INT_TICKS ; -spin_lock (&host->lock); +spin_lock_irqsave (&host->lock, flags);iowrite32 ((count <<24 | ticks), hcr_base +ICC ); intr_coalescing_count = count; intr_coalescing_ticks = ticks; -spin_unlock (&host->lock); +spin_unlock_irqrestore (&host->lock, flags);DPRINTK ("intrrupt coalescing, count = 0x%x, ticks = %x\n" , intr_coalescing_count, intr_coalescing_ticks);
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 229/251 Hostap: copying wrong data prism2_ioctl_giwaplist()
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 909bd5926d474e275599094acad986af79671ac9 ]
We want the data stored in "addr" and "qual", but the extra ampersands mean we are copying stack data instead.
--- drivers/net/wireless/hostap/hostap_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/hostap/hostap_ioctl.c +2 -2
@@ -522,9 +522,9 @@ static int prism2_ioctl_giwaplist(struct net_device *dev, data->length =prism2_ap_get_sta_qual (local, addr, qual,IW_MAX_AP ,1 ); -memcpy (extra, &addr,sizeof (struct sockaddr ) * data->length); +memcpy (extra, addr,sizeof (struct sockaddr ) * data->length); data->flags =1 ;/* has quality information */ -memcpy (extra +sizeof (struct sockaddr ) * data->length, &qual, +memcpy (extra +sizeof (struct sockaddr ) * data->length, qual,sizeof (struct iw_quality ) * data->length);kfree (addr);
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 230/251 libata: apply behavioral quirks to sil3826 PMP
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Terry Suereth <[email protected]>
[ Upstream commit 8ffff94d20b7eb446e848e0046107d51b17a20a8 ]
Fixing support for the Silicon Image 3826 port multiplier, by applying to it the same quirks applied to the Silicon Image 3726. Specifically fixes the repeated timeout/reset process which previously afflicted the 3726, as described from line 290. Slightly based on notes from:
https://bugzilla.redhat.com/show_bug.cgi?id=890237
--- drivers/ata/libata-pmp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/ata/libata-pmp.c +6 -6
@@ -289,24 +289,24 @@ static int sata_pmp_configure(struct ata_device *dev, int print_info)/* Disable sending Early R_OK. * With "cached read" HDD testing and multiple ports busy on a SATA -* host controller, 3726 PMP will very rarely drop a deferred +* host controller, 3x26 PMP will very rarely drop a deferred * R_OK that was intended for the host. Symptom will be all * 5 drives under test will timeout, get reset, and recover. */ -if (vendor ==0x1095 && devid ==0x3726 ) { +if (vendor ==0x1095 && (devid ==0x3726 || devid ==0x3826 )) {u32 reg; err_mask =sata_pmp_read (&ap->link,PMP_GSCR_SII_POL , ®);if (err_mask) { rc = -EIO ; - reason ="failed to read Sil3726 Private Register" ; + reason ="failed to read Sil3x26 Private Register" ; goto fail; } reg &= ~0x1 ; err_mask =sata_pmp_write (&ap->link,PMP_GSCR_SII_POL , reg);if (err_mask) { rc = -EIO ; - reason ="failed to write Sil3726 Private Register" ; + reason ="failed to write Sil3x26 Private Register" ; goto fail; } }
@@ -383,8 +383,8 @@ static void sata_pmp_quirks(struct ata_port *ap)u16 devid =sata_pmp_gscr_devid (gscr);struct ata_link *link; -if (vendor ==0x1095 && devid ==0x3726 ) { -/* sil3726 quirks */ +if (vendor ==0x1095 && (devid ==0x3726 || devid ==0x3826 )) { +/* sil3x26 quirks */ ata_for_each_link (link, ap,EDGE ) {/* link reports offline after LPM */ link->flags |=ATA_LFLAG_NO_LPM ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 231/251 iwlwifi: dvm: fix calling ieee80211_chswitch_done() with NULL
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
[ Upstream commit 9186a1fd9ed190739423db84bc344d258ef3e3d7 ]
If channel switch is pending and we remove interface we can crash like showed below due to passing NULL vif to mac80211:
BUG: unable to handle kernel paging request at fffffffffffff8cc IP: [<ffffffff8130924d>] strnlen+0xd/0x40 Call Trace: [<ffffffff8130ad2e>] string.isra.3+0x3e/0xd0 [<ffffffff8130bf99>] vsnprintf+0x219/0x640 [<ffffffff8130c481>] vscnprintf+0x11/0x30 [<ffffffff81061585>] vprintk_emit+0x115/0x4f0 [<ffffffff81657bd5>] printk+0x61/0x63 [<ffffffffa048987f>] ieee80211_chswitch_done+0xaf/0xd0 [mac80211] [<ffffffffa04e7b34>] iwl_chswitch_done+0x34/0x40 [iwldvm] [<ffffffffa04f83c3>] iwlagn_commit_rxon+0x2a3/0xdc0 [iwldvm] [<ffffffffa04ebc50>] ? iwlagn_set_rxon_chain+0x180/0x2c0 [iwldvm] [<ffffffffa04e5e76>] iwl_set_mode+0x36/0x40 [iwldvm] [<ffffffffa04e5f0d>] iwlagn_mac_remove_interface+0x8d/0x1b0 [iwldvm] [<ffffffffa0459b3d>] ieee80211_do_stop+0x29d/0x7f0 [mac80211]
This is because we nulify ctx->vif in iwlagn_mac_remove_interface() before calling some other functions that teardown interface. To fix just check ctx->vif on iwl_chswitch_done(). We should not call ieee80211_chswitch_done() as channel switch works were already canceled by mac80211 in ieee80211_do_stop() -> ieee80211_mgd_stop().
Resolve:
https://bugzilla.redhat.com/show_bug.cgi?id=979581
--- drivers/net/wireless/iwlwifi/dvm/mac80211.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/dvm/mac80211.c +4 -1
@@ -941,7 +941,10 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)if (test_bit (STATUS_EXIT_PENDING , &priv->status))return ; -if (test_and_clear_bit (STATUS_CHANNEL_SWITCH_PENDING , &priv->status)) +if (!test_and_clear_bit (STATUS_CHANNEL_SWITCH_PENDING , &priv->status)) +return ; + +if (ctx->vif)ieee80211_chswitch_done (ctx->vif, is_success); }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 232/251 iwlwifi: pcie: disable L1 Active after pci_enable_device
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit eabc4ac5d7606a57ee2b7308cb7323ea8f60183b ]
As Arjan pointed out, we mustn't do anything related to PCI configuration until the device is properly enabled with pci_enable_device().
--- drivers/net/wireless/iwlwifi/pcie/trans.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlwifi/pcie/trans.c +5 -5
@@ -2100,16 +2100,16 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,spin_lock_init (&trans_pcie->irq_lock);init_waitqueue_head (&trans_pcie->ucode_write_waitq); -/* W/A - seems to solve weird behavior. We need to remove this if we -* don't want to stay in L1 all the time. This wastes a lot of power */ -pci_disable_link_state (pdev,PCIE_LINK_STATE_L0S |PCIE_LINK_STATE_L1 | -PCIE_LINK_STATE_CLKPM ); -if (pci_enable_device (pdev)) { err = -ENODEV ; goto out_no_pci; } +/* W/A - seems to solve weird behavior. We need to remove this if we +* don't want to stay in L1 all the time. This wastes a lot of power */ +pci_disable_link_state (pdev,PCIE_LINK_STATE_L0S |PCIE_LINK_STATE_L1 | +PCIE_LINK_STATE_CLKPM ); +pci_set_master (pdev); err =pci_set_dma_mask (pdev,DMA_BIT_MASK (36 ));
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 233/251 zfcp: fix lock imbalance by reworking request queue locking
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Martin Peschke <[email protected]>
[ Upstream commit d79ff142624e1be080ad8d09101f7004d79c36e1 ]
This patch adds wait_event_interruptible_lock_irq_timeout(), which is a straight-forward descendant of wait_event_interruptible_timeout() and wait_event_interruptible_lock_irq().
The zfcp driver used to call wait_event_interruptible_timeout() in combination with some intricate and error-prone locking. Using wait_event_interruptible_lock_irq_timeout() as a replacement nicely cleans up that locking.
This rework removes a situation that resulted in a locking imbalance in zfcp_qdio_sbal_get():
BUG: workqueue leaked lock or atomic: events/1/0xffffff00/10
last function: zfcp_fc_wka_port_offline+0x0/0xa0 [zfcp]It was introduced by commit c2af7545aaff3495d9bf9a7608c52f0af86fb194 "[SCSI] zfcp: Do not wait for SBALs on stopped queue", which had a new code path related to ZFCP_STATUS_ADAPTER_QDIOUP that took an early exit without a required lock being held. The problem occured when a special, non-SCSI I/O request was being submitted in process context, when the adapter's queues had been torn down. In this case the bug surfaced when the Fibre Channel port connection for a well-known address was closed during a concurrent adapter shut-down procedure, which is a rare constellation.
This patch also fixes these warnings from the sparse tool (make C=1):
drivers/s390/scsi/zfcp_qdio.c:224:12: warning: context imbalance in
'zfcp_qdio_sbal_check' - wrong count at exitdrivers/s390/scsi/zfcp_qdio.c:244:5: warning: context imbalance in
'zfcp_qdio_sbal_get' - unexpected unlock
Last but not least, we get rid of that crappy lock-unlock-lock sequence at the beginning of the critical section.
It is okay to call zfcp_erp_adapter_reopen() with req_q_lock held.
--- drivers/s390/scsi/zfcp_qdio.c | 8 ++---- include/linux/wait.h | 57 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 6 deletions(-)
drivers/s390/scsi/zfcp_qdio.c +2 -6
@@ -224,11 +224,9 @@ int zfcp_qdio_sbals_from_sg(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req,static int zfcp_qdio_sbal_check (struct zfcp_qdio *qdio) { -spin_lock_irq (&qdio->req_q_lock);if (atomic_read (&qdio->req_q_free) || !(atomic_read (&qdio->adapter->status) &ZFCP_STATUS_ADAPTER_QDIOUP ))return 1 ; -spin_unlock_irq (&qdio->req_q_lock);return 0 ; }
@@ -246,9 +244,8 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio *qdio) {long ret; -spin_unlock_irq (&qdio->req_q_lock); - ret =wait_event_interruptible_timeout (qdio->req_q_wq, -zfcp_qdio_sbal_check (qdio),5 *HZ ); + ret =wait_event_interruptible_lock_irq_timeout (qdio->req_q_wq, +zfcp_qdio_sbal_check (qdio), qdio->req_q_lock,5 *HZ );if (!(atomic_read (&qdio->adapter->status) &ZFCP_STATUS_ADAPTER_QDIOUP ))return -EIO ;
@@ -262,7 +259,6 @@ int zfcp_qdio_sbal_get(struct zfcp_qdio *qdio)zfcp_erp_adapter_reopen (qdio->adapter,0 ,"qdsbg_1" ); } -spin_lock_irq (&qdio->req_q_lock);return -EIO ; }
include/linux/wait.h +57 -0
63 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 234/251 zfcp: fix schedule-inside-lock in scsi_device list loops
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Martin Peschke <[email protected]>
[ Upstream commit 924dd584b198a58aa7cb3efefd8a03326550ce8f ]
BUG: sleeping function called from invalid context at kernel/workqueue.c:2752 in_atomic(): 1, irqs_disabled(): 1, pid: 360, name: zfcperp0.0.1700 CPU: 1 Not tainted 3.9.3+ #69 Process zfcperp0.0.1700 (pid: 360, task: 0000000075b7e080, ksp: 000000007476bc30) <snip> Call Trace: ([<00000000001165de>] show_trace+0x106/0x154) [<00000000001166a0>] show_stack+0x74/0xf4 [<00000000006ff646>] dump_stack+0xc6/0xd4 [<000000000017f3a0>] __might_sleep+0x128/0x148 [<000000000015ece8>] flush_work+0x54/0x1f8 [<00000000001630de>] __cancel_work_timer+0xc6/0x128 [<00000000005067ac>] scsi_device_dev_release_usercontext+0x164/0x23c [<0000000000161816>] execute_in_process_context+0x96/0xa8 [<00000000004d33d8>] device_release+0x60/0xc0 [<000000000048af48>] kobject_release+0xa8/0x1c4 [<00000000004f4bf2>] __scsi_iterate_devices+0xfa/0x130 [<000003ff801b307a>] zfcp_erp_strategy+0x4da/0x1014 [zfcp] [<000003ff801b3caa>] zfcp_erp_thread+0xf6/0x2b0 [zfcp] [<000000000016b75a>] kthread+0xf2/0xfc [<000000000070c9de>] kernel_thread_starter+0x6/0xc [<000000000070c9d8>] kernel_thread_starter+0x0/0xc
Apparently, the ref_count for some scsi_device drops down to zero, triggering device removal through execute_in_process_context(), while the lldd error recovery thread iterates through a scsi device list. Unfortunately, execute_in_process_context() decides to immediately execute that device removal function, instead of scheduling asynchronous execution, since it detects process context and thinks it is safe to do so. But almost all calls to shost_for_each_device() in our lldd are inside spin_lock_irq, even in thread context. Obviously, schedule() inside spin_lock_irq sections is a bad idea.
Change the lldd to use the proper iterator function, __shost_for_each_device(), in combination with required locking.
Occurences that need to be changed include all calls in zfcp_erp.c, since those might be executed in zfcp error recovery thread context with a lock held.
Other occurences of shost_for_each_device() in zfcp_fsf.c do not need to be changed (no process context, no surrounding locking).
The problem was introduced in Linux 2.6.37 by commit b62a8d9b45b971a67a0f8413338c230e3117dff5
"[SCSI] zfcp: Use SCSI device data zfcp_scsi_dev instead of zfcp_unit".
--- drivers/s390/scsi/zfcp_erp.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-)
drivers/s390/scsi/zfcp_erp.c +22 -7
@@ -102,10 +102,13 @@ static void zfcp_erp_action_dismiss_port(struct zfcp_port *port)if (atomic_read (&port->status) &ZFCP_STATUS_COMMON_ERP_INUSE )zfcp_erp_action_dismiss (&port->erp_action); -else -shost_for_each_device (sdev, port->adapter->scsi_host) +else { +spin_lock (port->adapter->scsi_host->host_lock); +__shost_for_each_device (sdev, port->adapter->scsi_host)if (sdev_to_zfcp (sdev)->port == port)zfcp_erp_action_dismiss_lun (sdev); +spin_unlock (port->adapter->scsi_host->host_lock); + } }static void zfcp_erp_action_dismiss_adapter (struct zfcp_adapter *adapter)
@@ -592,9 +595,11 @@ static void _zfcp_erp_lun_reopen_all(struct zfcp_port *port, int clear, {struct scsi_device *sdev; -shost_for_each_device (sdev, port->adapter->scsi_host) +spin_lock (port->adapter->scsi_host->host_lock); +__shost_for_each_device (sdev, port->adapter->scsi_host)if (sdev_to_zfcp (sdev)->port == port)_zfcp_erp_lun_reopen (sdev, clear, id,0 ); +spin_unlock (port->adapter->scsi_host->host_lock); }static void zfcp_erp_strategy_followup_failed (struct zfcp_erp_action *act)
@@ -1435,8 +1440,10 @@ void zfcp_erp_set_adapter_status(struct zfcp_adapter *adapter, u32 mask)atomic_set_mask (common_mask, &port->status);read_unlock_irqrestore (&adapter->port_list_lock, flags); -shost_for_each_device (sdev, adapter->scsi_host) +spin_lock_irqsave (adapter->scsi_host->host_lock, flags); +__shost_for_each_device (sdev, adapter->scsi_host)atomic_set_mask (common_mask, &sdev_to_zfcp (sdev)->status); +spin_unlock_irqrestore (adapter->scsi_host->host_lock, flags); }/**
@@ -1470,11 +1477,13 @@ void zfcp_erp_clear_adapter_status(struct zfcp_adapter *adapter, u32 mask) }read_unlock_irqrestore (&adapter->port_list_lock, flags); -shost_for_each_device (sdev, adapter->scsi_host) { +spin_lock_irqsave (adapter->scsi_host->host_lock, flags); +__shost_for_each_device (sdev, adapter->scsi_host) {atomic_clear_mask (common_mask, &sdev_to_zfcp (sdev)->status);if (clear_counter)atomic_set (&sdev_to_zfcp (sdev)->erp_counter,0 ); } +spin_unlock_irqrestore (adapter->scsi_host->host_lock, flags); }/**
@@ -1488,16 +1497,19 @@ void zfcp_erp_set_port_status(struct zfcp_port *port, u32 mask) {struct scsi_device *sdev;u32 common_mask = mask &ZFCP_COMMON_FLAGS ; +unsigned long flags;atomic_set_mask (mask, &port->status);if (!common_mask)return ; -shost_for_each_device (sdev, port->adapter->scsi_host) +spin_lock_irqsave (port->adapter->scsi_host->host_lock, flags); +__shost_for_each_device (sdev, port->adapter->scsi_host)if (sdev_to_zfcp (sdev)->port == port)atomic_set_mask (common_mask, &sdev_to_zfcp (sdev)->status); +spin_unlock_irqrestore (port->adapter->scsi_host->host_lock, flags); }/**
@@ -1512,6 +1524,7 @@ void zfcp_erp_clear_port_status(struct zfcp_port *port, u32 mask)struct scsi_device *sdev;u32 common_mask = mask &ZFCP_COMMON_FLAGS ;u32 clear_counter = mask &ZFCP_STATUS_COMMON_ERP_FAILED ; +unsigned long flags;atomic_clear_mask (mask, &port->status);
@@ -1521,13 +1534,15 @@ void zfcp_erp_clear_port_status(struct zfcp_port *port, u32 mask)if (clear_counter)atomic_set (&port->erp_counter,0 ); -shost_for_each_device (sdev, port->adapter->scsi_host) +spin_lock_irqsave (port->adapter->scsi_host->host_lock, flags); +__shost_for_each_device (sdev, port->adapter->scsi_host)if (sdev_to_zfcp (sdev)->port == port) {atomic_clear_mask (common_mask, &sdev_to_zfcp (sdev)->status);if (clear_counter)atomic_set (&sdev_to_zfcp (sdev)->erp_counter,0 ); } +spin_unlock_irqrestore (port->adapter->scsi_host->host_lock, flags); }/**
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 235/251 sg: Fix user memory corruption when SG_IO is interrupted by a signal
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
[ Upstream commit 35dc248383bbab0a7203fca4d722875bc81ef091 ]
There is a nasty bug in the SCSI SG_IO ioctl that in some circumstances leads to one process writing data into the address space of some other random unrelated process if the ioctl is interrupted by a signal. What happens is the following:
- A process issues an SG_IO ioctl with direction DXFER_FROM_DEV (ie the underlying SCSI command will transfer data from the SCSI device to the buffer provided in the ioctl)
- Before the command finishes, a signal is sent to the process waiting in the ioctl. This will end up waking up the sg_ioctl() code:
result = wait_event_interruptible(sfp->read_wait, (srp_done(sfp, srp) || sdp->detached));
but neither srp_done() nor sdp->detached is true, so we end up just setting srp->orphan and returning to userspace:
srp->orphan = 1; write_unlock_irq(&sfp->rq_list_lock); return result; /* -ERESTARTSYS because signal hit process */
At this point the original process is done with the ioctl and blithely goes ahead handling the signal, reissuing the ioctl, etc.
- Eventually, the SCSI command issued by the first ioctl finishes and ends up in sg_rq_end_io(). At the end of that function, we run through:
write_lock_irqsave(&sfp->rq_list_lock, iflags);
if (unlikely(srp->orphan)) {
if (sfp->keep_orphan)
srp->sg_io_owned = 0;
else
done = 0;
}
srp->done = done;
write_unlock_irqrestore(&sfp->rq_list_lock, iflags);
if (likely(done)) {
/* Now wake up any sg_read() that is waiting for this
* packet.
*/
wake_up_interruptible(&sfp->read_wait);
kill_fasync(&sfp->async_qp, SIGPOLL, POLL_IN);
kref_put(&sfp->f_ref, sg_remove_sfp);
} else {
INIT_WORK(&srp->ew.work, sg_rq_end_io_usercontext);
schedule_work(&srp->ew.work);
} Since srp->orphan *is* set, we set done to 0 (assuming the userspace app has not set keep_orphan via an SG_SET_KEEP_ORPHAN ioctl), and therefore we end up scheduling sg_rq_end_io_usercontext() to run in a workqueue.
- In workqueue context we go through sg_rq_end_io_usercontext() -> sg_finish_rem_req() -> blk_rq_unmap_user() -> ... -> bio_uncopy_user() -> __bio_copy_iov() -> copy_to_user().
The key point here is that we are doing copy_to_user() on a workqueue -- that is, we're on a kernel thread with current->mm equal to whatever random previous user process was scheduled before this kernel thread. So we end up copying whatever data the SCSI command returned to the virtual address of the buffer passed into the original ioctl, but it's quite likely we do this copying into a different address space!
As suggested by James Bottomley <[email protected]>, add a check for current->mm (which is NULL if we're on a kernel thread without a real userspace address space) in bio_uncopy_user(), and skip the copy if we're on a kernel thread.
There's no reason that I can think of for any caller of bio_uncopy_user() to want to do copying on a kernel thread with a random active userspace address space.
Huge thanks to Costa Sapuntzakis <[email protected]> for the original pointer to this bug in the sg code.
--- fs/bio.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
fs/bio.c +15 -5
@@ -791,12 +791,22 @@ static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs,int bio_uncopy_user (struct bio *bio) {struct bio_map_data *bmd = bio->bi_private; -int ret =0 ; +struct bio_vec *bvec; +int ret =0 , i; -if (!bio_flagged (bio,BIO_NULL_MAPPED )) - ret =__bio_copy_iov (bio, bmd->iovecs, bmd->sgvecs, - bmd->nr_sgvecs,bio_data_dir (bio) ==READ , -0 , bmd->is_our_pages); +if (!bio_flagged (bio,BIO_NULL_MAPPED )) { +/* +* if we're in a workqueue, the request is orphaned, so +* don't copy into a random user address space, just free. +*/ +if (current->mm) + ret =__bio_copy_iov (bio, bmd->iovecs, bmd->sgvecs, + bmd->nr_sgvecs,bio_data_dir (bio) ==READ , +0 , bmd->is_our_pages); +else if (bmd->is_our_pages) +__bio_for_each_segment (bvec, bio, i,0 ) +__free_page (bvec->bv_page); + }bio_free_map_data (bmd);bio_put (bio);return ret;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 236/251 x86/xen: do not identity map UNUSABLE regions in the machine E820
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: David Vrabel <[email protected]>
[ Upstream commit 3bc38cbceb85881a8eb789ee1aa56678038b1909 ]
If there are UNUSABLE regions in the machine memory map, dom0 will attempt to map them 1:1 which is not permitted by Xen and the kernel will crash.
There isn't anything interesting in the UNUSABLE region that the dom0 kernel needs access to so we can avoid making the 1:1 mapping and treat it as RAM.
We only do this for dom0, as that is where tboot case shows up. A PV domU could have an UNUSABLE region in its pseudo-physical map and would need to be handled in another patch.
This fixes a boot failure on hosts with tboot.
tboot marks a region in the e820 map as unusable and the dom0 kernel would attempt to map this region and Xen does not permit unusable regions to be mapped by guests.
(XEN) 0000000000000000 - 0000000000060000 (usable) (XEN) 0000000000060000 - 0000000000068000 (reserved) (XEN) 0000000000068000 - 000000000009e000 (usable) (XEN) 0000000000100000 - 0000000000800000 (usable) (XEN) 0000000000800000 - 0000000000972000 (unusable)
tboot marked this region as unusable.
(XEN) 0000000000972000 - 00000000cf200000 (usable) (XEN) 00000000cf200000 - 00000000cf38f000 (reserved) (XEN) 00000000cf38f000 - 00000000cf3ce000 (ACPI data) (XEN) 00000000cf3ce000 - 00000000d0000000 (reserved) (XEN) 00000000e0000000 - 00000000f0000000 (reserved) (XEN) 00000000fe000000 - 0000000100000000 (reserved) (XEN) 0000000100000000 - 0000000630000000 (usable)
--- arch/x86/xen/setup.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/x86/xen/setup.c +22 -0
@@ -313,6 +313,17 @@ static void xen_align_and_add_e820_region(u64 start, u64 size, int type)e820_add_region (start, end - start, type); } +void xen_ignore_unusable (struct e820entry *list,size_t map_size) +{ +struct e820entry *entry; +unsigned int i; + +for (i =0 , entry = list; i < map_size; i++, entry++) { +if (entry->type ==E820_UNUSABLE ) + entry->type =E820_RAM ; + } +} +/** * machine_specific_memory_setup - Hook for machine specific memory setup. **/
@@ -353,6 +364,17 @@ char * __init xen_memory_setup(void) }BUG_ON (rc); +/* +* Xen won't allow a 1:1 mapping to be created to UNUSABLE +* regions, so if we're using the machine memory map leave the +* region as RAM as it is in the pseudo-physical map. +* +* UNUSABLE regions in domUs are not handled and will need +* a patch in the future. +*/ +if (xen_initial_domain ()) +xen_ignore_unusable (map, memmap.nr_entries); +/* Make sure the Xen-supplied memory map is well-ordered. */ sanitize_e820_map (map, memmap.nr_entries, &memmap.nr_entries);
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 237/251 jfs: fix readdir cookie incompatibility with NFSv4
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Dave Kleikamp <[email protected]>
[ Upstream commit 44512449c0ab368889dd13ae0031fba74ee7e1d2 ]
NFSv4 reserves readdir cookie values 0-2 for special entries (. and ..), but jfs allows a value of 2 for a non-special entry. This incompatibility can result in the nfs client reporting a readdir loop.
This patch doesn't change the value stored internally, but adds one to the value exposed to the iterate method.
--- fs/jfs/jfs_dtree.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
fs/jfs/jfs_dtree.c +23 -8
@@ -3047,6 +3047,14 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) dir_index = (u32 ) filp->f_pos; +/* +* NFSv4 reserves cookies 1 and 2 for . and .. so the value +* we return to the vfs is one greater than the one we use +* internally. +*/ +if (dir_index) + dir_index--; +if (dir_index >1 ) {struct dir_table_slot dirtab_slot;
@@ -3086,7 +3094,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)if (p->header.flag &BT_INTERNAL ) {jfs_err ("jfs_readdir: bad index table" );DT_PUTPAGE (mp); - filp->f_pos =-1 ; + filp->f_pos =DIREND ;return 0 ; } }else {
@@ -3094,7 +3102,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)/* * self "." */ - filp->f_pos =0 ; + filp->f_pos =1 ;if (filldir (dirent,"." ,1 ,0 , ip->i_ino,DT_DIR ))return 0 ;
@@ -3102,7 +3110,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)/* * parent ".." */ - filp->f_pos =1 ; + filp->f_pos =2 ;if (filldir (dirent,".." ,2 ,1 ,PARENT (ip),DT_DIR ))return 0 ;
@@ -3123,24 +3131,25 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir)/* * Legacy filesystem - OS/2 & Linux JFS < 0.3.6 * -* pn = index = 0: First entry "." -* pn = 0; index = 1: Second entry ".." +* pn = 0; index = 1: First entry "." +* pn = 0; index = 2: Second entry ".." * pn > 0: Real entries, pn=1 -> leftmost page * pn = index = -1: No more entries */ dtpos = filp->f_pos; -if (dtpos ==0 ) { +if (dtpos <2 ) {/* build "." entry */ + filp->f_pos =1 ;if (filldir (dirent,"." ,1 , filp->f_pos, ip->i_ino,DT_DIR ))return 0 ; - dtoffset->index =1 ; + dtoffset->index =2 ; filp->f_pos = dtpos; }if (dtoffset->pn ==0 ) { -if (dtoffset->index ==1 ) { +if (dtoffset->index ==2 ) {/* build ".." entry */ if (filldir(dirent, "..", 2, filp->f_pos,
@@ -3233,6 +3242,12 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) } jfs_dirent->position = unique_pos++; } +/* +* We add 1 to the index because we may +* use a value of 2 internally, and NFSv4 +* doesn't like that. +*/ + jfs_dirent->position++; }else { jfs_dirent->position = dtpos; len =min (d_namleft,DTLHDRDATALEN_LEGACY );
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 238/251 ALSA: hda - Add inverted digital mic fixup for Acer Aspire One
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit d3d3835ce919438c00c5d1270d6f9d6ffea59d03 ]
Yet another entry, just use the existing fixup for this machine, too.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -6860,6 +6860,7 @@ static const struct alc_fixup alc662_fixups[] = {static const struct snd_pci_quirk alc662_fixup_tbl[] = {SND_PCI_QUIRK (0x1019 ,0x9087 ,"ECS" ,ALC662_FIXUP_ASUS_MODE2 ), +SND_PCI_QUIRK (0x1025 ,0x022f ,"Acer Aspire One" ,ALC662_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1025 ,0x0308 ,"Acer Aspire 8942G" ,ALC662_FIXUP_ASPIRE ),SND_PCI_QUIRK (0x1025 ,0x031c ,"Gateway NV79" ,ALC662_FIXUP_SKU_IGNORE ),SND_PCI_QUIRK (0x1025 ,0x0349 ,"eMachines eM250" ,ALC662_FIXUP_INV_DMIC ),
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 239/251 ALSA: opti9xx: Fix conflicting driver object name
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit fb615499f0ad28ed74201c1cdfddf9e64e205424 ]
The recent commit to delay the release of kobject triggered NULL dereferences of opti9xx drivers. The cause is that all snd-opti92x-ad1848, snd-opti92x-cs4231 and snd-opti93x drivers register the PnP card driver with the very same name, and also snd-opti92x-ad1848 and -cs4231 drivers register the ISA driver with the same name, too. When these drivers are built in, quick "register-release-and-re-register" actions occur, and this results in Oops because of the same name is assigned to the kobject.
The fix is simply to assign individual names. As a bonus, by using KBUILD_MODNAME, the patch reduces more lines than it adds.
The fix is based on the suggestion by Russell King.
--- sound/isa/opti9xx/opti92x-ad1848.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
sound/isa/opti9xx/opti92x-ad1848.c +2 -6
@@ -172,11 +172,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_opti9xx_pnpids);#endif /* CONFIG_PNP */ -#ifdef OPTi93X -#define DEV_NAME "opti93x" -#else -#define DEV_NAME "opti92x" -#endif +#define DEV_NAME KBUILD_MODNAMEstatic char * snd_opti9xx_names[] = {"unknown" ,
@@ -1180,7 +1176,7 @@ static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard)static struct pnp_card_driver opti9xx_pnpc_driver = { .flags =PNP_DRIVER_RES_DISABLE , - .name ="opti9xx" , + .name =DEV_NAME , .id_table = snd_opti9xx_pnpids, .probe = snd_opti9xx_pnp_probe, .remove =__devexit_p (snd_opti9xx_pnp_remove),
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 240/251 powerpc: Work around gcc miscompilation of __pa() on 64-bit
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
[ Upstream commit bdbc29c19b2633b1d9c52638fb732bcde7a2031a ]
On 64-bit, __pa(&static_var) gets miscompiled by recent versions of gcc as something like:
addis 3,2,.LANCHOR1+4611686018427387904@toc@ha
addi 3,3,.LANCHOR1+4611686018427387904@toc@lThis ends up effectively ignoring the offset, since its bottom 32 bits are zero, and means that the result of __pa() still has 0xC in the top nibble. This happens with gcc 4.8.1, at least.
To work around this, for 64-bit we make __pa() use an AND operator, and for symmetry, we make __va() use an OR operator. Using an AND operator rather than a subtraction ends up with slightly shorter code since it can be done with a single clrldi instruction, whereas it takes three instructions to form the constant (-PAGE_OFFSET) and add it on. (Note that MEMORY_START is always 0 on 64-bit.)
--- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/page.h | 10 ++++++++++ 2 files changed, 11 insertions(+)
arch/powerpc/Kconfig +1 -0
@@ -973,6 +973,7 @@ config RELOCATABLE must live at a different physical address than the primary kernel. +# This value must have zeroes in the bottom 60 bits otherwise lots will break config PAGE_OFFSET hex default "0xc000000000000000"
arch/powerpc/include/asm/page.h +10 -0
@@ -211,9 +211,19 @@ extern long long virt_phys_offset;#define __va (x) ((void *)(unsigned long)((phys_addr_t)(x) + VIRT_PHYS_OFFSET))#define __pa (x) ((unsigned long)(x) - VIRT_PHYS_OFFSET)#else +#ifdef CONFIG_PPC64 +/* +* gcc miscompiles (unsigned long)(&static_var) - PAGE_OFFSET +* with -mcmodel=medium, so we use & and | instead of - and + on 64-bit. +*/ +#define __va (x) ((void *)(unsigned long)((phys_addr_t)(x) | PAGE_OFFSET)) +#define __pa (x) ((unsigned long)(x) & 0x0fffffffffffffffUL) + +#else /* 32-bit, non book E */ #define __va (x) ((void *)(unsigned long)((phys_addr_t)(x) + PAGE_OFFSET - MEMORY_START))#define __pa (x) ((unsigned long)(x) - PAGE_OFFSET + MEMORY_START)#endif +#endif /* * Unfortunately the PLT is in the BSS in the PPC32 ELF ABI,
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 241/251 powerpc: Dont Oops when accessing /proc/powerpc/lparcfg without hypervisor
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Benjamin Herrenschmidt <[email protected]>
[ Upstream commit f5f6cbb61610b7bf9d9d96db9c3979d62a424bab ]
/proc/powerpc/lparcfg is an ancient facility (though still actively used) which allows access to some informations relative to the partition when running underneath a PAPR compliant hypervisor.
It makes no sense on non-pseries machines. However, currently, not only can it be created on these if the kernel has pseries support, but accessing it on such a machine will crash due to trying to do hypervisor calls.
In fact, it should also not do HV calls on older pseries that didn't have an hypervisor either.
Finally, it has the plumbing to be a module but is a "bool" Kconfig option.
This fixes the whole lot by turning it into a machine_device_initcall that is only created on pseries, and adding the necessary hypervisor check before calling the H_GET_EM_PARMS hypercall
--- arch/powerpc/kernel/lparcfg.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
arch/powerpc/kernel/lparcfg.c +9 -14
@@ -35,7 +35,13 @@#include <asm/vdso_datapage.h> #include <asm/vio.h> #include <asm/mmu.h> +#include <asm/machdep.h> + +/* +* This isn't a module but we expose that to userspace +* via /proc so leave the definitions here +*/ #define MODULE_VERS "1.9"#define MODULE_NAME "lparcfg"
@@ -419,7 +425,8 @@ static void parse_em_data(struct seq_file *m) {unsigned long retbuf[PLPAR_HCALL_BUFSIZE ]; -if (plpar_hcall (H_GET_EM_PARMS , retbuf) ==H_SUCCESS ) +if (firmware_has_feature (FW_FEATURE_LPAR ) && +plpar_hcall (H_GET_EM_PARMS , retbuf) ==H_SUCCESS )seq_printf (m,"power_mode_data=%016lx\n" , retbuf[0 ]); }
@@ -678,7 +685,6 @@ static int lparcfg_open(struct inode *inode, struct file *file) }static const struct file_operations lparcfg_fops = { - .owner =THIS_MODULE , .read = seq_read, .write = lparcfg_write, .open = lparcfg_open,
@@ -704,15 +710,4 @@ static int __init lparcfg_init(void) proc_ppc64_lparcfg = ent;return 0 ; } - -static void __exit lparcfg_cleanup(void) -{ -if (proc_ppc64_lparcfg) -remove_proc_entry ("lparcfg" , proc_ppc64_lparcfg->parent); -} - -module_init (lparcfg_init); -module_exit (lparcfg_cleanup); -MODULE_DESCRIPTION ("Interface for LPAR configuration data" ); -MODULE_AUTHOR ("Dave Engebretsen" ); -MODULE_LICENSE ("GPL" ); +machine_device_initcall (pseries, lparcfg_init);
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 242/251 powerpc/hvsi: Increase handshake timeout from 200ms to 400ms.
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Eugene Surovegin <[email protected]>
[ Upstream commit d220980b701d838560a70de691b53be007e99e78 ]
This solves a problem observed in kexec'ed kernel where 200ms timeout is too short and bootconsole fails to initialize. Console did eventually become workable but much later into the boot process.
Observed timeout was around 260ms, but I decided to make it a little bigger for more reliability.
This has been tested on Power7 machine with Petitboot as a primary bootloader and PowerNV firmware.
--- drivers/tty/hvc/hvsi_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/hvc/hvsi_lib.c +2 -2
@@ -341,8 +341,8 @@ void hvsilib_establish(struct hvsi_priv *pv)pr_devel ("HVSI@%x: ... waiting handshake\n" , pv->termno); -/* Try for up to 200s */ -for (timeout =0 ; timeout <20 ; timeout++) { +/* Try for up to 400ms */ +for (timeout =0 ; timeout <40 ; timeout++) {if (pv->established) goto established;if (!hvsi_get_packet (pv))
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 243/251 regmap: Add another missing header for !CONFIG_REGMAP stubs
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Kevin Hilman <[email protected]>
[ Upstream commit 3f0fa9a808f98fa10a18ba2a73f13d65fda990fb ]
The use of WARN_ON() needs the definitions from bug.h, without it you can get:
include/linux/regmap.h: In function 'regmap_write':include/linux/regmap.h:525:2: error: implicit declaration of function 'WARN_ONCE' [-Werror=implicit-function-declaration]
--- include/linux/regmap.h | 1 + 1 file changed, 1 insertion(+)
include/linux/regmap.h +1 -0
@@ -16,6 +16,7 @@#include <linux/list.h> #include <linux/rbtree.h> #include <linux/err.h> +#include <linux/bug.h> struct module ;struct device ;
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 244/251 drivers/base/memory.c: fix show_mem_removable() to handle missing sections
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Russ Anderson <[email protected]>
[ Upstream commit 21ea9f5ace3a7317cc3ba1fbc749758021a83136 ]
"cat /sys/devices/system/memory/memory*/removable" crashed the system.
The problem is that show_mem_removable() is passing a bad pfn to is_mem_section_removable(), which causes
if (!node_online(page_to_nid(page)))
to blow up. Why is it passing in a bad pfn?
The reason is that show_mem_removable() will loop sections_per_block times. sections_per_block is 16, but mem->section_count is 8, indicating holes in this memory block. Checking that the memory section is present before checking to see if the memory section is removable fixes the problem.
harp5-sys:~ # cat /sys/devices/system/memory/memory*/removable 0
1
1
1
1
1
1
1
1
1
1
1
1
1
BUG: unable to handle kernel paging request at ffffea00c3200000
IP: [<ffffffff81117ed1>] is_pageblock_removable_nolock+0x1/0x90
PGD 83ffd4067 PUD 37bdfce067 PMD 0
Oops: 0000 [#1] SMP
Modules linked in: autofs4 binfmt_misc rdma_ucm rdma_cm iw_cm ib_addr ib_srp scsi_transport_srp scsi_tgt ib_ipoib ib_cm ib_uverbs ib_umad iw_cxgb3 cxgb3 mdio mlx4_en mlx4_ib ib_sa mlx4_core ib_mthca ib_mad ib_core fuse nls_iso8859_1 nls_cp437 vfat fat joydev loop hid_generic usbhid hid hwperf(O) numatools(O) dm_mod iTCO_wdt ipv6 iTCO_vendor_support igb i2c_i801 ioatdma i2c_algo_bit ehci_pci pcspkr lpc_ich i2c_core ehci_hcd ptp sg mfd_core dca rtc_cmos pps_core mperf button xhci_hcd sd_mod crc_t10dif usbcore usb_common scsi_dh_emc scsi_dh_hp_sw scsi_dh_alua scsi_dh_rdac scsi_dh gru(O) xvma(O) xfs crc32c libcrc32c thermal sata_nv processor piix mptsas mptscsih scsi_transport_sas mptbase megaraid_sas fan thermal_sys hwmon ext3 jbd ata_piix ahci libahci libata scsi_mod
CPU: 4 PID: 5991 Comm: cat Tainted: G O 3.11.0-rc5-rja-uv+ #10
Hardware name: SGI UV2000/ROMLEY, BIOS SGI UV 2000/3000 series BIOS 01/15/2013
task: ffff88081f034580 ti: ffff880820022000 task.ti: ffff880820022000
RIP: 0010:[<ffffffff81117ed1>] [<ffffffff81117ed1>] is_pageblock_removable_nolock+0x1/0x90
RSP: 0018:ffff880820023df8 EFLAGS: 00010287
RAX: 0000000000040000 RBX: ffffea00c3200000 RCX: 0000000000000004
RDX: ffffea00c30b0000 RSI: 00000000001c0000 RDI: ffffea00c3200000
RBP: ffff880820023e38 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000001 R12: ffffea00c33c0000
R13: 0000160000000000 R14: 6db6db6db6db6db7 R15: 0000000000000001
FS: 00007ffff7fb2700(0000) GS:ffff88083fc80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffea00c3200000 CR3: 000000081b954000 CR4: 00000000000407e0
Call Trace:
show_mem_removable+0x41/0x70
dev_attr_show+0x2a/0x60
sysfs_read_file+0xf7/0x1c0
vfs_read+0xc8/0x130
SyS_read+0x5d/0xa0
system_call_fastpath+0x16/0x1b--- drivers/base/memory.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/base/memory.c +2 -0
@@ -154,6 +154,8 @@ static ssize_t show_mem_removable(struct device *dev, container_of(dev, struct memory_block, dev);for (i =0 ; i < sections_per_block; i++) { +if (!present_section_nr (mem->start_section_nr + i)) +continue ; pfn =section_nr_to_pfn (mem->start_section_nr + i); ret &=is_mem_section_removable (pfn,PAGES_PER_SECTION ); }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 245/251 workqueue: cond_resched() after processing each work item
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
[ Upstream commit b22ce2785d97423846206cceec4efee0c4afd980 ]
If !PREEMPT, a kworker running work items back to back can hog CPU. This becomes dangerous when a self-requeueing work item which is waiting for something to happen races against stop_machine. Such self-requeueing work item would requeue itself indefinitely hogging the kworker and CPU it's running on while stop_machine would wait for that CPU to enter stop_machine while preventing anything else from happening on all other CPUs. The two would deadlock.
Jamie Liu reports that this deadlock scenario exists around scsi_requeue_run_queue() and libata port multiplier support, where one port may exclude command processing from other ports. With the right timing, scsi_requeue_run_queue() can end up requeueing itself trying to execute an IO which is asked to be retried while another device has an exclusive access, which in turn can't make forward progress due to stop_machine.
Fix it by invoking cond_resched() after executing each work item.
References: http://thread.gmane.org/gmane.linux.kernel/1552567
Cc: [email protected]
--
kernel/workqueue.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- kernel/workqueue.c | 9 +++++++++ 1 file changed, 9 insertions(+)
kernel/workqueue.c +9 -0
@@ -2105,6 +2105,15 @@ __acquires(&gcwq->lock)dump_stack (); } +/* +* The following prevents a kworker from hogging CPU on !PREEMPT +* kernels, where a requeueing work item waiting for something to +* happen could deadlock with stop_machine as such work item could +* indefinitely requeue itself while all other CPUs are trapped in +* stop_machine. +*/ +cond_resched (); +spin_lock_irq (&gcwq->lock);/* clear cpu intensive status */
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 246/251 drm/vmwgfx: Split GMR2_REMAP commands if they are to large
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jakob Bornecrantz <[email protected]>
[ Upstream commit 6e4dcff3adbf25acb87e74500a58e3c07bdec40f ]
This fixes the piglit test texturing/max-texture-size causing the VM to die due to a too large SVGA command.
--- drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c | 58 +++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 19 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c +39 -19
@@ -29,7 +29,9 @@#include "drmP.h" #include "ttm/ttm_bo_driver.h" -#define VMW_PPN_SIZE sizeof(unsigned long) +#define VMW_PPN_SIZE (sizeof(unsigned long)) +/* A future safe maximum remap size. */ +#define VMW_PPN_PER_REMAP ((31 * 1024) / VMW_PPN_SIZE) static int vmw_gmr2_bind(struct vmw_private *dev_priv, struct page *pages[],
@@ -38,43 +40,61 @@ static int vmw_gmr2_bind(struct vmw_private *dev_priv, {SVGAFifoCmdDefineGMR2 define_cmd;SVGAFifoCmdRemapGMR2 remap_cmd; -uint32_t define_size =sizeof (define_cmd) +4 ; -uint32_t remap_size =VMW_PPN_SIZE * num_pages +sizeof (remap_cmd) +4 ;uint32_t *cmd;uint32_t *cmd_orig; +uint32_t define_size =sizeof (define_cmd) +sizeof (*cmd); +uint32_t remap_num = num_pages /VMW_PPN_PER_REMAP + ((num_pages %VMW_PPN_PER_REMAP ) >0 ); +uint32_t remap_size =VMW_PPN_SIZE * num_pages + (sizeof (remap_cmd) +sizeof (*cmd)) * remap_num; +uint32_t remap_pos =0 ; +uint32_t cmd_size = define_size + remap_size;uint32_t i; - cmd_orig = cmd =vmw_fifo_reserve (dev_priv, define_size + remap_size); + cmd_orig = cmd =vmw_fifo_reserve (dev_priv, cmd_size);if (unlikely (cmd ==NULL ))return -ENOMEM ; define_cmd.gmrId = gmr_id; define_cmd.numPages = num_pages; + *cmd++ =SVGA_CMD_DEFINE_GMR2 ; +memcpy (cmd, &define_cmd,sizeof (define_cmd)); + cmd +=sizeof (define_cmd) /sizeof (*cmd); + +/* +* Need to split the command if there are too many +* pages that goes into the gmr. +*/ + remap_cmd.gmrId = gmr_id; remap_cmd.flags = (VMW_PPN_SIZE >sizeof (*cmd)) ?SVGA_REMAP_GMR2_PPN64 :SVGA_REMAP_GMR2_PPN32 ; - remap_cmd.offsetPages =0 ; - remap_cmd.numPages = num_pages; - *cmd++ =SVGA_CMD_DEFINE_GMR2 ; -memcpy (cmd, &define_cmd,sizeof (define_cmd)); - cmd +=sizeof (define_cmd) /sizeof (uint32); +while (num_pages >0 ) { +unsigned long nr =min (num_pages, (unsigned long )VMW_PPN_PER_REMAP ); + + remap_cmd.offsetPages = remap_pos; + remap_cmd.numPages = nr; - *cmd++ =SVGA_CMD_REMAP_GMR2 ; -memcpy (cmd, &remap_cmd,sizeof (remap_cmd)); - cmd +=sizeof (remap_cmd) /sizeof (uint32); + *cmd++ =SVGA_CMD_REMAP_GMR2 ; +memcpy (cmd, &remap_cmd,sizeof (remap_cmd)); + cmd +=sizeof (remap_cmd) /sizeof (*cmd); -for (i =0 ; i < num_pages; ++i) { -if (VMW_PPN_SIZE <=4 ) - *cmd =page_to_pfn (*pages++); -else - *((uint64_t *)cmd) =page_to_pfn (*pages++); +for (i =0 ; i < nr; ++i) { +if (VMW_PPN_SIZE <=4 ) + *cmd =page_to_pfn (*pages++); +else + *((uint64_t *)cmd) =page_to_pfn (*pages++); - cmd +=VMW_PPN_SIZE /sizeof (*cmd); + cmd +=VMW_PPN_SIZE /sizeof (*cmd); + } + + num_pages -= nr; + remap_pos += nr; } -vmw_fifo_commit (dev_priv, define_size + remap_size); +BUG_ON (cmd != cmd_orig + cmd_size /sizeof (*cmd)); + +vmw_fifo_commit (dev_priv, cmd_size);return 0 ; }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 247/251 drm/i915: ivb: fix edp voltage swing reg val
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
[ Upstream commit 77fa4cbd5fa389e28419bbe8ac491b5fdd54840d ]
Fix the typo introduced in
commit 1a2eb4604b85c5efb343da8a4dcf41288fcfca85
Author: Keith Packard <[email protected]> Date: Wed Nov 16 16:26:07 2011 -0800
drm/i915: Hook up Ivybridge eDP
This fixes eDP link-training failures and cases where all voltage swing /pre-emphasis levels were tried and failed during clock recovery and - as a fallback - we go on to do channel equalization with the last voltage swing/pre-emphasis level which will succeed. Both issues can lead to a blank screen.
v2:
- improve commit message
CC: [email protected]
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64880
--- drivers/gpu/drm/i915/i915_reg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_reg.h +1 -1
@@ -4076,7 +4076,7 @@#define EDP_LINK_TRAIN_600MV_0DB_IVB (0x30 <<22)#define EDP_LINK_TRAIN_600MV_3_5DB_IVB (0x36 <<22)#define EDP_LINK_TRAIN_800MV_0DB_IVB (0x38 <<22) -#define EDP_LINK_TRAIN_800MV_3_5DB_IVB (0x33 <<22) +#define EDP_LINK_TRAIN_800MV_3_5DB_IVB (0x3e <<22)/* legacy values */ #define EDP_LINK_TRAIN_500MV_0DB_IVB (0x00 <<22)
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 248/251 SUNRPC: Fix memory corruption issue on 32-bit highmem systems
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 347e2233b7667e336d9f671f1a52dfa3f0416e2c ]
Some architectures, such as ARM-32 do not return the same base address when you call kmap_atomic() twice on the same page.
This causes problems for the memmove() call in the XDR helper routine "_shift_data_right_pages()", since it defeats the detection of overlapping memory ranges, and has been seen to corrupt memory.
The fix is to distinguish between the case where we're doing an inter-page copy or not. In the former case of we know that the memory ranges cannot possibly overlap, so we can additionally micro-optimise by replacing memmove() with memcpy().
--- net/sunrpc/xdr.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/sunrpc/xdr.c +6 -3
@@ -207,10 +207,13 @@ _shift_data_right_pages(struct page **pages, size_t pgto_base, pgfrom_base -= copy; vto =kmap_atomic (*pgto); - vfrom =kmap_atomic (*pgfrom); -memmove (vto + pgto_base, vfrom + pgfrom_base, copy); +if (*pgto != *pgfrom) { + vfrom =kmap_atomic (*pgfrom); +memcpy (vto + pgto_base, vfrom + pgfrom_base, copy); +kunmap_atomic (vfrom); + }else +memmove (vto + pgto_base, vto + pgfrom_base, copy);flush_dcache_page (*pgto); -kunmap_atomic (vfrom);kunmap_atomic (vto); }while ((len -= copy) !=0 );
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 249/251 ath9k_htc: Restore skb headroom when returning skb to mac80211
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Helmut Schaa <[email protected]>
[ Upstream commit d2e9fc141e2aa21f4b35ee27072d84e9aa6e2ba0 ]
ath9k_htc adds padding between the 802.11 header and the payload during TX by moving the header. When handing the frame back to mac80211 for TX status handling the header is not moved back into its original position. This can result in a too small skb headroom when entering ath9k_htc again (due to a soft retransmission for example) causing an skb_under_panic oops.
Fix this by moving the 802.11 header back into its original position before returning the frame to mac80211 as other drivers like rt2x00 or ath5k do.
--- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +10 -0
@@ -448,6 +448,7 @@ static void ath9k_htc_tx_process(struct ath9k_htc_priv *priv,struct ieee80211_conf *cur_conf = &priv->hw->conf;bool txok;int slot; +int hdrlen, padsize; slot =strip_drv_header (priv, skb);if (slot <0 ) {
@@ -504,6 +505,15 @@ send_mac80211:ath9k_htc_tx_clear_slot (priv, slot); +/* Remove padding before handing frame back to mac80211 */ + hdrlen =ieee80211_get_hdrlen_from_skb (skb); + + padsize = hdrlen &3 ; +if (padsize && skb->len > hdrlen + padsize) { +memmove (skb->data + padsize, skb->data, hdrlen); +skb_pull (skb, padsize); + } +/* Send status to mac80211 */ ieee80211_tx_status (priv->hw, skb); }
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 250/251 ath9k: Enable PLL fix only for AR9340/AR9330
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sujith Manoharan <[email protected]>
[ Upstream commit 19c361608ce3e73f352e323262f7e0a8264be3af ]
The PLL hang workaround is required only for AR9330 and AR9340. This issue was first observed on an AP121 and the WAR is enabled for AR9340 also (DB120 etc.), since it uses a PLL design identical to AR9330. This is not required for AR9485 and AR9550.
Various bugs have been reported regarding this:
https://bugzilla.redhat.com/show_bug.cgi?id=997217
https://bugzilla.redhat.com/show_bug.cgi?id=994648
--- drivers/net/wireless/ath/ath9k/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +1 -2
@@ -172,8 +172,7 @@ static void ath_restart_work(struct ath_softc *sc) {ieee80211_queue_delayed_work (sc->hw, &sc->tx_complete_work,0 ); -if (AR_SREV_9340 (sc->sc_ah) ||AR_SREV_9485 (sc->sc_ah) || -AR_SREV_9550 (sc->sc_ah)) +if (AR_SREV_9340 (sc->sc_ah) ||AR_SREV_9330 (sc->sc_ah))ieee80211_queue_delayed_work (sc->hw, &sc->hw_pll_work,msecs_to_jiffies (ATH_PLL_WORK_INTERVAL ));
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerPATCH 251/251 target: Fix trailing ASCII space usage in INQUIRY vendor+model
In reply to Steven Rostedt3.6.11.9-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
[ Upstream commit ee60bddba5a5f23e39598195d944aa0eb2d455e5 ]
This patch fixes spc_emulate_inquiry_std() to add trailing ASCII spaces for INQUIRY vendor + model fields following SPC-4 text:
"ASCII data fields described as being left-aligned shall have any
unused bytes at the end of the field (i.e., highest offset) and the unused bytes shall be filled with ASCII space characters (20h)."
This addresses a problem with Falconstor NSS multipathing.
--- drivers/target/target_core_spc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/target/target_core_spc.c +6 -3
@@ -100,9 +100,12 @@ static int spc_emulate_inquiry_std(struct se_cmd *cmd, char *buf) buf[7 ] =0x2 ;/* CmdQue=1 */ -snprintf (&buf[8 ],8 ,"LIO-ORG" ); -snprintf (&buf[16 ],16 ,"%s" , dev->se_sub_dev->t10_wwn.model); -snprintf (&buf[32 ],4 ,"%s" , dev->se_sub_dev->t10_wwn.revision); +memcpy (&buf[8 ],"LIO-ORG " ,8 ); +memset (&buf[16 ],0x20 ,16 ); +memcpy (&buf[16 ], dev->se_sub_dev->t10_wwn.model, +min_t (size_t,strlen (dev->se_sub_dev->t10_wwn.model),16 )); +memcpy (&buf[32 ], dev->se_sub_dev->t10_wwn.revision, +min_t (size_t,strlen (dev->se_sub_dev->t10_wwn.revision),4 )); buf[4 ] =31 ;/* Set additional length to 31 */ return 0 ;
Signature · 1 line
1.7.10.4