Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any chance of a image with rt5370sta on A10? #1

Open
mpolitzer opened this issue Nov 10, 2013 · 1 comment
Open

Any chance of a image with rt5370sta on A10? #1

mpolitzer opened this issue Nov 10, 2013 · 1 comment

Comments

@mpolitzer
Copy link

Hello, I have a A10 board with a broken ethernet and setting up the cross environment is giving me quite some headache.
Is there a way to get the module in there some other way? I've seen that this image has the module in, but it doesn't look like they are binary compatible. http://cubian.org/2013/08/18/kernel-update-to-3.4.43-on-a20/

Regards,
Marcelo

michalliu pushed a commit that referenced this issue Jan 18, 2014
[ Upstream commit 455cc32 ]

François Cachereul made a very nice bug report and suspected
the bh_lock_sock() / bh_unlok_sock() pair used in l2tp_xmit_skb() from
process context was not good.

This problem was added by commit 6af88da
("l2tp: Fix locking in l2tp_core.c").

l2tp_eth_dev_xmit() runs from BH context, so we must disable BH
from other l2tp_xmit_skb() users.

[  452.060011] BUG: soft lockup - CPU#1 stuck for 23s! [accel-pppd:6662]
[  452.061757] Modules linked in: l2tp_ppp l2tp_netlink l2tp_core pppoe pppox
ppp_generic slhc ipv6 ext3 mbcache jbd virtio_balloon xfs exportfs dm_mod
virtio_blk ata_generic virtio_net floppy ata_piix libata virtio_pci virtio_ring virtio [last unloaded: scsi_wait_scan]
[  452.064012] CPU 1
[  452.080015] BUG: soft lockup - CPU#2 stuck for 23s! [accel-pppd:6643]
[  452.080015] CPU 2
[  452.080015]
[  452.080015] Pid: 6643, comm: accel-pppd Not tainted 3.2.46.mini #1 Bochs Bochs
[  452.080015] RIP: 0010:[<ffffffff81059f6c>]  [<ffffffff81059f6c>] do_raw_spin_lock+0x17/0x1f
[  452.080015] RSP: 0018:ffff88007125fc18  EFLAGS: 00000293
[  452.080015] RAX: 000000000000aba9 RBX: ffffffff811d0703 RCX: 0000000000000000
[  452.080015] RDX: 00000000000000ab RSI: ffff8800711f6896 RDI: ffff8800745c8110
[  452.080015] RBP: ffff88007125fc18 R08: 0000000000000020 R09: 0000000000000000
[  452.080015] R10: 0000000000000000 R11: 0000000000000280 R12: 0000000000000286
[  452.080015] R13: 0000000000000020 R14: 0000000000000240 R15: 0000000000000000
[  452.080015] FS:  00007fdc0cc24700(0000) GS:ffff8800b6f00000(0000) knlGS:0000000000000000
[  452.080015] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.080015] CR2: 00007fdb054899b8 CR3: 0000000074404000 CR4: 00000000000006a0
[  452.080015] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.080015] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  452.080015] Process accel-pppd (pid: 6643, threadinfo ffff88007125e000, task ffff8800b27e6dd0)
[  452.080015] Stack:
[  452.080015]  ffff88007125fc28 ffffffff81256559 ffff88007125fc98 ffffffffa01b2bd1
[  452.080015]  ffff88007125fc58 000000000000000c 00000000029490d0 0000009c71dbe25e
[  452.080015]  000000000000005c 000000080000000e 0000000000000000 ffff880071170600
[  452.080015] Call Trace:
[  452.080015]  [<ffffffff81256559>] _raw_spin_lock+0xe/0x10
[  452.080015]  [<ffffffffa01b2bd1>] l2tp_xmit_skb+0x189/0x4ac [l2tp_core]
[  452.080015]  [<ffffffffa01c2d36>] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.080015]  [<ffffffff811c7872>] __sock_sendmsg_nosec+0x22/0x24
[  452.080015]  [<ffffffff811c83bd>] sock_sendmsg+0xa1/0xb6
[  452.080015]  [<ffffffff81254e88>] ? __schedule+0x5c1/0x616
[  452.080015]  [<ffffffff8103c7c6>] ? __dequeue_signal+0xb7/0x10c
[  452.080015]  [<ffffffff810bbd21>] ? fget_light+0x75/0x89
[  452.080015]  [<ffffffff811c8444>] ? sockfd_lookup_light+0x20/0x56
[  452.080015]  [<ffffffff811c9b34>] sys_sendto+0x10c/0x13b
[  452.080015]  [<ffffffff8125cac2>] system_call_fastpath+0x16/0x1b
[  452.080015] Code: 81 48 89 e5 72 0c 31 c0 48 81 ff 45 66 25 81 0f 92 c0 5d c3 55 b8 00 01 00 00 48 89 e5 f0 66 0f c1 07 0f b6 d4 38 d0 74 06 f3 90 <8a> 07 eb f6 5d c3 90 90 55 48 89 e5 9c 58 0f 1f 44 00 00 5d c3
[  452.080015] Call Trace:
[  452.080015]  [<ffffffff81256559>] _raw_spin_lock+0xe/0x10
[  452.080015]  [<ffffffffa01b2bd1>] l2tp_xmit_skb+0x189/0x4ac [l2tp_core]
[  452.080015]  [<ffffffffa01c2d36>] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.080015]  [<ffffffff811c7872>] __sock_sendmsg_nosec+0x22/0x24
[  452.080015]  [<ffffffff811c83bd>] sock_sendmsg+0xa1/0xb6
[  452.080015]  [<ffffffff81254e88>] ? __schedule+0x5c1/0x616
[  452.080015]  [<ffffffff8103c7c6>] ? __dequeue_signal+0xb7/0x10c
[  452.080015]  [<ffffffff810bbd21>] ? fget_light+0x75/0x89
[  452.080015]  [<ffffffff811c8444>] ? sockfd_lookup_light+0x20/0x56
[  452.080015]  [<ffffffff811c9b34>] sys_sendto+0x10c/0x13b
[  452.080015]  [<ffffffff8125cac2>] system_call_fastpath+0x16/0x1b
[  452.064012]
[  452.064012] Pid: 6662, comm: accel-pppd Not tainted 3.2.46.mini #1 Bochs Bochs
[  452.064012] RIP: 0010:[<ffffffff81059f6e>]  [<ffffffff81059f6e>] do_raw_spin_lock+0x19/0x1f
[  452.064012] RSP: 0018:ffff8800b6e83ba0  EFLAGS: 00000297
[  452.064012] RAX: 000000000000aaa9 RBX: ffff8800b6e83b40 RCX: 0000000000000002
[  452.064012] RDX: 00000000000000aa RSI: 000000000000000a RDI: ffff8800745c8110
[  452.064012] RBP: ffff8800b6e83ba0 R08: 000000000000c802 R09: 000000000000001c
[  452.064012] R10: ffff880071096c4e R11: 0000000000000006 R12: ffff8800b6e83b18
[  452.064012] R13: ffffffff8125d51e R14: ffff8800b6e83ba0 R15: ffff880072a589c0
[  452.064012] FS:  00007fdc0b81e700(0000) GS:ffff8800b6e80000(0000) knlGS:0000000000000000
[  452.064012] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.064012] CR2: 0000000000625208 CR3: 0000000074404000 CR4: 00000000000006a0
[  452.064012] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.064012] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  452.064012] Process accel-pppd (pid: 6662, threadinfo ffff88007129a000, task ffff8800744f7410)
[  452.064012] Stack:
[  452.064012]  ffff8800b6e83bb0 ffffffff81256559 ffff8800b6e83bc0 ffffffff8121c64a
[  452.064012]  ffff8800b6e83bf0 ffffffff8121ec7a ffff880072a589c0 ffff880071096c62
[  452.064012]  0000000000000011 ffffffff81430024 ffff8800b6e83c80 ffffffff8121f276
[  452.064012] Call Trace:
[  452.064012]  <IRQ>
[  452.064012]  [<ffffffff81256559>] _raw_spin_lock+0xe/0x10
[  452.064012]  [<ffffffff8121c64a>] spin_lock+0x9/0xb
[  452.064012]  [<ffffffff8121ec7a>] udp_queue_rcv_skb+0x186/0x269
[  452.064012]  [<ffffffff8121f276>] __udp4_lib_rcv+0x297/0x4ae
[  452.064012]  [<ffffffff8121c178>] ? raw_rcv+0xe9/0xf0
[  452.064012]  [<ffffffff8121f4a7>] udp_rcv+0x1a/0x1c
[  452.064012]  [<ffffffff811fe385>] ip_local_deliver_finish+0x12b/0x1a5
[  452.064012]  [<ffffffff811fe54e>] ip_local_deliver+0x53/0x84
[  452.064012]  [<ffffffff811fe1d0>] ip_rcv_finish+0x2bc/0x2f3
[  452.064012]  [<ffffffff811fe78f>] ip_rcv+0x210/0x269
[  452.064012]  [<ffffffff8101911e>] ? kvm_clock_get_cycles+0x9/0xb
[  452.064012]  [<ffffffff811d88cd>] __netif_receive_skb+0x3a5/0x3f7
[  452.064012]  [<ffffffff811d8eba>] netif_receive_skb+0x57/0x5e
[  452.064012]  [<ffffffff811cf30f>] ? __netdev_alloc_skb+0x1f/0x3b
[  452.064012]  [<ffffffffa0049126>] virtnet_poll+0x4ba/0x5a4 [virtio_net]
[  452.064012]  [<ffffffff811d9417>] net_rx_action+0x73/0x184
[  452.064012]  [<ffffffffa01b2cc2>] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [<ffffffff810343b9>] __do_softirq+0xc3/0x1a8
[  452.064012]  [<ffffffff81013b56>] ? ack_APIC_irq+0x10/0x12
[  452.064012]  [<ffffffff81256559>] ? _raw_spin_lock+0xe/0x10
[  452.064012]  [<ffffffff8125e0ac>] call_softirq+0x1c/0x26
[  452.064012]  [<ffffffff81003587>] do_softirq+0x45/0x82
[  452.064012]  [<ffffffff81034667>] irq_exit+0x42/0x9c
[  452.064012]  [<ffffffff8125e146>] do_IRQ+0x8e/0xa5
[  452.064012]  [<ffffffff8125676e>] common_interrupt+0x6e/0x6e
[  452.064012]  <EOI>
[  452.064012]  [<ffffffff810b82a1>] ? kfree+0x8a/0xa3
[  452.064012]  [<ffffffffa01b2cc2>] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [<ffffffffa01b2c25>] ? l2tp_xmit_skb+0x1dd/0x4ac [l2tp_core]
[  452.064012]  [<ffffffffa01c2d36>] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.064012]  [<ffffffff811c7872>] __sock_sendmsg_nosec+0x22/0x24
[  452.064012]  [<ffffffff811c83bd>] sock_sendmsg+0xa1/0xb6
[  452.064012]  [<ffffffff81254e88>] ? __schedule+0x5c1/0x616
[  452.064012]  [<ffffffff8103c7c6>] ? __dequeue_signal+0xb7/0x10c
[  452.064012]  [<ffffffff810bbd21>] ? fget_light+0x75/0x89
[  452.064012]  [<ffffffff811c8444>] ? sockfd_lookup_light+0x20/0x56
[  452.064012]  [<ffffffff811c9b34>] sys_sendto+0x10c/0x13b
[  452.064012]  [<ffffffff8125cac2>] system_call_fastpath+0x16/0x1b
[  452.064012] Code: 89 e5 72 0c 31 c0 48 81 ff 45 66 25 81 0f 92 c0 5d c3 55 b8 00 01 00 00 48 89 e5 f0 66 0f c1 07 0f b6 d4 38 d0 74 06 f3 90 8a 07 <eb> f6 5d c3 90 90 55 48 89 e5 9c 58 0f 1f 44 00 00 5d c3 55 48
[  452.064012] Call Trace:
[  452.064012]  <IRQ>  [<ffffffff81256559>] _raw_spin_lock+0xe/0x10
[  452.064012]  [<ffffffff8121c64a>] spin_lock+0x9/0xb
[  452.064012]  [<ffffffff8121ec7a>] udp_queue_rcv_skb+0x186/0x269
[  452.064012]  [<ffffffff8121f276>] __udp4_lib_rcv+0x297/0x4ae
[  452.064012]  [<ffffffff8121c178>] ? raw_rcv+0xe9/0xf0
[  452.064012]  [<ffffffff8121f4a7>] udp_rcv+0x1a/0x1c
[  452.064012]  [<ffffffff811fe385>] ip_local_deliver_finish+0x12b/0x1a5
[  452.064012]  [<ffffffff811fe54e>] ip_local_deliver+0x53/0x84
[  452.064012]  [<ffffffff811fe1d0>] ip_rcv_finish+0x2bc/0x2f3
[  452.064012]  [<ffffffff811fe78f>] ip_rcv+0x210/0x269
[  452.064012]  [<ffffffff8101911e>] ? kvm_clock_get_cycles+0x9/0xb
[  452.064012]  [<ffffffff811d88cd>] __netif_receive_skb+0x3a5/0x3f7
[  452.064012]  [<ffffffff811d8eba>] netif_receive_skb+0x57/0x5e
[  452.064012]  [<ffffffff811cf30f>] ? __netdev_alloc_skb+0x1f/0x3b
[  452.064012]  [<ffffffffa0049126>] virtnet_poll+0x4ba/0x5a4 [virtio_net]
[  452.064012]  [<ffffffff811d9417>] net_rx_action+0x73/0x184
[  452.064012]  [<ffffffffa01b2cc2>] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [<ffffffff810343b9>] __do_softirq+0xc3/0x1a8
[  452.064012]  [<ffffffff81013b56>] ? ack_APIC_irq+0x10/0x12
[  452.064012]  [<ffffffff81256559>] ? _raw_spin_lock+0xe/0x10
[  452.064012]  [<ffffffff8125e0ac>] call_softirq+0x1c/0x26
[  452.064012]  [<ffffffff81003587>] do_softirq+0x45/0x82
[  452.064012]  [<ffffffff81034667>] irq_exit+0x42/0x9c
[  452.064012]  [<ffffffff8125e146>] do_IRQ+0x8e/0xa5
[  452.064012]  [<ffffffff8125676e>] common_interrupt+0x6e/0x6e
[  452.064012]  <EOI>  [<ffffffff810b82a1>] ? kfree+0x8a/0xa3
[  452.064012]  [<ffffffffa01b2cc2>] ? l2tp_xmit_skb+0x27a/0x4ac [l2tp_core]
[  452.064012]  [<ffffffffa01b2c25>] ? l2tp_xmit_skb+0x1dd/0x4ac [l2tp_core]
[  452.064012]  [<ffffffffa01c2d36>] pppol2tp_sendmsg+0x15e/0x19c [l2tp_ppp]
[  452.064012]  [<ffffffff811c7872>] __sock_sendmsg_nosec+0x22/0x24
[  452.064012]  [<ffffffff811c83bd>] sock_sendmsg+0xa1/0xb6
[  452.064012]  [<ffffffff81254e88>] ? __schedule+0x5c1/0x616
[  452.064012]  [<ffffffff8103c7c6>] ? __dequeue_signal+0xb7/0x10c
[  452.064012]  [<ffffffff810bbd21>] ? fget_light+0x75/0x89
[  452.064012]  [<ffffffff811c8444>] ? sockfd_lookup_light+0x20/0x56
[  452.064012]  [<ffffffff811c9b34>] sys_sendto+0x10c/0x13b
[  452.064012]  [<ffffffff8125cac2>] system_call_fastpath+0x16/0x1b

Reported-by: François Cachereul <[email protected]>
Tested-by: François Cachereul <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Cc: James Chapman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit a4461f4 upstream.

Unable to handle kernel NULL pointer dereference at virtual address 00000008
pgd = d5300000
[00000008] *pgd=0d265831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] PREEMPT ARM
CPU: 0 PID: 2295 Comm: vlc Not tainted 3.11.0+ torvalds#755
task: dee74800 ti: e213c000 task.ti: e213c000
PC is at snd_pcm_info+0xc8/0xd8
LR is at 0x30232065
pc : [<c031b52c>]    lr : [<30232065>]    psr: a0070013
sp : e213dea8  ip : d81cb0d0  fp : c05f7678
r10: c05f7770  r9 : fffffdfd  r8 : 00000000
r7 : d8a968a8  r6 : d8a96800  r5 : d8a96200  r4 : d81cb000
r3 : 00000000  r2 : d81cb000  r1 : 00000001  r0 : d8a96200
Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c5387d  Table: 15300019  DAC: 00000015
Process vlc (pid: 2295, stack limit = 0xe213c248)
[<c031b52c>] (snd_pcm_info) from [<c031b570>] (snd_pcm_info_user+0x34/0x9c)
[<c031b570>] (snd_pcm_info_user) from [<c03164a4>] (snd_pcm_control_ioctl+0x274/0x280)
[<c03164a4>] (snd_pcm_control_ioctl) from [<c0311458>] (snd_ctl_ioctl+0xc0/0x55c)
[<c0311458>] (snd_ctl_ioctl) from [<c00eca84>] (do_vfs_ioctl+0x80/0x31c)
[<c00eca84>] (do_vfs_ioctl) from [<c00ecd5c>] (SyS_ioctl+0x3c/0x60)
[<c00ecd5c>] (SyS_ioctl) from [<c000e500>] (ret_fast_syscall+0x0/0x48)
Code: e1a00005 e59530dc e3a01001 e1a02004 (e5933008)
---[ end trace cb3d9bdb8dfefb3c ]---

This is provoked when the ASoC front end is open along with its backend,
(which causes the backend to have a runtime assigned to it) and then the
SNDRV_CTL_IOCTL_PCM_INFO is requested for the (visible) backend device.

Resolve this by ensuring that ASoC internal backend devices are not
visible to userspace, just as the commentry for snd_pcm_new_internal()
says it should be.

Signed-off-by: Russell King <[email protected]>
Acked-by: Mark Brown <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit 057db84 upstream.

Andrey reported the following report:

ERROR: AddressSanitizer: heap-buffer-overflow on address ffff8800359c99f3
ffff8800359c99f3 is located 0 bytes to the right of 243-byte region [ffff8800359c9900, ffff8800359c99f3)
Accessed by thread T13003:
  #0 ffffffff810dd2da (asan_report_error+0x32a/0x440)
  #1 ffffffff810dc6b0 (asan_check_region+0x30/0x40)
  #2 ffffffff810dd4d3 (__tsan_write1+0x13/0x20)
  #3 ffffffff811cd19e (ftrace_regex_release+0x1be/0x260)
  linux-sunxi#4 ffffffff812a1065 (__fput+0x155/0x360)
  linux-sunxi#5 ffffffff812a12de (____fput+0x1e/0x30)
  linux-sunxi#6 ffffffff8111708d (task_work_run+0x10d/0x140)
  linux-sunxi#7 ffffffff810ea043 (do_exit+0x433/0x11f0)
  linux-sunxi#8 ffffffff810eaee4 (do_group_exit+0x84/0x130)
  linux-sunxi#9 ffffffff810eafb1 (SyS_exit_group+0x21/0x30)
  linux-sunxi#10 ffffffff81928782 (system_call_fastpath+0x16/0x1b)

Allocated by thread T5167:
  #0 ffffffff810dc778 (asan_slab_alloc+0x48/0xc0)
  #1 ffffffff8128337c (__kmalloc+0xbc/0x500)
  #2 ffffffff811d9d54 (trace_parser_get_init+0x34/0x90)
  #3 ffffffff811cd7b3 (ftrace_regex_open+0x83/0x2e0)
  linux-sunxi#4 ffffffff811cda7d (ftrace_filter_open+0x2d/0x40)
  linux-sunxi#5 ffffffff8129b4ff (do_dentry_open+0x32f/0x430)
  linux-sunxi#6 ffffffff8129b668 (finish_open+0x68/0xa0)
  linux-sunxi#7 ffffffff812b66ac (do_last+0xb8c/0x1710)
  linux-sunxi#8 ffffffff812b7350 (path_openat+0x120/0xb50)
  linux-sunxi#9 ffffffff812b8884 (do_filp_open+0x54/0xb0)
  linux-sunxi#10 ffffffff8129d36c (do_sys_open+0x1ac/0x2c0)
  linux-sunxi#11 ffffffff8129d4b7 (SyS_open+0x37/0x50)
  linux-sunxi#12 ffffffff81928782 (system_call_fastpath+0x16/0x1b)

Shadow bytes around the buggy address:
  ffff8800359c9700: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  ffff8800359c9780: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
  ffff8800359c9800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  ffff8800359c9880: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  ffff8800359c9900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>ffff8800359c9980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00[03]fb
  ffff8800359c9a00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  ffff8800359c9a80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  ffff8800359c9b00: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  ffff8800359c9b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  ffff8800359c9c00: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap redzone:          fa
  Heap kmalloc redzone:  fb
  Freed heap region:     fd
  Shadow gap:            fe

The out-of-bounds access happens on 'parser->buffer[parser->idx] = 0;'

Although the crash happened in ftrace_regex_open() the real bug
occurred in trace_get_user() where there's an incrementation to
parser->idx without a check against the size. The way it is triggered
is if userspace sends in 128 characters (EVENT_BUF_SIZE + 1), the loop
that reads the last character stores it and then breaks out because
there is no more characters. Then the last character is read to determine
what to do next, and the index is incremented without checking size.

Then the caller of trace_get_user() usually nulls out the last character
with a zero, but since the index is equal to the size, it writes a nul
character after the allocated space, which can corrupt memory.

Luckily, only root user has write access to this file.

Link: http://lkml.kernel.org/r/[email protected]

Reported-by: Andrey Konovalov <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit f6488c9 upstream.

Benny Halevy reported the following oops when testing RHEL6:

<7>nfs_update_inode: inode 892950 mode changed, 0040755 to 0100644
<1>BUG: unable to handle kernel NULL pointer dereference at (null)
<1>IP: [<ffffffffa02a52c5>] nfs_closedir+0x15/0x30 [nfs]
<4>PGD 81448a067 PUD 831632067 PMD 0
<4>Oops: 0000 [#1] SMP
<4>last sysfs file: /sys/kernel/mm/redhat_transparent_hugepage/enabled
<4>CPU 6
<4>Modules linked in: fuse bonding 8021q garp ebtable_nat ebtables be2iscsi iscsi_boot_sysfs bnx2i cnic uio cxgb4i cxgb4 cxgb3i libcxgbi cxgb3 mdio ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi softdog bridge stp llc xt_physdev ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 xt_multiport iptable_filter ip_tables ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6 dm_round_robin dm_multipath objlayoutdriver2(U) nfs(U) lockd fscache auth_rpcgss nfs_acl sunrpc vhost_net macvtap macvlan tun kvm_intel kvm be2net igb dca ptp pps_core microcode serio_raw sg iTCO_wdt iTCO_vendor_support i7core_edac edac_core shpchp ext4 mbcache jbd2 sd_mod crc_t10dif ahci dm_mirror dm_region_hash dm_log dm_mod [last unloaded: scsi_wait_scan]
<4>
<4>Pid: 6332, comm: dd Not tainted 2.6.32-358.el6.x86_64 #1 HP ProLiant DL170e G6  /ProLiant DL170e G6
<4>RIP: 0010:[<ffffffffa02a52c5>]  [<ffffffffa02a52c5>] nfs_closedir+0x15/0x30 [nfs]
<4>RSP: 0018:ffff88081458bb98  EFLAGS: 00010292
<4>RAX: ffffffffa02a52b0 RBX: 0000000000000000 RCX: 0000000000000003
<4>RDX: ffffffffa02e45a0 RSI: ffff88081440b300 RDI: ffff88082d5f5760
<4>RBP: ffff88081458bba8 R08: 0000000000000000 R09: 0000000000000000
<4>R10: 0000000000000772 R11: 0000000000400004 R12: 0000000040000008
<4>R13: ffff88082d5f5760 R14: ffff88082d6e8800 R15: ffff88082f12d780
<4>FS:  00007f728f37e700(0000) GS:ffff8800456c0000(0000) knlGS:0000000000000000
<4>CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
<4>CR2: 0000000000000000 CR3: 0000000831279000 CR4: 00000000000007e0
<4>DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
<4>DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
<4>Process dd (pid: 6332, threadinfo ffff88081458a000, task ffff88082fa0e040)
<4>Stack:
<4> 0000000040000008 ffff88081440b300 ffff88081458bbf8 ffffffff81182745
<4><d> ffff88082d5f5760 ffff88082d6e8800 ffff88081458bbf8 ffffffffffffffea
<4><d> ffff88082f12d780 ffff88082d6e8800 ffffffffa02a50a0 ffff88082d5f5760
<4>Call Trace:
<4> [<ffffffff81182745>] __fput+0xf5/0x210
<4> [<ffffffffa02a50a0>] ? do_open+0x0/0x20 [nfs]
<4> [<ffffffff81182885>] fput+0x25/0x30
<4> [<ffffffff8117e23e>] __dentry_open+0x27e/0x360
<4> [<ffffffff811c397a>] ? inotify_d_instantiate+0x2a/0x60
<4> [<ffffffff8117e4b9>] lookup_instantiate_filp+0x69/0x90
<4> [<ffffffffa02a6679>] nfs_intent_set_file+0x59/0x90 [nfs]
<4> [<ffffffffa02a686b>] nfs_atomic_lookup+0x1bb/0x310 [nfs]
<4> [<ffffffff8118e0c2>] __lookup_hash+0x102/0x160
<4> [<ffffffff81225052>] ? selinux_inode_permission+0x72/0xb0
<4> [<ffffffff8118e76a>] lookup_hash+0x3a/0x50
<4> [<ffffffff81192a4b>] do_filp_open+0x2eb/0xdd0
<4> [<ffffffff8104757c>] ? __do_page_fault+0x1ec/0x480
<4> [<ffffffff8119f562>] ? alloc_fd+0x92/0x160
<4> [<ffffffff8117de79>] do_sys_open+0x69/0x140
<4> [<ffffffff811811f6>] ? sys_lseek+0x66/0x80
<4> [<ffffffff8117df90>] sys_open+0x20/0x30
<4> [<ffffffff8100b072>] system_call_fastpath+0x16/0x1b
<4>Code: 65 48 8b 04 25 c8 cb 00 00 83 a8 44 e0 ff ff 01 5b 41 5c c9 c3 90 55 48 89 e5 53 48 83 ec 08 0f 1f 44 00 00 48 8b 9e a0 00 00 00 <48> 8b 3b e8 13 0c f7 ff 48 89 df e8 ab 3d ec e0 48 83 c4 08 31
<1>RIP  [<ffffffffa02a52c5>] nfs_closedir+0x15/0x30 [nfs]
<4> RSP <ffff88081458bb98>
<4>CR2: 0000000000000000

I think this is ultimately due to a bug on the server. The client had
previously found a directory dentry. It then later tried to do an atomic
open on a new (regular file) dentry. The attributes it got back had the
same filehandle as the previously found directory inode. It then tried
to put the filp because it failed the aops tests for O_DIRECT opens, and
oopsed here because the ctx was still NULL.

Obviously the root cause here is a server issue, but we can take steps
to mitigate this on the client. When nfs_fhget is called, we always know
what type of inode it is. In the event that there's a broken or
malicious server on the other end of the wire, the client can end up
crashing because the wrong ops are set on it.

Have nfs_find_actor check that the inode type is correct after checking
the fileid. The fileid check should rarely ever match, so it should only
rarely ever get to this check. In the case where we have a broken
server, we may see two different inodes with the same i_ino, but the
client should be able to cope with them without crashing.

This should fix the oops reported here:

    https://bugzilla.redhat.com/show_bug.cgi?id=913660

Reported-by: Benny Halevy <[email protected]>
Signed-off-by: Jeff Layton <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Cc: Rui Xiang <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit 5671ab0 upstream.

Fix random kernel panic with below messages when remove dongle.

[ 2212.355447] BUG: unable to handle kernel NULL pointer dereference at 0000000000000250
[ 2212.355527] IP: [<ffffffffa02667f2>] rt2x00usb_kick_tx_entry+0x12/0x160 [rt2x00usb]
[ 2212.355599] PGD 0
[ 2212.355626] Oops: 0000 [#1] SMP
[ 2212.355664] Modules linked in: rt2800usb rt2x00usb rt2800lib crc_ccitt rt2x00lib mac80211 cfg80211 tun arc4 fuse rfcomm bnep snd_hda_codec_realtek snd_hda_intel snd_hda_codec btusb uvcvideo bluetooth snd_hwdep x86_pkg_temp_thermal snd_seq coretemp aesni_intel aes_x86_64 snd_seq_device glue_helper snd_pcm ablk_helper videobuf2_vmalloc sdhci_pci videobuf2_memops videobuf2_core sdhci videodev mmc_core serio_raw snd_page_alloc microcode i2c_i801 snd_timer hid_multitouch thinkpad_acpi lpc_ich mfd_core snd tpm_tis wmi tpm tpm_bios soundcore acpi_cpufreq i915 i2c_algo_bit drm_kms_helper drm i2c_core video [last unloaded: cfg80211]
[ 2212.356224] CPU: 0 PID: 34 Comm: khubd Not tainted 3.12.0-rc3-wl+ #3
[ 2212.356268] Hardware name: LENOVO 3444CUU/3444CUU, BIOS G6ET93WW (2.53 ) 02/04/2013
[ 2212.356319] task: ffff880212f687c0 ti: ffff880212f66000 task.ti: ffff880212f66000
[ 2212.356392] RIP: 0010:[<ffffffffa02667f2>]  [<ffffffffa02667f2>] rt2x00usb_kick_tx_entry+0x12/0x160 [rt2x00usb]
[ 2212.356481] RSP: 0018:ffff880212f67750  EFLAGS: 00010202
[ 2212.356519] RAX: 000000000000000c RBX: 000000000000000c RCX: 0000000000000293
[ 2212.356568] RDX: ffff8801f4dc219a RSI: 0000000000000000 RDI: 0000000000000240
[ 2212.356617] RBP: ffff880212f67778 R08: ffffffffa02667e0 R09: 0000000000000002
[ 2212.356665] R10: 0001f95254ab4b40 R11: ffff880212f675be R12: ffff8801f4dc2150
[ 2212.356712] R13: 0000000000000000 R14: ffffffffa02667e0 R15: 000000000000000d
[ 2212.356761] FS:  0000000000000000(0000) GS:ffff88021e200000(0000) knlGS:0000000000000000
[ 2212.356813] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2212.356852] CR2: 0000000000000250 CR3: 0000000001a0c000 CR4: 00000000001407f0
[ 2212.356899] Stack:
[ 2212.356917]  000000000000000c ffff8801f4dc2150 0000000000000000 ffffffffa02667e0
[ 2212.356980]  000000000000000d ffff880212f677b8 ffffffffa03a31ad ffff8801f4dc219a
[ 2212.357038]  ffff8801f4dc2150 0000000000000000 ffff8800b93217a0 ffff8801f49bc800
[ 2212.357099] Call Trace:
[ 2212.357122]  [<ffffffffa02667e0>] ? rt2x00usb_interrupt_txdone+0x90/0x90 [rt2x00usb]
[ 2212.357174]  [<ffffffffa03a31ad>] rt2x00queue_for_each_entry+0xed/0x170 [rt2x00lib]
[ 2212.357244]  [<ffffffffa026701c>] rt2x00usb_kick_queue+0x5c/0x60 [rt2x00usb]
[ 2212.357314]  [<ffffffffa03a3682>] rt2x00queue_flush_queue+0x62/0xa0 [rt2x00lib]
[ 2212.357386]  [<ffffffffa03a2930>] rt2x00mac_flush+0x30/0x70 [rt2x00lib]
[ 2212.357470]  [<ffffffffa04edded>] ieee80211_flush_queues+0xbd/0x140 [mac80211]
[ 2212.357555]  [<ffffffffa0502e52>] ieee80211_set_disassoc+0x2d2/0x3d0 [mac80211]
[ 2212.357645]  [<ffffffffa0506da3>] ieee80211_mgd_deauth+0x1d3/0x240 [mac80211]
[ 2212.357718]  [<ffffffff8108b17c>] ? try_to_wake_up+0xec/0x290
[ 2212.357788]  [<ffffffffa04dbd18>] ieee80211_deauth+0x18/0x20 [mac80211]
[ 2212.357872]  [<ffffffffa0418ddc>] cfg80211_mlme_deauth+0x9c/0x140 [cfg80211]
[ 2212.357913]  [<ffffffffa041907c>] cfg80211_mlme_down+0x5c/0x60 [cfg80211]
[ 2212.357962]  [<ffffffffa041cd18>] cfg80211_disconnect+0x188/0x1a0 [cfg80211]
[ 2212.358014]  [<ffffffffa04013bc>] ? __cfg80211_stop_sched_scan+0x1c/0x130 [cfg80211]
[ 2212.358067]  [<ffffffffa03f8954>] cfg80211_leave+0xc4/0xe0 [cfg80211]
[ 2212.358124]  [<ffffffffa03f8d1b>] cfg80211_netdev_notifier_call+0x3ab/0x5e0 [cfg80211]
[ 2212.358177]  [<ffffffff815140f8>] ? inetdev_event+0x38/0x510
[ 2212.358217]  [<ffffffff81085a94>] ? __wake_up+0x44/0x50
[ 2212.358254]  [<ffffffff8155995c>] notifier_call_chain+0x4c/0x70
[ 2212.358293]  [<ffffffff81081156>] raw_notifier_call_chain+0x16/0x20
[ 2212.358361]  [<ffffffff814b6dd5>] call_netdevice_notifiers_info+0x35/0x60
[ 2212.358429]  [<ffffffff814b6ec9>] __dev_close_many+0x49/0xd0
[ 2212.358487]  [<ffffffff814b7028>] dev_close_many+0x88/0x100
[ 2212.358546]  [<ffffffff814b8150>] rollback_registered_many+0xb0/0x220
[ 2212.358612]  [<ffffffff814b8319>] unregister_netdevice_many+0x19/0x60
[ 2212.358694]  [<ffffffffa04d8eb2>] ieee80211_remove_interfaces+0x112/0x190 [mac80211]
[ 2212.358791]  [<ffffffffa04c585f>] ieee80211_unregister_hw+0x4f/0x100 [mac80211]
[ 2212.361994]  [<ffffffffa03a1221>] rt2x00lib_remove_dev+0x161/0x1a0 [rt2x00lib]
[ 2212.365240]  [<ffffffffa0266e2e>] rt2x00usb_disconnect+0x2e/0x70 [rt2x00usb]
[ 2212.368470]  [<ffffffff81419ce4>] usb_unbind_interface+0x64/0x1c0
[ 2212.371734]  [<ffffffff813b446f>] __device_release_driver+0x7f/0xf0
[ 2212.374999]  [<ffffffff813b4503>] device_release_driver+0x23/0x30
[ 2212.378131]  [<ffffffff813b3c98>] bus_remove_device+0x108/0x180
[ 2212.381358]  [<ffffffff813b0565>] device_del+0x135/0x1d0
[ 2212.384454]  [<ffffffff81417760>] usb_disable_device+0xb0/0x270
[ 2212.387451]  [<ffffffff8140d9cd>] usb_disconnect+0xad/0x1d0
[ 2212.390294]  [<ffffffff8140f6cd>] hub_thread+0x63d/0x1660
[ 2212.393034]  [<ffffffff8107c860>] ? wake_up_atomic_t+0x30/0x30
[ 2212.395728]  [<ffffffff8140f090>] ? hub_port_debounce+0x130/0x130
[ 2212.398412]  [<ffffffff8107baa0>] kthread+0xc0/0xd0
[ 2212.401058]  [<ffffffff8107b9e0>] ? insert_kthread_work+0x40/0x40
[ 2212.403639]  [<ffffffff8155de3c>] ret_from_fork+0x7c/0xb0
[ 2212.406193]  [<ffffffff8107b9e0>] ? insert_kthread_work+0x40/0x40
[ 2212.408732] Code: 24 58 08 00 00 bf 80 00 00 00 e8 3a c3 e0 e0 5b 41 5c 5d c3 0f 1f 44 00 00 0f 1f 44 00 00 55 48 89 e5 41 57 41 56 41 55 41 54 53 <48> 8b 47 10 48 89 fb 4c 8b 6f 28 4c 8b 20 49 8b 04 24 4c 8b 30
[ 2212.414671] RIP  [<ffffffffa02667f2>] rt2x00usb_kick_tx_entry+0x12/0x160 [rt2x00usb]
[ 2212.417646]  RSP <ffff880212f67750>
[ 2212.420547] CR2: 0000000000000250
[ 2212.441024] ---[ end trace 5442918f33832bce ]---

Signed-off-by: Stanislaw Gruszka <[email protected]>
Acked-by: Helmut Schaa <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit 4912aa6 upstream.

crocode i2c_i801 i2c_core iTCO_wdt iTCO_vendor_support shpchp ioatdma dca be2net sg ses enclosure ext4 mbcache jbd2 sd_mod crc_t10dif ahci megaraid_sas(U) dm_mirror dm_region_hash dm_log dm_mod [last unloaded: scsi_wait_scan]

Pid: 491, comm: scsi_eh_0 Tainted: G        W  ----------------   2.6.32-220.13.1.el6.x86_64 #1 IBM  -[8722PAX]-/00D1461
RIP: 0010:[<ffffffff8124e424>]  [<ffffffff8124e424>] blk_requeue_request+0x94/0xa0
RSP: 0018:ffff881057eefd60  EFLAGS: 00010012
RAX: ffff881d99e3e8a8 RBX: ffff881d99e3e780 RCX: ffff881d99e3e8a8
RDX: ffff881d99e3e8a8 RSI: ffff881d99e3e780 RDI: ffff881d99e3e780
RBP: ffff881057eefd80 R08: ffff881057eefe90 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff881057f92338
R13: 0000000000000000 R14: ffff881057f92338 R15: ffff883058188000
FS:  0000000000000000(0000) GS:ffff880040200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
CR2: 00000000006d3ec0 CR3: 000000302cd7d000 CR4: 00000000000406b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process scsi_eh_0 (pid: 491, threadinfo ffff881057eee000, task ffff881057e29540)
Stack:
 0000000000001057 0000000000000286 ffff8810275efdc0 ffff881057f16000
<0> ffff881057eefdd0 ffffffff81362323 ffff881057eefe20 ffffffff8135f393
<0> ffff881057e29af8 ffff8810275efdc0 ffff881057eefe78 ffff881057eefe90
Call Trace:
 [<ffffffff81362323>] __scsi_queue_insert+0xa3/0x150
 [<ffffffff8135f393>] ? scsi_eh_ready_devs+0x5e3/0x850
 [<ffffffff81362a23>] scsi_queue_insert+0x13/0x20
 [<ffffffff8135e4d4>] scsi_eh_flush_done_q+0x104/0x160
 [<ffffffff8135fb6b>] scsi_error_handler+0x35b/0x660
 [<ffffffff8135f810>] ? scsi_error_handler+0x0/0x660
 [<ffffffff810908c6>] kthread+0x96/0xa0
 [<ffffffff8100c14a>] child_rip+0xa/0x20
 [<ffffffff81090830>] ? kthread+0x0/0xa0
 [<ffffffff8100c140>] ? child_rip+0x0/0x20
Code: 00 00 eb d1 4c 8b 2d 3c 8f 97 00 4d 85 ed 74 bf 49 8b 45 00 49 83 c5 08 48 89 de 4c 89 e7 ff d0 49 8b 45 00 48 85 c0 75 eb eb a4 <0f> 0b eb fe 0f 1f 84 00 00 00 00 00 55 48 89 e5 0f 1f 44 00 00
RIP  [<ffffffff8124e424>] blk_requeue_request+0x94/0xa0
 RSP <ffff881057eefd60>

The RIP is this line:
        BUG_ON(blk_queued_rq(rq));

After digging through the code, I think there may be a race between the
request completion and the timer handler running.

A timer is started for each request put on the device's queue (see
blk_start_request->blk_add_timer).  If the request does not complete
before the timer expires, the timer handler (blk_rq_timed_out_timer)
will mark the request complete atomically:

static inline int blk_mark_rq_complete(struct request *rq)
{
        return test_and_set_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags);
}

and then call blk_rq_timed_out.  The latter function will call
scsi_times_out, which will return one of BLK_EH_HANDLED,
BLK_EH_RESET_TIMER or BLK_EH_NOT_HANDLED.  If BLK_EH_RESET_TIMER is
returned, blk_clear_rq_complete is called, and blk_add_timer is again
called to simply wait longer for the request to complete.

Now, if the request happens to complete while this is going on, what
happens?  Given that we know the completion handler will bail if it
finds the REQ_ATOM_COMPLETE bit set, we need to focus on the completion
handler running after that bit is cleared.  So, from the above
paragraph, after the call to blk_clear_rq_complete.  If the completion
sets REQ_ATOM_COMPLETE before the BUG_ON in blk_add_timer, we go boom
there (I haven't seen this in the cores).  Next, if we get the
completion before the call to list_add_tail, then the timer will
eventually fire for an old req, which may either be freed or reallocated
(there is evidence that this might be the case).  Finally, if the
completion comes in *after* the addition to the timeout list, I think
it's harmless.  The request will be removed from the timeout list,
req_atom_complete will be set, and all will be well.

This will only actually explain the coredumps *IF* the request
structure was freed, reallocated *and* queued before the error handler
thread had a chance to process it.  That is possible, but it may make
sense to keep digging for another race.  I think that if this is what
was happening, we would see other instances of this problem showing up
as null pointer or garbage pointer dereferences, for example when the
request structure was not re-used.  It looks like we actually do run
into that situation in other reports.

This patch moves the BUG_ON(test_bit(REQ_ATOM_COMPLETE,
&req->atomic_flags)); from blk_add_timer to the only caller that could
trip over it (blk_start_request).  It then inverts the calls to
blk_clear_rq_complete and blk_add_timer in blk_rq_timed_out to address
the race.  I've boot tested this patch, but nothing more.

Signed-off-by: Jeff Moyer <[email protected]>
Acked-by: Hannes Reinecke <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit a207f59 upstream.

The probe function is supposed to return NULL on failure (as we can see in
kobj_lookup: kobj = probe(dev, index, data); ... if (kobj) return kobj;

However, in loop and brd, it returns negative error from ERR_PTR.

This causes a crash if we simulate disk allocation failure and run
less -f /dev/loop0 because the negative number is interpreted as a pointer:

BUG: unable to handle kernel NULL pointer dereference at 00000000000002b4
IP: [<ffffffff8118b188>] __blkdev_get+0x28/0x450
PGD 23c677067 PUD 23d6d1067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: loop hpfs nvidia(PO) ip6table_filter ip6_tables uvesafb cfbcopyarea cfbimgblt cfbfillrect fbcon font bitblit fbcon_rotate fbcon_cw fbcon_ud fbcon_ccw softcursor fb fbdev msr ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc tun ipv6 cpufreq_stats cpufreq_ondemand cpufreq_userspace cpufreq_powersave cpufreq_conservative hid_generic spadfs usbhid hid fuse raid0 snd_usb_audio snd_pcm_oss snd_mixer_oss md_mod snd_pcm snd_timer snd_page_alloc snd_hwdep snd_usbmidi_lib dmi_sysfs snd_rawmidi nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack snd soundcore lm85 hwmon_vid ohci_hcd ehci_pci ehci_hcd serverworks sata_svw libata acpi_cpufreq freq_table mperf ide_core usbcore kvm_amd kvm tg3 i2c_piix4 libphy microcode e100 usb_common ptp skge i2c_core pcspkr k10temp evdev floppy hwmon pps_core mii rtc_cmos button processor unix [last unloaded: nvidia]
CPU: 1 PID: 6831 Comm: less Tainted: P        W  O 3.10.15-devel linux-sunxi#18
Hardware name: empty empty/S3992-E, BIOS 'V1.06   ' 06/09/2009
task: ffff880203cc6bc0 ti: ffff88023e47c000 task.ti: ffff88023e47c000
RIP: 0010:[<ffffffff8118b188>]  [<ffffffff8118b188>] __blkdev_get+0x28/0x450
RSP: 0018:ffff88023e47dbd8  EFLAGS: 00010286
RAX: ffffffffffffff74 RBX: ffffffffffffff74 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
RBP: ffff88023e47dc18 R08: 0000000000000002 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88023f519658
R13: ffffffff8118c300 R14: 0000000000000000 R15: ffff88023f519640
FS:  00007f2070bf7700(0000) GS:ffff880247400000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000000002b4 CR3: 000000023da1d000 CR4: 00000000000007e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Stack:
 0000000000000002 0000001d00000000 000000003e47dc50 ffff88023f519640
 ffff88043d5bb668 ffffffff8118c300 ffff88023d683550 ffff88023e47de60
 ffff88023e47dc98 ffffffff8118c10d 0000001d81605698 0000000000000292
Call Trace:
 [<ffffffff8118c300>] ? blkdev_get_by_dev+0x60/0x60
 [<ffffffff8118c10d>] blkdev_get+0x1dd/0x370
 [<ffffffff8118c300>] ? blkdev_get_by_dev+0x60/0x60
 [<ffffffff813cea6c>] ? _raw_spin_unlock+0x2c/0x50
 [<ffffffff8118c300>] ? blkdev_get_by_dev+0x60/0x60
 [<ffffffff8118c365>] blkdev_open+0x65/0x80
 [<ffffffff8114d12e>] do_dentry_open.isra.18+0x23e/0x2f0
 [<ffffffff8114d214>] finish_open+0x34/0x50
 [<ffffffff8115e122>] do_last.isra.62+0x2d2/0xc50
 [<ffffffff8115eb58>] path_openat.isra.63+0xb8/0x4d0
 [<ffffffff81115a8e>] ? might_fault+0x4e/0xa0
 [<ffffffff8115f4f0>] do_filp_open+0x40/0x90
 [<ffffffff813cea6c>] ? _raw_spin_unlock+0x2c/0x50
 [<ffffffff8116db85>] ? __alloc_fd+0xa5/0x1f0
 [<ffffffff8114e45f>] do_sys_open+0xef/0x1d0
 [<ffffffff8114e559>] SyS_open+0x19/0x20
 [<ffffffff813cff16>] system_call_fastpath+0x1a/0x1f
Code: 44 00 00 55 48 89 e5 41 57 49 89 ff 41 56 41 89 d6 41 55 41 54 4c 8d 67 18 53 48 83 ec 18 89 75 cc e9 f2 00 00 00 0f 1f 44 00 00 <48> 8b 80 40 03 00 00 48 89 df 4c 8b 68 58 e8 d5
a4 07 00 44 89
RIP  [<ffffffff8118b188>] __blkdev_get+0x28/0x450
 RSP <ffff88023e47dbd8>
CR2: 00000000000002b4
---[ end trace bb7f32dbf02398dc ]---

The brd change should be backported to stable kernels starting with 2.6.25.
The loop change should be backported to stable kernels starting with 2.6.22.

Signed-off-by: Mikulas Patocka <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit 3ec981e upstream.

loop: fix crash if blk_alloc_queue fails

If blk_alloc_queue fails, loop_add cleans up, but it doesn't clean up the
identifier allocated with idr_alloc. That causes crash on module unload in
idr_for_each(&loop_index_idr, &loop_exit_cb, NULL); where we attempt to
remove non-existed device with that id.

BUG: unable to handle kernel NULL pointer dereference at 0000000000000380
IP: [<ffffffff812057c9>] del_gendisk+0x19/0x2d0
PGD 43d399067 PUD 43d0ad067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: loop(-) dm_snapshot dm_zero dm_mirror dm_region_hash dm_log dm_loop dm_mod ip6table_filter ip6_tables uvesafb cfbcopyarea cfbimgblt cfbfillrect fbcon font bitblit fbcon_rotate fbcon_cw fbcon_ud fbcon_ccw softcursor fb fbdev msr ipt_MASQUERADE iptable_nat nf_nat_ipv4 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables bridge stp llc tun ipv6 cpufreq_userspace cpufreq_stats cpufreq_ondemand cpufreq_conservative cpufreq_powersave spadfs fuse hid_generic usbhid hid raid0 md_mod dmi_sysfs nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack snd_usb_audio snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_page_alloc lm85 hwmon_vid snd_hwdep snd_usbmidi_lib snd_rawmidi snd soundcore acpi_cpufreq ohci_hcd freq_table tg3 ehci_pci mperf ehci_hcd kvm_amd kvm sata_svw serverworks libphy libata ide_core k10temp usbcore hwmon microcode ptp pcspkr pps_core e100 skge mii usb_common i2c_piix4 floppy evdev rtc_cmos i2c_core processor but!
 ton unix
CPU: 7 PID: 2735 Comm: rmmod Tainted: G        W    3.10.15-devel linux-sunxi#15
Hardware name: empty empty/S3992-E, BIOS 'V1.06   ' 06/09/2009
task: ffff88043d38e780 ti: ffff88043d21e000 task.ti: ffff88043d21e000
RIP: 0010:[<ffffffff812057c9>]  [<ffffffff812057c9>] del_gendisk+0x19/0x2d0
RSP: 0018:ffff88043d21fe10  EFLAGS: 00010282
RAX: ffffffffa05102e0 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffff88043ea82800 RDI: 0000000000000000
RBP: ffff88043d21fe48 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000000 R12: 00000000000000ff
R13: 0000000000000080 R14: 0000000000000000 R15: ffff88043ea82800
FS:  00007ff646534700(0000) GS:ffff880447000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000380 CR3: 000000043e9bf000 CR4: 00000000000007e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Stack:
 ffffffff8100aba4 0000000000000092 ffff88043d21fe48 ffff88043ea82800
 00000000000000ff ffff88043d21fe98 0000000000000000 ffff88043d21fe60
 ffffffffa05102b4 0000000000000000 ffff88043d21fe70 ffffffffa05102ec
Call Trace:
 [<ffffffff8100aba4>] ? native_sched_clock+0x24/0x80
 [<ffffffffa05102b4>] loop_remove+0x14/0x40 [loop]
 [<ffffffffa05102ec>] loop_exit_cb+0xc/0x10 [loop]
 [<ffffffff81217b74>] idr_for_each+0x104/0x190
 [<ffffffffa05102e0>] ? loop_remove+0x40/0x40 [loop]
 [<ffffffff8109adc5>] ? trace_hardirqs_on_caller+0x105/0x1d0
 [<ffffffffa05135dc>] loop_exit+0x34/0xa58 [loop]
 [<ffffffff810a98ea>] SyS_delete_module+0x13a/0x260
 [<ffffffff81221d5e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
 [<ffffffff813cff16>] system_call_fastpath+0x1a/0x1f
Code: f0 4c 8b 6d f8 c9 c3 66 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 56 41 55 4c 8d af 80 00 00 00 41 54 53 48 89 fb 48 83 ec 18 <48> 83 bf 80 03 00
00 00 74 4d e8 98 fe ff ff 31 f6 48 c7 c7 20
RIP  [<ffffffff812057c9>] del_gendisk+0x19/0x2d0
 RSP <ffff88043d21fe10>
CR2: 0000000000000380
---[ end trace 64ec069ec70f1309 ]---

Signed-off-by: Mikulas Patocka <[email protected]>
Acked-by: Tejun Heo <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit 4355b70 upstream.

Some bright specification writers decided to write this in the ONFI spec
(from ONFI 3.0, Section 3.1):

  "The number of blocks and number of pages per block is not required to
  be a power of two. In the case where one of these values is not a
  power of two, the corresponding address shall be rounded to an
  integral number of bits such that it addresses a range up to the
  subsequent power of two value. The host shall not access upper
  addresses in a range that is shown as not supported."

This breaks every assumption MTD makes about NAND block/chip-size
dimensions -- they *must* be a power of two!

And of course, an enterprising manufacturer has made use of this lovely
freedom. Exhibit A: Micron MT29F32G08CBADAWP

  "- Plane size: 2 planes x 1064 blocks per plane
   - Device size: 32Gb: 2128 blockss [sic]"

This quickly hits a BUG() in nand_base.c, since the extra dimensions
overflow so we think it's a second chip (on my single-chip setup):

    ONFI param page 0 valid
    ONFI flash detected
    NAND device: Manufacturer ID: 0x2c, Chip ID: 0x44 (Micron MT29F32G08CBADAWP), 4256MiB, page size: 8192, OOB size: 744
    ------------[ cut here ]------------
    kernel BUG at drivers/mtd/nand/nand_base.c:203!
    Internal error: Oops - BUG: 0 [#1] SMP ARM
    [... trim ...]
    [<c02cf3e4>] (nand_select_chip+0x18/0x2c) from [<c02d25c0>] (nand_do_read_ops+0x90/0x424)
    [<c02d25c0>] (nand_do_read_ops+0x90/0x424) from [<c02d2dd8>] (nand_read+0x54/0x78)
    [<c02d2dd8>] (nand_read+0x54/0x78) from [<c02ad2c8>] (mtd_read+0x84/0xbc)
    [<c02ad2c8>] (mtd_read+0x84/0xbc) from [<c02d4b28>] (scan_read.clone.4+0x4c/0x64)
    [<c02d4b28>] (scan_read.clone.4+0x4c/0x64) from [<c02d4c88>] (search_bbt+0x148/0x290)
    [<c02d4c88>] (search_bbt+0x148/0x290) from [<c02d4ea4>] (nand_scan_bbt+0xd4/0x5c0)
    [... trim ...]
    ---[ end trace 0c9363860d865ff2 ]---

So to fix this, just truncate these dimensions down to the greatest
power-of-2 dimension that is less than or equal to the specified
dimension.

Signed-off-by: Brian Norris <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit 42d64e1 upstream.

The SELinux/NetLabel glue code has a locking bug that affects systems
with NetLabel enabled, see the kernel error message below.  This patch
corrects this problem by converting the bottom half socket lock to a
more conventional, and correct for this call-path, lock_sock() call.

 ===============================
 [ INFO: suspicious RCU usage. ]
 3.11.0-rc3+ linux-sunxi#19 Not tainted
 -------------------------------
 net/ipv4/cipso_ipv4.c:1928 suspicious rcu_dereference_protected() usage!

 other info that might help us debug this:

 rcu_scheduler_active = 1, debug_locks = 0
 2 locks held by ping/731:
  #0:  (slock-AF_INET/1){+.-...}, at: [...] selinux_netlbl_socket_connect
  #1:  (rcu_read_lock){.+.+..}, at: [<...>] netlbl_conn_setattr

 stack backtrace:
 CPU: 1 PID: 731 Comm: ping Not tainted 3.11.0-rc3+ linux-sunxi#19
 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
  0000000000000001 ffff88006f659d28 ffffffff81726b6a ffff88003732c500
  ffff88006f659d58 ffffffff810e4457 ffff88006b845a00 0000000000000000
  000000000000000c ffff880075aa2f50 ffff88006f659d90 ffffffff8169bec7
 Call Trace:
  [<ffffffff81726b6a>] dump_stack+0x54/0x74
  [<ffffffff810e4457>] lockdep_rcu_suspicious+0xe7/0x120
  [<ffffffff8169bec7>] cipso_v4_sock_setattr+0x187/0x1a0
  [<ffffffff8170f317>] netlbl_conn_setattr+0x187/0x190
  [<ffffffff8170f195>] ? netlbl_conn_setattr+0x5/0x190
  [<ffffffff8131ac9e>] selinux_netlbl_socket_connect+0xae/0xc0
  [<ffffffff81303025>] selinux_socket_connect+0x135/0x170
  [<ffffffff8119d127>] ? might_fault+0x57/0xb0
  [<ffffffff812fb146>] security_socket_connect+0x16/0x20
  [<ffffffff815d3ad3>] SYSC_connect+0x73/0x130
  [<ffffffff81739a85>] ? sysret_check+0x22/0x5d
  [<ffffffff810e5e2d>] ? trace_hardirqs_on_caller+0xfd/0x1c0
  [<ffffffff81373d4e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
  [<ffffffff815d52be>] SyS_connect+0xe/0x10
  [<ffffffff81739a59>] system_call_fastpath+0x16/0x1b

Signed-off-by: Paul Moore <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit 4e58e54 upstream.

If an TRACE_EVENT() uses __assign_str() or __get_str on a NULL pointer
then the following oops will happen:

BUG: unable to handle kernel NULL pointer dereference at   (null)
IP: [<c127a17b>] strlen+0x10/0x1a
*pde = 00000000 ^M
Oops: 0000 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.13.0-rc1-test+ #2
Hardware name:                  /DG965MQ, BIOS MQ96510J.86A.0372.2006.0605.1717 06/05/2006^M
task: f5cde9f0 ti: f5e5e000 task.ti: f5e5e000
EIP: 0060:[<c127a17b>] EFLAGS: 00210046 CPU: 1
EIP is at strlen+0x10/0x1a
EAX: 00000000 EBX: c2472da8 ECX: ffffffff EDX: c2472da8
ESI: c1c5e5fc EDI: 00000000 EBP: f5e5fe84 ESP: f5e5fe80
 DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
CR0: 8005003b CR2: 00000000 CR3: 01f32000 CR4: 000007d0
Stack:
 f5f18b90 f5e5feb8 c10687a8 0759004f 00000005 00000005 00000005 00200046
 00000002 00000000 c1082a93 f56c7e28 c2472da8 c1082a93 f5e5fee4 c106bc61^M
 00000000 c1082a93 00000000 00000000 00000001 00200046 00200082 00000000
Call Trace:
 [<c10687a8>] ftrace_raw_event_lock+0x39/0xc0
 [<c1082a93>] ? ktime_get+0x29/0x69
 [<c1082a93>] ? ktime_get+0x29/0x69
 [<c106bc61>] lock_release+0x57/0x1a5
 [<c1082a93>] ? ktime_get+0x29/0x69
 [<c10824dd>] read_seqcount_begin.constprop.7+0x4d/0x75
 [<c1082a93>] ? ktime_get+0x29/0x69^M
 [<c1082a93>] ktime_get+0x29/0x69
 [<c108a46a>] __tick_nohz_idle_enter+0x1e/0x426
 [<c10690e8>] ? lock_release_holdtime.part.19+0x48/0x4d
 [<c10bc184>] ? time_hardirqs_off+0xe/0x28
 [<c1068c82>] ? trace_hardirqs_off_caller+0x3f/0xaf
 [<c108a8cb>] tick_nohz_idle_enter+0x59/0x62
 [<c1079242>] cpu_startup_entry+0x64/0x192
 [<c102299c>] start_secondary+0x277/0x27c
Code: 90 89 c6 89 d0 88 c4 ac 38 e0 74 09 84 c0 75 f7 be 01 00 00 00 89 f0 48 5e 5d c3 55 89 e5 57 66 66 66 66 90 83 c9 ff 89 c7 31 c0 <f2> ae f7 d1 8d 41 ff 5f 5d c3 55 89 e5 57 66 66 66 66 90 31 ff
EIP: [<c127a17b>] strlen+0x10/0x1a SS:ESP 0068:f5e5fe80
CR2: 0000000000000000
---[ end trace 01bc47bf519ec1b2 ]---

New tracepoints have been added that have allowed for NULL pointers
being assigned to strings. To fix this, change the TRACE_EVENT() code
to check for NULL and if it is, it will assign "(null)" to it instead
(similar to what glibc printf does).

Reported-by: Shuah Khan <[email protected]>
Reported-by: Jovi Zhangwei <[email protected]>
Link: http://lkml.kernel.org/r/CAGdX0WFeEuy+DtpsJzyzn0343qEEjLX97+o1VREFkUEhndC+5Q@mail.gmail.com
Link: http://lkml.kernel.org/r/[email protected]
Fixes: 9cbf117 ("tracing/events: provide string with undefined size support")
Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit 5638cab upstream.

There are cases when cryptlen can be zero in crypto_ccm_auth():
-encryptiom: input scatterlist length is zero (no plaintext)
-decryption: input scatterlist contains only the mac
plus the condition of having different source and destination buffers
(or else scatterlist length = max(plaintext_len, ciphertext_len)).

These are not handled correctly, leading to crashes like:

root@p4080ds:~/crypto# insmod tcrypt.ko mode=45
------------[ cut here ]------------
kernel BUG at crypto/scatterwalk.c:37!
Oops: Exception in kernel mode, sig: 5 [#1]
SMP NR_CPUS=8 P4080 DS
Modules linked in: tcrypt(+) crc32c xts xcbc vmac pcbc ecb gcm ghash_generic gf128mul ccm ctr seqiv
CPU: 3 PID: 1082 Comm: cryptomgr_test Not tainted 3.11.0 linux-sunxi#14
task: ee12c5b0 ti: eecd0000 task.ti: eecd0000
NIP: c0204d98 LR: f9225848 CTR: c0204d80
REGS: eecd1b70 TRAP: 0700   Not tainted  (3.11.0)
MSR: 00029002 <CE,EE,ME>  CR: 22044022  XER: 20000000

GPR00: f9225c94 eecd1c20 ee12c5b0 eecd1c28 ee879400 ee879400 00000000 ee607464
GPR08: 00000001 00000001 00000000 006b0000 c0204d80 00000000 00000002 c0698e20
GPR16: ee987000 ee895000 fffffff4 ee879500 00000100 eecd1d58 00000001 00000000
GPR24: ee879400 00000020 00000000 00000000 ee5b2800 ee607430 00000004 ee607460
NIP [c0204d98] scatterwalk_start+0x18/0x30
LR [f9225848] get_data_to_compute+0x28/0x2f0 [ccm]
Call Trace:
[eecd1c20] [f9225974] get_data_to_compute+0x154/0x2f0 [ccm] (unreliable)
[eecd1c70] [f9225c94] crypto_ccm_auth+0x184/0x1d0 [ccm]
[eecd1cb0] [f9225d40] crypto_ccm_encrypt+0x60/0x2d0 [ccm]
[eecd1cf0] [c020d77c] __test_aead+0x3ec/0xe20
[eecd1e20] [c020f35c] test_aead+0x6c/0xe0
[eecd1e40] [c020f420] alg_test_aead+0x50/0xd0
[eecd1e60] [c020e5e4] alg_test+0x114/0x2e0
[eecd1ee0] [c020bd1c] cryptomgr_test+0x4c/0x60
[eecd1ef0] [c0047058] kthread+0xa8/0xb0
[eecd1f40] [c000eb0c] ret_from_kernel_thread+0x5c/0x64
Instruction dump:
0f080000 81290024 552807fe 0f080000 5529003a 4bffffb4 90830000 39400000
39000001 8124000c 2f890000 7d28579e <0f090000> 81240008 91230004 4e800020
---[ end trace 6d652dfcd1be37bd ]---

Cc: Jussi Kivilinna <[email protected]>
Signed-off-by: Horia Geanta <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Jan 18, 2014
commit a0c20fb upstream.

After commit e9e4ea7
"net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data"
The Versatile SMSC LAN91C111 is crashing like this:

------------[ cut here ]------------
kernel BUG at /home/linus/linux/drivers/net/ethernet/smsc/smc91x.c:599!
Internal error: Oops - BUG: 0 [#1] ARM
Modules linked in:
CPU: 0 PID: 43 Comm: udhcpc Not tainted 3.13.0-rc1+ linux-sunxi#24
task: c6ccfaa0 ti: c6cd0000 task.ti: c6cd0000
PC is at smc_hardware_send_pkt+0x198/0x22c
LR is at smc_hardware_send_pkt+0x24/0x22c
pc : [<c01be324>]    lr : [<c01be1b0>]    psr: 20000013
sp : c6cd1d08  ip : 00000001  fp : 00000000
r10: c02adb08  r9 : 00000000  r8 : c6ced802
r7 : c786fba0  r6 : 00000146  r5 : c8800000  r4 : c78d6000
r3 : 0000000f  r2 : 00000146  r1 : 00000000  r0 : 00000031
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 0005317f  Table: 06cf4000  DAC: 00000015
Process udhcpc (pid: 43, stack limit = 0xc6cd01c0)
Stack: (0xc6cd1d08 to 0xc6cd2000)
1d00:                   00000010 c8800000 c78d6000 c786fba0 c78d6000 c01be868
1d20: c01be7a4 00004000 00000000 c786fba0 c6c12b80 c0208554 000004d0 c780fc60
1d40: 00000220 c01fb734 00000000 00000000 00000000 c6c9a440 c6c12b80 c78d6000
1d60: c786fba0 c6c9a440 00000000 c021d1d8 00000000 00000000 c6c12b80 c78d6000
1d80: c786fba0 00000001 c6c9a440 c02087f8 c6c9a4a0 00080008 00000000 00000000
1da0: c78d6000 c786fba0 c78d6000 00000138 00000000 00000000 00000000 00000000
1dc0: 00000000 c027ba74 00000138 00000138 00000001 00000010 c6cedc00 00000000
1de0: 00000008 c7404400 c6cd1eec c6cd1f14 c067a73c c065c0b8 00000000 c067a740
1e00: 01ffffff 002040d0 00000000 00000000 00000000 00000000 00000000 ffffffff
1e20: 43004400 00110022 c6cdef20 c027ae8c c6ccfaa0 be82d65c 00000014 be82d3cc
1e40: 00000000 00000000 00000000 c01f2870 00000000 00000000 00000000 c6cd1e88
1e60: c6ccfaa0 00000000 00000000 00000000 00000000 00000000 00000000 00000000
1e80: 00000000 00000000 00000031 c7802310 c7802300 00000138 c7404400 c0771da0
1ea0: 00000000 c6cd1eec c7800340 00000138 be82d65c 00000014 be82d3cc c6cd1f08
1ec0: 00000014 00000000 c7404400 c7404400 00000138 c01f4628 c78d6000 00000000
1ee0: 00000000 be82d3cc 00000138 c6cd1f08 00000014 c6cd1ee4 00000001 00000000
1f00: 00000000 00000000 00080011 00000002 06000000 ffffffff 0000ffff 00000002
1f20: 06000000 ffffffff 0000ffff c00928c8 c065c52 c6cd1f58 00000003 c009299c
1f40: 00000003 c065c52 c7404400 00000000 c7404400 c01f2218 c78106b0 c7441cb0
1f60: 00000000 00000006 c06799fc 00000000 00000000 00000006 00000000 c01f3ee0
1f80: 00000000 00000000 be82d678 be82d65c 00000014 00000001 00000122 c00139c8
1fa0: c6cd0000 c0013840 be82d65c 00000014 00000006 be82d3cc 00000138 00000000
1fc0: be82d65c 00000014 00000001 00000122 00000000 00000000 00018cb1 00000000
1fe0: 00003801 be82d3a8 0003a0c7 b6e9af08 60000010 00000006 00000000 00000000
[<c01be324>] (smc_hardware_send_pkt+0x198/0x22c) from [<c01be868>] (smc_hard_start_xmit+0xc4/0x1e8)
[<c01be868>] (smc_hard_start_xmit+0xc4/0x1e8) from [<c0208554>] (dev_hard_start_xmit+0x460/0x4cc)
[<c0208554>] (dev_hard_start_xmit+0x460/0x4cc) from [<c021d1d8>] (sch_direct_xmit+0x94/0x18c)
[<c021d1d8>] (sch_direct_xmit+0x94/0x18c) from [<c02087f8>] (dev_queue_xmit+0x238/0x42c)
[<c02087f8>] (dev_queue_xmit+0x238/0x42c) from [<c027ba74>] (packet_sendmsg+0xbe8/0xd28)
[<c027ba74>] (packet_sendmsg+0xbe8/0xd28) from [<c01f2870>] (sock_sendmsg+0x84/0xa8)
[<c01f2870>] (sock_sendmsg+0x84/0xa8) from [<c01f4628>] (SyS_sendto+0xb8/0xdc)
[<c01f4628>] (SyS_sendto+0xb8/0xdc) from [<c0013840>] (ret_fast_syscall+0x0/0x2c)
Code: e3130002 1a000001 e3130001 0affffcd (e7f001f2)
---[ end trace 81104fe70e8da7fe ]---
Kernel panic - not syncing: Fatal exception in interrupt

This is because the macro operations in smc91x.h defined
for Versatile are missing SMC_outsw() as used in this
commit.

The Versatile needs and uses the same accessors as the other
platforms in the first if(...) clause, just switch it to using
that and we have one problem less to worry about.

This includes a hunk of a patch from Will Deacon fixin
the other 32bit platforms as well: Innokom, Ramses, PXA,
PCM027.

Checkpatch complains about spacing, but I have opted to
follow the style of this .h-file.

Cc: Russell King <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: Eric Miao <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Feb 17, 2014
[ Upstream commit 50dc875 ]

There's a possible deadlock if we flush the peers notifying work during setting
mtu:

[   22.991149] ======================================================
[   22.991173] [ INFO: possible circular locking dependency detected ]
[   22.991198] 3.10.0-54.0.1.el7.x86_64.debug #1 Not tainted
[   22.991219] -------------------------------------------------------
[   22.991243] ip/974 is trying to acquire lock:
[   22.991261]  ((&(&net_device_ctx->dwork)->work)){+.+.+.}, at: [<ffffffff8108af95>] flush_work+0x5/0x2e0
[   22.991307]
but task is already holding lock:
[   22.991330]  (rtnl_mutex){+.+.+.}, at: [<ffffffff81539deb>] rtnetlink_rcv+0x1b/0x40
[   22.991367]
which lock already depends on the new lock.

[   22.991398]
the existing dependency chain (in reverse order) is:
[   22.991426]
-> #1 (rtnl_mutex){+.+.+.}:
[   22.991449]        [<ffffffff810dfdd9>] __lock_acquire+0xb19/0x1260
[   22.991477]        [<ffffffff810e0d12>] lock_acquire+0xa2/0x1f0
[   22.991501]        [<ffffffff81673659>] mutex_lock_nested+0x89/0x4f0
[   22.991529]        [<ffffffff815392b7>] rtnl_lock+0x17/0x20
[   22.991552]        [<ffffffff815230b2>] netdev_notify_peers+0x12/0x30
[   22.991579]        [<ffffffffa0340212>] netvsc_send_garp+0x22/0x30 [hv_netvsc]
[   22.991610]        [<ffffffff8108d251>] process_one_work+0x211/0x6e0
[   22.991637]        [<ffffffff8108d83b>] worker_thread+0x11b/0x3a0
[   22.991663]        [<ffffffff81095e5d>] kthread+0xed/0x100
[   22.991686]        [<ffffffff81681c6c>] ret_from_fork+0x7c/0xb0
[   22.991715]
-> #0 ((&(&net_device_ctx->dwork)->work)){+.+.+.}:
[   22.991715]        [<ffffffff810de817>] check_prevs_add+0x967/0x970
[   22.991715]        [<ffffffff810dfdd9>] __lock_acquire+0xb19/0x1260
[   22.991715]        [<ffffffff810e0d12>] lock_acquire+0xa2/0x1f0
[   22.991715]        [<ffffffff8108afde>] flush_work+0x4e/0x2e0
[   22.991715]        [<ffffffff8108e1b5>] __cancel_work_timer+0x95/0x130
[   22.991715]        [<ffffffff8108e303>] cancel_delayed_work_sync+0x13/0x20
[   22.991715]        [<ffffffffa03404e4>] netvsc_change_mtu+0x84/0x200 [hv_netvsc]
[   22.991715]        [<ffffffff815233d4>] dev_set_mtu+0x34/0x80
[   22.991715]        [<ffffffff8153bc2a>] do_setlink+0x23a/0xa00
[   22.991715]        [<ffffffff8153d054>] rtnl_newlink+0x394/0x5e0
[   22.991715]        [<ffffffff81539eac>] rtnetlink_rcv_msg+0x9c/0x260
[   22.991715]        [<ffffffff8155cdd9>] netlink_rcv_skb+0xa9/0xc0
[   22.991715]        [<ffffffff81539dfa>] rtnetlink_rcv+0x2a/0x40
[   22.991715]        [<ffffffff8155c41d>] netlink_unicast+0xdd/0x190
[   22.991715]        [<ffffffff8155c807>] netlink_sendmsg+0x337/0x750
[   22.991715]        [<ffffffff8150d219>] sock_sendmsg+0x99/0xd0
[   22.991715]        [<ffffffff8150d63e>] ___sys_sendmsg+0x39e/0x3b0
[   22.991715]        [<ffffffff8150eba2>] __sys_sendmsg+0x42/0x80
[   22.991715]        [<ffffffff8150ebf2>] SyS_sendmsg+0x12/0x20
[   22.991715]        [<ffffffff81681d19>] system_call_fastpath+0x16/0x1b

This is because we hold the rtnl_lock() before ndo_change_mtu() and try to flush
the work in netvsc_change_mtu(), in the mean time, netdev_notify_peers() may be
called from worker and also trying to hold the rtnl_lock. This will lead the
flush won't succeed forever. Solve this by not canceling and flushing the work,
this is safe because the transmission done by NETDEV_NOTIFY_PEERS was
synchronized with the netif_tx_disable() called by netvsc_change_mtu().

Reported-by: Yaju Cao <[email protected]>
Tested-by: Yaju Cao <[email protected]>
Cc: K. Y. Srinivasan <[email protected]>
Cc: Haiyang Zhang <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
Acked-by: Haiyang Zhang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Feb 17, 2014
[ Upstream commit c234975 ]

Binding might result in a NULL device, which is dereferenced
causing this BUG:

[ 1317.260548] BUG: unable to handle kernel NULL pointer dereference at 000000000000097
4
[ 1317.261847] IP: [<ffffffff84225f52>] rds_ib_laddr_check+0x82/0x110
[ 1317.263315] PGD 418bcb067 PUD 3ceb21067 PMD 0
[ 1317.263502] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
[ 1317.264179] Dumping ftrace buffer:
[ 1317.264774]    (ftrace buffer empty)
[ 1317.265220] Modules linked in:
[ 1317.265824] CPU: 4 PID: 836 Comm: trinity-child46 Tainted: G        W    3.13.0-rc4-
next-20131218-sasha-00013-g2cebb9b-dirty #4159
[ 1317.267415] task: ffff8803ddf33000 ti: ffff8803cd31a000 task.ti: ffff8803cd31a000
[ 1317.268399] RIP: 0010:[<ffffffff84225f52>]  [<ffffffff84225f52>] rds_ib_laddr_check+
0x82/0x110
[ 1317.269670] RSP: 0000:ffff8803cd31bdf8  EFLAGS: 00010246
[ 1317.270230] RAX: 0000000000000000 RBX: ffff88020b0dd388 RCX: 0000000000000000
[ 1317.270230] RDX: ffffffff8439822e RSI: 00000000000c000a RDI: 0000000000000286
[ 1317.270230] RBP: ffff8803cd31be38 R08: 0000000000000000 R09: 0000000000000000
[ 1317.270230] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
[ 1317.270230] R13: 0000000054086700 R14: 0000000000a25de0 R15: 0000000000000031
[ 1317.270230] FS:  00007ff40251d700(0000) GS:ffff88022e200000(0000) knlGS:000000000000
0000
[ 1317.270230] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 1317.270230] CR2: 0000000000000974 CR3: 00000003cd478000 CR4: 00000000000006e0
[ 1317.270230] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 1317.270230] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000090602
[ 1317.270230] Stack:
[ 1317.270230]  0000000054086700 5408670000a25de0 5408670000000002 0000000000000000
[ 1317.270230]  ffffffff84223542 00000000ea54c767 0000000000000000 ffffffff86d26160
[ 1317.270230]  ffff8803cd31be68 ffffffff84223556 ffff8803cd31beb8 ffff8800c6765280
[ 1317.270230] Call Trace:
[ 1317.270230]  [<ffffffff84223542>] ? rds_trans_get_preferred+0x42/0xa0
[ 1317.270230]  [<ffffffff84223556>] rds_trans_get_preferred+0x56/0xa0
[ 1317.270230]  [<ffffffff8421c9c3>] rds_bind+0x73/0xf0
[ 1317.270230]  [<ffffffff83e4ce62>] SYSC_bind+0x92/0xf0
[ 1317.270230]  [<ffffffff812493f8>] ? context_tracking_user_exit+0xb8/0x1d0
[ 1317.270230]  [<ffffffff8119313d>] ? trace_hardirqs_on+0xd/0x10
[ 1317.270230]  [<ffffffff8107a852>] ? syscall_trace_enter+0x32/0x290
[ 1317.270230]  [<ffffffff83e4cece>] SyS_bind+0xe/0x10
[ 1317.270230]  [<ffffffff843a6ad0>] tracesys+0xdd/0xe2
[ 1317.270230] Code: 00 8b 45 cc 48 8d 75 d0 48 c7 45 d8 00 00 00 00 66 c7 45 d0 02 00
89 45 d4 48 89 df e8 78 49 76 ff 41 89 c4 85 c0 75 0c 48 8b 03 <80> b8 74 09 00 00 01 7
4 06 41 bc 9d ff ff ff f6 05 2a b6 c2 02
[ 1317.270230] RIP  [<ffffffff84225f52>] rds_ib_laddr_check+0x82/0x110
[ 1317.270230]  RSP <ffff8803cd31bdf8>
[ 1317.270230] CR2: 0000000000000974

Signed-off-by: Sasha Levin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Feb 17, 2014
commit bee09ed upstream.

On AMD family 10h we see following error messages while waking up from
S3 for all non-boot CPUs leading to a failed IBS initialization:

 Enabling non-boot CPUs ...
 smpboot: Booting Node 0 Processor 1 APIC 0x1
 [Firmware Bug]: cpu 1, try to use APIC500 (LVT offset 0) for vector 0x400, but the register is already in use for vector 0xf9 on another cpu
 perf: IBS APIC setup failed on cpu #1
 process: Switch to broadcast mode on CPU1
 CPU1 is up
 ...
 ACPI: Waking up from system sleep state S3

Reason for this is that during suspend the LVT offset for the IBS
vector gets lost and needs to be reinialized while resuming.

The offset is read from the IBSCTL msr. On family 10h the offset needs
to be 1 as offset 0 is used for the MCE threshold interrupt, but
firmware assings it for IBS to 0 too. The kernel needs to reprogram
the vector. The msr is a readonly node msr, but a new value can be
written via pci config space access. The reinitialization is
implemented for family 10h in setup_ibs_ctl() which is forced during
IBS setup.

This patch fixes IBS setup after waking up from S3 by adding
resume/supend hooks for the boot cpu which does the offset
reinitialization.

Marking it as stable to let distros pick up this fix.

Signed-off-by: Robert Richter <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Cc: Linus Torvalds <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Feb 17, 2014
…ccessfully

commit a49ecbc upstream.

After a successful hugetlb page migration by soft offline, the source
page will either be freed into hugepage_freelists or buddy(over-commit
page).  If page is in buddy, page_hstate(page) will be NULL.  It will
hit a NULL pointer dereference in dequeue_hwpoisoned_huge_page().

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000058
  IP: [<ffffffff81163761>] dequeue_hwpoisoned_huge_page+0x131/0x1d0
  PGD c23762067 PUD c24be2067 PMD 0
  Oops: 0000 [#1] SMP

So check PageHuge(page) after call migrate_pages() successfully.

[wujg: backport to 3.4:
 - adjust context
 - s/num_poisoned_pages/mce_bad_pages/]

Signed-off-by: Jianguo Wu <[email protected]>
Tested-by: Naoya Horiguchi <[email protected]>
Reviewed-by: Naoya Horiguchi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Feb 17, 2014
…ssion()

commit 3dc91d4 upstream.

While running stress tests on adding and deleting ftrace instances I hit
this bug:

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
  IP: selinux_inode_permission+0x85/0x160
  PGD 63681067 PUD 7ddbe067 PMD 0
  Oops: 0000 [#1] PREEMPT
  CPU: 0 PID: 5634 Comm: ftrace-test-mki Not tainted 3.13.0-rc4-test-00033-gd2a6dde-dirty linux-sunxi#20
  Hardware name:                  /DG965MQ, BIOS MQ96510J.86A.0372.2006.0605.1717 06/05/2006
  task: ffff880078375800 ti: ffff88007ddb0000 task.ti: ffff88007ddb0000
  RIP: 0010:[<ffffffff812d8bc5>]  [<ffffffff812d8bc5>] selinux_inode_permission+0x85/0x160
  RSP: 0018:ffff88007ddb1c48  EFLAGS: 00010246
  RAX: 0000000000000000 RBX: 0000000000800000 RCX: ffff88006dd43840
  RDX: 0000000000000001 RSI: 0000000000000081 RDI: ffff88006ee46000
  RBP: ffff88007ddb1c88 R08: 0000000000000000 R09: ffff88007ddb1c54
  R10: 6e6576652f6f6f66 R11: 0000000000000003 R12: 0000000000000000
  R13: 0000000000000081 R14: ffff88006ee46000 R15: 0000000000000000
  FS:  00007f217b5b6700(0000) GS:ffffffff81e21000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033^M
  CR2: 0000000000000020 CR3: 000000006a0fe000 CR4: 00000000000007f0
  Call Trace:
    security_inode_permission+0x1c/0x30
    __inode_permission+0x41/0xa0
    inode_permission+0x18/0x50
    link_path_walk+0x66/0x920
    path_openat+0xa6/0x6c0
    do_filp_open+0x43/0xa0
    do_sys_open+0x146/0x240
    SyS_open+0x1e/0x20
    system_call_fastpath+0x16/0x1b
  Code: 84 a1 00 00 00 81 e3 00 20 00 00 89 d8 83 c8 02 40 f6 c6 04 0f 45 d8 40 f6 c6 08 74 71 80 cf 02 49 8b 46 38 4c 8d 4d cc 45 31 c0 <0f> b7 50 20 8b 70 1c 48 8b 41 70 89 d9 8b 78 04 e8 36 cf ff ff
  RIP  selinux_inode_permission+0x85/0x160
  CR2: 0000000000000020

Investigating, I found that the inode->i_security was NULL, and the
dereference of it caused the oops.

in selinux_inode_permission():

	isec = inode->i_security;

	rc = avc_has_perm_noaudit(sid, isec->sid, isec->sclass, perms, 0, &avd);

Note, the crash came from stressing the deletion and reading of debugfs
files.  I was not able to recreate this via normal files.  But I'm not
sure they are safe.  It may just be that the race window is much harder
to hit.

What seems to have happened (and what I have traced), is the file is
being opened at the same time the file or directory is being deleted.
As the dentry and inode locks are not held during the path walk, nor is
the inodes ref counts being incremented, there is nothing saving these
structures from being discarded except for an rcu_read_lock().

The rcu_read_lock() protects against freeing of the inode, but it does
not protect freeing of the inode_security_struct.  Now if the freeing of
the i_security happens with a call_rcu(), and the i_security field of
the inode is not changed (it gets freed as the inode gets freed) then
there will be no issue here.  (Linus Torvalds suggested not setting the
field to NULL such that we do not need to check if it is NULL in the
permission check).

Note, this is a hack, but it fixes the problem at hand.  A real fix is
to restructure the destroy_inode() to call all the destructor handlers
from the RCU callback.  But that is a major job to do, and requires a
lot of work.  For now, we just band-aid this bug with this fix (it
works), and work on a more maintainable solution in the future.

Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]

Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Feb 17, 2014
…ssion()

While running stress tests on adding and deleting ftrace instances I hit
this bug:

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
  IP: selinux_inode_permission+0x85/0x160
  PGD 63681067 PUD 7ddbe067 PMD 0
  Oops: 0000 [#1] PREEMPT
  CPU: 0 PID: 5634 Comm: ftrace-test-mki Not tainted 3.13.0-rc4-test-00033-gd2a6dde-dirty linux-sunxi#20
  Hardware name:                  /DG965MQ, BIOS MQ96510J.86A.0372.2006.0605.1717 06/05/2006
  task: ffff880078375800 ti: ffff88007ddb0000 task.ti: ffff88007ddb0000
  RIP: 0010:[<ffffffff812d8bc5>]  [<ffffffff812d8bc5>] selinux_inode_permission+0x85/0x160
  RSP: 0018:ffff88007ddb1c48  EFLAGS: 00010246
  RAX: 0000000000000000 RBX: 0000000000800000 RCX: ffff88006dd43840
  RDX: 0000000000000001 RSI: 0000000000000081 RDI: ffff88006ee46000
  RBP: ffff88007ddb1c88 R08: 0000000000000000 R09: ffff88007ddb1c54
  R10: 6e6576652f6f6f66 R11: 0000000000000003 R12: 0000000000000000
  R13: 0000000000000081 R14: ffff88006ee46000 R15: 0000000000000000
  FS:  00007f217b5b6700(0000) GS:ffffffff81e21000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033^M
  CR2: 0000000000000020 CR3: 000000006a0fe000 CR4: 00000000000007f0
  Call Trace:
    security_inode_permission+0x1c/0x30
    __inode_permission+0x41/0xa0
    inode_permission+0x18/0x50
    link_path_walk+0x66/0x920
    path_openat+0xa6/0x6c0
    do_filp_open+0x43/0xa0
    do_sys_open+0x146/0x240
    SyS_open+0x1e/0x20
    system_call_fastpath+0x16/0x1b
  Code: 84 a1 00 00 00 81 e3 00 20 00 00 89 d8 83 c8 02 40 f6 c6 04 0f 45 d8 40 f6 c6 08 74 71 80 cf 02 49 8b 46 38 4c 8d 4d cc 45 31 c0 <0f> b7 50 20 8b 70 1c 48 8b 41 70 89 d9 8b 78 04 e8 36 cf ff ff
  RIP  selinux_inode_permission+0x85/0x160
  CR2: 0000000000000020

Investigating, I found that the inode->i_security was NULL, and the
dereference of it caused the oops.

in selinux_inode_permission():

	isec = inode->i_security;

	rc = avc_has_perm_noaudit(sid, isec->sid, isec->sclass, perms, 0, &avd);

Note, the crash came from stressing the deletion and reading of debugfs
files.  I was not able to recreate this via normal files.  But I'm not
sure they are safe.  It may just be that the race window is much harder
to hit.

What seems to have happened (and what I have traced), is the file is
being opened at the same time the file or directory is being deleted.
As the dentry and inode locks are not held during the path walk, nor is
the inodes ref counts being incremented, there is nothing saving these
structures from being discarded except for an rcu_read_lock().

The rcu_read_lock() protects against freeing of the inode, but it does
not protect freeing of the inode_security_struct.  Now if the freeing of
the i_security happens with a call_rcu(), and the i_security field of
the inode is not changed (it gets freed as the inode gets freed) then
there will be no issue here.  (Linus Torvalds suggested not setting the
field to NULL such that we do not need to check if it is NULL in the
permission check).

Note, this is a hack, but it fixes the problem at hand.  A real fix is
to restructure the destroy_inode() to call all the destructor handlers
from the RCU callback.  But that is a major job to do, and requires a
lot of work.  For now, we just band-aid this bug with this fix (it
works), and work on a more maintainable solution in the future.

Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]

Cc: [email protected]
Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
michalliu pushed a commit that referenced this issue Feb 17, 2014
commit 0916404 upstream.

In https://bugzilla.kernel.org/show_bug.cgi?id=67561, a locking dependency is reported
when b43 is used with hostapd, and rfkill is used to kill the radio output.

The lockdep splat (in part) is as follows:

======================================================
[ INFO: possible circular locking dependency detected ]
3.12.0 #1 Not tainted
-------------------------------------------------------
rfkill/10040 is trying to acquire lock:
 (rtnl_mutex){+.+.+.}, at: [<ffffffff8146f282>] rtnl_lock+0x12/0x20

but task is already holding lock:
 (rfkill_global_mutex){+.+.+.}, at: [<ffffffffa04832ca>] rfkill_fop_write+0x6a/0x170 [rfkill]

--snip--

Chain exists of:
  rtnl_mutex --> misc_mtx --> rfkill_global_mutex

The fix is to move the initialization of the hardware random number generator
outside the code range covered by the rtnl_mutex.

Reported-by: yury <[email protected]>
Tested-by: yury <[email protected]>
Signed-off-by: Larry Finger <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
michalliu pushed a commit that referenced this issue Feb 17, 2014
Setting an empty security context (length=0) on a file will
lead to incorrectly dereferencing the type and other fields
of the security context structure, yielding a kernel BUG.
As a zero-length security context is never valid, just reject
all such security contexts whether coming from userspace
via setxattr or coming from the filesystem upon a getxattr
request by SELinux.

Setting a security context value (empty or otherwise) unknown to
SELinux in the first place is only possible for a root process
(CAP_MAC_ADMIN), and, if running SELinux in enforcing mode, only
if the corresponding SELinux mac_admin permission is also granted
to the domain by policy.  In Fedora policies, this is only allowed for
specific domains such as livecd for setting down security contexts
that are not defined in the build host policy.

[On Android, this can only be set by root/CAP_MAC_ADMIN processes,
and if running SELinux in enforcing mode, only if mac_admin permission
is granted in policy.  In Android 4.4, this would only be allowed for
root/CAP_MAC_ADMIN processes that are also in unconfined domains. In current
AOSP master, mac_admin is not allowed for any domains except the recovery
console which has a legitimate need for it.  The other potential vector
is mounting a maliciously crafted filesystem for which SELinux fetches
xattrs (e.g. an ext4 filesystem on a SDcard).  However, the end result is
only a local denial-of-service (DOS) due to kernel BUG.  This fix is
queued for 3.14.]

Reproducer:
su
setenforce 0
touch foo
setfattr -n security.selinux foo

Caveat:
Relabeling or removing foo after doing the above may not be possible
without booting with SELinux disabled.  Any subsequent access to foo
after doing the above will also trigger the BUG.

BUG output from Matthew Thode:
[  473.893141] ------------[ cut here ]------------
[  473.962110] kernel BUG at security/selinux/ss/services.c:654!
[  473.995314] invalid opcode: 0000 [linux-sunxi#6] SMP
[  474.027196] Modules linked in:
[  474.058118] CPU: 0 PID: 8138 Comm: ls Tainted: G      D   I
3.13.0-grsec #1
[  474.116637] Hardware name: Supermicro X8ST3/X8ST3, BIOS 2.0
07/29/10
[  474.149768] task: ffff8805f50cd010 ti: ffff8805f50cd488 task.ti:
ffff8805f50cd488
[  474.183707] RIP: 0010:[<ffffffff814681c7>]  [<ffffffff814681c7>]
context_struct_compute_av+0xce/0x308
[  474.219954] RSP: 0018:ffff8805c0ac3c38  EFLAGS: 00010246
[  474.252253] RAX: 0000000000000000 RBX: ffff8805c0ac3d94 RCX:
0000000000000100
[  474.287018] RDX: ffff8805e8aac000 RSI: 00000000ffffffff RDI:
ffff8805e8aaa000
[  474.321199] RBP: ffff8805c0ac3cb8 R08: 0000000000000010 R09:
0000000000000006
[  474.357446] R10: 0000000000000000 R11: ffff8805c567a000 R12:
0000000000000006
[  474.419191] R13: ffff8805c2b74e88 R14: 00000000000001da R15:
0000000000000000
[  474.453816] FS:  00007f2e75220800(0000) GS:ffff88061fc00000(0000)
knlGS:0000000000000000
[  474.489254] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  474.522215] CR2: 00007f2e74716090 CR3: 00000005c085e000 CR4:
00000000000207f0
[  474.556058] Stack:
[  474.584325]  ffff8805c0ac3c98 ffffffff811b549b ffff8805c0ac3c98
ffff8805f1190a40
[  474.618913]  ffff8805a6202f08 ffff8805c2b74e88 00068800d0464990
ffff8805e8aac860
[  474.653955]  ffff8805c0ac3cb8 000700068113833a ffff880606c75060
ffff8805c0ac3d94
[  474.690461] Call Trace:
[  474.723779]  [<ffffffff811b549b>] ? lookup_fast+0x1cd/0x22a
[  474.778049]  [<ffffffff81468824>] security_compute_av+0xf4/0x20b
[  474.811398]  [<ffffffff8196f419>] avc_compute_av+0x2a/0x179
[  474.843813]  [<ffffffff8145727b>] avc_has_perm+0x45/0xf4
[  474.875694]  [<ffffffff81457d0e>] inode_has_perm+0x2a/0x31
[  474.907370]  [<ffffffff81457e76>] selinux_inode_getattr+0x3c/0x3e
[  474.938726]  [<ffffffff81455cf6>] security_inode_getattr+0x1b/0x22
[  474.970036]  [<ffffffff811b057d>] vfs_getattr+0x19/0x2d
[  475.000618]  [<ffffffff811b05e5>] vfs_fstatat+0x54/0x91
[  475.030402]  [<ffffffff811b063b>] vfs_lstat+0x19/0x1b
[  475.061097]  [<ffffffff811b077e>] SyS_newlstat+0x15/0x30
[  475.094595]  [<ffffffff8113c5c1>] ? __audit_syscall_entry+0xa1/0xc3
[  475.148405]  [<ffffffff8197791e>] system_call_fastpath+0x16/0x1b
[  475.179201] Code: 00 48 85 c0 48 89 45 b8 75 02 0f 0b 48 8b 45 a0 48
8b 3d 45 d0 b6 00 8b 40 08 89 c6 ff ce e8 d1 b0 06 00 48 85 c0 49 89 c7
75 02 <0f> 0b 48 8b 45 b8 4c 8b 28 eb 1e 49 8d 7d 08 be 80 01 00 00 e8
[  475.255884] RIP  [<ffffffff814681c7>]
context_struct_compute_av+0xce/0x308
[  475.296120]  RSP <ffff8805c0ac3c38>
[  475.328734] ---[ end trace f076482e9d754adc ]---

[sds:  commit message edited to note Android implications and
to generate a unique Change-Id for gerrit]

Change-Id: I4d5389f0cfa72b5f59dada45081fa47e03805413
Reported-by:  Matthew Thode <[email protected]>
Signed-off-by: Stephen Smalley <[email protected]>
Cc: [email protected]
Signed-off-by: Paul Moore <[email protected]>
michalliu pushed a commit that referenced this issue Feb 17, 2014
If we try to repeatedly load and unload the sunxi cedar module, we get
the following problem on the second round:

[   29.470000] [cedar dev]: install start!!!
[   29.470000] Unable to handle kernel paging request at virtual address bf0b138c
[   29.480000] pgd = df060000
[   29.480000] [bf0b138c] *pgd=5e69c811, *pte=00000000, *ppte=00000000
[   29.480000] Internal error: Oops: 7 [#1] PREEMPT ARM

Adding the missing del_timer() and platform_device_unregister() calls
to cedarv_exit() resolves this.

Signed-off-by: Siarhei Siamashka <[email protected]>
michalliu pushed a commit that referenced this issue Feb 17, 2014
commit ee1e5e7eda9d875967cd668acd8e24c68b4266ba
Merge: 2bbc8e6 2aee149
Author: Siarhei Siamashka <[email protected]>
Date:   Wed Dec 25 03:22:16 2013 +0200

    Merge branch 'v3.4.46-ltsi-cma' into stage/sunxi-3.4

    This is a merge of CMA patches from LTSI:
        http://ltsi.linuxfoundation.org/releases/ltsi-tree/3.4.46-ltsi/stable-release

    Conflicts:
    	arch/arm/mm/mmu.c
    	drivers/base/Kconfig
    	mm/page_alloc.c

commit 2aee14906cf931ca542fff2157107d1a7621f20c
Author: Sachin Kamat <[email protected]>
Date:   Mon Oct 29 16:51:15 2012 +0900

    ARM: dma-mapping: Fix potential memory leak in atomic_pool_init()

    When either of __alloc_from_contiguous or __alloc_remap_buffer fails
    to provide a valid pointer, allocated memory is freed up and an error
    is returned. 'pages' was however not freed before returning error.

    Cc: Arnd Bergmann <[email protected]>
    Cc: Marek Szyprowski <[email protected]>
    Signed-off-by: Sachin Kamat <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit ec10665cbf271fb1f60daeb194ad4f2cdcdc59d9)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit e7086478542d07eda0017258eb5137a050f15b08
Author: Hiroshi Doyu <[email protected]>
Date:   Mon Oct 29 16:51:14 2012 +0900

    ARM: dma-mapping: atomic_pool with struct page **pages

    struct page **pages is necessary to align with non atomic path in
    __iommu_get_pages(). atomic_pool() has the intialized **pages instead
    of just *page.

    Signed-off-by: Hiroshi Doyu <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 6b3fe47264262fa082897ebe8ae01041eae65e14)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit e4a9d193c2501ecc66307eae49e2f8826556e712
Author: Thomas Petazzoni <[email protected]>
Date:   Mon Oct 29 16:51:13 2012 +0900

    arm: mm: fix DMA pool affiliation check

    The __free_from_pool() function was changed in
    e9da6e9905e639b0f842a244bc770b48ad0523e9. Unfortunately, the test that
    checks whether the provided (start,size) is within the DMA pool has
    been improperly modified. It used to be:

      if (start < coherent_head.vm_start || end > coherent_head.vm_end)

    Where coherent_head.vm_end was non-inclusive (i.e, it did not include
    the first byte after the pool). The test has been changed to:

      if (start < pool->vaddr || start > pool->vaddr + pool->size)

    So now pool->vaddr + pool->size is inclusive (i.e, it includes the
    first byte after the pool), so the test should be >= instead of >.

    This bug causes the following message when freeing the *first* DMA
    coherent buffer that has been allocated, because its virtual address
    is exactly equal to pool->vaddr + pool->size :

    WARNING: at /home/thomas/projets/linux-2.6/arch/arm/mm/dma-mapping.c:463 __free_from_pool+0xa4/0xc0()
    freeing wrong coherent size from pool

    Signed-off-by: Thomas Petazzoni <[email protected]>
    Cc: Marek Szyprowski <[email protected]>
    Cc: Russell King <[email protected]>
    Cc: Lior Amsalem <[email protected]>
    Cc: Maen Suleiman <[email protected]>
    Cc: Tawfik Bayouk <[email protected]>
    Cc: Shadi Ammouri <[email protected]>
    Cc: Eran Ben-Avi <[email protected]>
    Cc: Yehuda Yitschak <[email protected]>
    Cc: Nadav Haklai <[email protected]>
    [m.szyprowski: rebased onto v3.6-rc5 and resolved conflict]
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit f3d87524975f01b885fc3d009c6ab6afd0d00746)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit 00d276cb10360235df524a3573ccf09b8810dbc1
Author: Hiroshi Doyu <[email protected]>
Date:   Mon Oct 29 16:51:12 2012 +0900

    ARM: dma-mapping: Refactor out to introduce __in_atomic_pool

    Check the given range("start", "size") is included in "atomic_pool" or not.

    Signed-off-by: Hiroshi Doyu <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 21d0a75951ccf71f671eb24b61a8ad2b497be4b4)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit 9c0f200b6f590fc4d998bc224714ed21d73b68c3
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:51:11 2012 +0900

    ARM: DMA-Mapping: print warning when atomic coherent allocation fails

    Print a loud warning when system runs out of memory from atomic DMA
    coherent pool to let users notice the potential problem.

    Reported-by: Aaro Koskinen <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit fb71285f0c1633a85544784aae7577502274b77a)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit 6aa629fe5cec4b2bf7735c7340e7c3ae11083b02
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:51:10 2012 +0900

    ARM: DMA-Mapping: add function for setting coherent pool size from platform code

    Some platforms might require to increase atomic coherent pool to make
    sure that their device will be able to allocate all their buffers from
    atomic context. This function can be also used to decrease atomic
    coherent pool size if coherent allocations are not used for the given
    sub-platform.

    Suggested-by: Josh Coombs <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 6e5267aa543817015edb4a65c66e15f9809f92bd)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit c3389701658cbc49db34efb345dc3361cf09e0b3
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:51:09 2012 +0900

    mm: cma: fix alignment requirements for contiguous regions

    Contiguous Memory Allocator requires each of its regions to be aligned
    in such a way that it is possible to change migration type for all
    pageblocks holding it and then isolate page of largest possible order from
    the buddy allocator (which is MAX_ORDER-1). This patch relaxes alignment
    requirements by one order, because MAX_ORDER alignment is not really
    needed.

    Signed-off-by: Marek Szyprowski <[email protected]>
    CC: Michal Nazarewicz <[email protected]>
    Acked-by: Michal Nazarewicz <[email protected]>
    (cherry picked from commit 7ce9bf1f4785dab0598a19a7fcb0733a18193e4e)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit 82fe63726f86dede0037e5c2d188930128ede637
Author: Aaro Koskinen <[email protected]>
Date:   Mon Oct 29 16:51:08 2012 +0900

    ARM: dma-mapping: fix incorrect freeing of atomic allocations

    Commit e9da6e9905e639b0f842a244bc770b48ad0523e9 (ARM: dma-mapping:
    remove custom consistent dma region) changed the way atomic allocations
    are handled. However, arm_dma_free() was not modified accordingly, and
    as a result freeing of atomic allocations does not work correctly when
    CMA is disabled. Memory is leaked and following WARNINGs are seen:

    [   57.698911] ------------[ cut here ]------------
    [   57.753518] WARNING: at arch/arm/mm/dma-mapping.c:263 arm_dma_free+0x88/0xe4()
    [   57.811473] trying to free invalid coherent area: e0848000
    [   57.867398] Modules linked in: sata_mv(-)
    [   57.921373] [<c000d270>] (unwind_backtrace+0x0/0xf0) from [<c0015430>] (warn_slowpath_common+0x50/0x68)
    [   58.033924] [<c0015430>] (warn_slowpath_common+0x50/0x68) from [<c00154dc>] (warn_slowpath_fmt+0x30/0x40)
    [   58.152024] [<c00154dc>] (warn_slowpath_fmt+0x30/0x40) from [<c000dc18>] (arm_dma_free+0x88/0xe4)
    [   58.219592] [<c000dc18>] (arm_dma_free+0x88/0xe4) from [<c008fa30>] (dma_pool_destroy+0x100/0x148)
    [   58.345526] [<c008fa30>] (dma_pool_destroy+0x100/0x148) from [<c019a64c>] (release_nodes+0x144/0x218)
    [   58.475782] [<c019a64c>] (release_nodes+0x144/0x218) from [<c0197e10>] (__device_release_driver+0x60/0xb8)
    [   58.614260] [<c0197e10>] (__device_release_driver+0x60/0xb8) from [<c0198608>] (driver_detach+0xd8/0xec)
    [   58.756527] [<c0198608>] (driver_detach+0xd8/0xec) from [<c0197c54>] (bus_remove_driver+0x7c/0xc4)
    [   58.901648] [<c0197c54>] (bus_remove_driver+0x7c/0xc4) from [<c004bfac>] (sys_delete_module+0x19c/0x220)
    [   59.051447] [<c004bfac>] (sys_delete_module+0x19c/0x220) from [<c0009140>] (ret_fast_syscall+0x0/0x2c)
    [   59.207996] ---[ end trace 0745420412c0325a ]---
    [   59.287110] ------------[ cut here ]------------
    [   59.366324] WARNING: at arch/arm/mm/dma-mapping.c:263 arm_dma_free+0x88/0xe4()
    [   59.450511] trying to free invalid coherent area: e0847000
    [   59.534357] Modules linked in: sata_mv(-)
    [   59.616785] [<c000d270>] (unwind_backtrace+0x0/0xf0) from [<c0015430>] (warn_slowpath_common+0x50/0x68)
    [   59.790030] [<c0015430>] (warn_slowpath_common+0x50/0x68) from [<c00154dc>] (warn_slowpath_fmt+0x30/0x40)
    [   59.972322] [<c00154dc>] (warn_slowpath_fmt+0x30/0x40) from [<c000dc18>] (arm_dma_free+0x88/0xe4)
    [   60.070701] [<c000dc18>] (arm_dma_free+0x88/0xe4) from [<c008fa30>] (dma_pool_destroy+0x100/0x148)
    [   60.256817] [<c008fa30>] (dma_pool_destroy+0x100/0x148) from [<c019a64c>] (release_nodes+0x144/0x218)
    [   60.445201] [<c019a64c>] (release_nodes+0x144/0x218) from [<c0197e10>] (__device_release_driver+0x60/0xb8)
    [   60.634148] [<c0197e10>] (__device_release_driver+0x60/0xb8) from [<c0198608>] (driver_detach+0xd8/0xec)
    [   60.823623] [<c0198608>] (driver_detach+0xd8/0xec) from [<c0197c54>] (bus_remove_driver+0x7c/0xc4)
    [   61.013268] [<c0197c54>] (bus_remove_driver+0x7c/0xc4) from [<c004bfac>] (sys_delete_module+0x19c/0x220)
    [   61.203472] [<c004bfac>] (sys_delete_module+0x19c/0x220) from [<c0009140>] (ret_fast_syscall+0x0/0x2c)
    [   61.393390] ---[ end trace 0745420412c0325b ]---

    The patch fixes this.

    Signed-off-by: Aaro Koskinen <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit d9e0d149b5dcc2ef4688afc572b9906bcda941ef)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit bb2718c695c0aa15cd0fd9a4847ff67937cd4c56
Author: Aaro Koskinen <[email protected]>
Date:   Mon Oct 29 16:51:07 2012 +0900

    ARM: dma-mapping: fix atomic allocation alignment

    The alignment mask is calculated incorrectly. Fixing the calculation
    makes strange hangs/lockups disappear during the boot with Amstrad E3
    and 3.6-rc1 kernel.

    Signed-off-by: Aaro Koskinen <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit e4ea6918c93b9f59d34e8ca2124b2b64b1afe73b)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit 57861a305627c98801780014e4f7782dee3c5714
Author: Russell King <[email protected]>
Date:   Mon Oct 29 16:51:06 2012 +0900

    ARM: fix warning caused by wrongly typed arm_dma_limit

    arch/arm/mm/init.c: In function 'arm_memblock_init':
    arch/arm/mm/init.c:380: warning: comparison of distinct pointer types lacks a cast

    by fixing the typecast in its definition when DMA_ZONE is disabled.
    This was missed in 4986e5c7c (ARM: mm: fix type of the arm_dma_limit
    global variable).

    Signed-off-by: Russell King <[email protected]>
    (cherry picked from commit 09b2ad13da3ac7c717dd86bfca7072d9b36f7449)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit e7fc0512ee0dc45d8df8a59f5a9b54169596db7f
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:51:05 2012 +0900

    ARM: dma-mapping: fix buffer chunk allocation order

    IOMMU-aware dma_alloc_attrs() implementation allocates buffers in
    power-of-two chunks to improve performance and take advantage of large
    page mappings provided by some IOMMU hardware. However current code, due
    to a subtle bug, allocated those chunks in the smallest-to-largest
    order, what completely killed all the advantages of using larger than
    page chunks. If a 4KiB chunk has been mapped as a first chunk, the
    consecutive chunks are not aligned correctly to the power-of-two which
    match their size and IOMMU drivers were not able to use internal
    mappings of size other than the 4KiB (largest common denominator of
    alignment and chunk size).

    This patch fixes this issue by changing to the correct largest-to-smallest
    chunk size allocation sequence.

    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 593f47355467b9ef44293698817e2bdb347e2d11)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit ec7459b02995094ef0d01037b80b0ba7c9fbb7c6
Author: Randy Dunlap <[email protected]>
Date:   Mon Oct 29 16:51:04 2012 +0900

    driver core: fix some kernel-doc warnings in dma*.c

    Fix kernel-doc warnings in drivers/base/dma*.c:

    Warning(drivers/base/dma-buf.c:498): No description found for parameter 'vaddr'
    Warning(drivers/base/dma-coherent.c:199): No description found for parameter 'ret'

    Signed-off-by: Randy Dunlap <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    (cherry picked from commit 6e7b4a59b3d7bb2dcd11c019354bf0c91037dadd)

    Conflicts:

    	drivers/base/dma-buf.c

    Backported patch only addresses dma-coherent.c warning, as dma-buf.c warning is
    not present in 3.4 kernel.

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit 4f02add73d3ec9e814cc53b10fea42513ab71f22
Author: Minchan Kim <[email protected]>
Date:   Mon Oct 29 16:51:03 2012 +0900

    mm: factor out memory isolate functions

    mm/page_alloc.c has some memory isolation functions but they are used only
    when we enable CONFIG_{CMA|MEMORY_HOTPLUG|MEMORY_FAILURE}.  So let's make
    it configurable by new CONFIG_MEMORY_ISOLATION so that it can reduce
    binary size and we can check it simple by CONFIG_MEMORY_ISOLATION, not if
    defined CONFIG_{CMA|MEMORY_HOTPLUG|MEMORY_FAILURE}.

    Signed-off-by: Minchan Kim <[email protected]>
    Cc: Andi Kleen <[email protected]>
    Cc: Marek Szyprowski <[email protected]>
    Acked-by: KAMEZAWA Hiroyuki <[email protected]>
    Cc: KOSAKI Motohiro <[email protected]>
    Cc: Mel Gorman <[email protected]>
    Cc: Michal Hocko <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    (cherry picked from commit ee6f509c3274014d1f52e7a7a10aee9f85393c5e)

    Conflicts:

    	mm/Makefile

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit 63d767819e6fcf472f9535d1b4628913ddcc5d64
Author: Minchan Kim <[email protected]>
Date:   Mon Oct 29 16:51:02 2012 +0900

    mm: clean up __count_immobile_pages()

    The __count_immobile_pages() naming is rather awkward.  Choose a more
    clear name and add a comment.

    Signed-off-by: Minchan Kim <[email protected]>
    Cc: Andrea Arcangeli <[email protected]>
    Cc: Mel Gorman <[email protected]>
    Cc: Michal Hocko <[email protected]>
    Acked-by: KAMEZAWA Hiroyuki <[email protected]>
    Cc: Bartlomiej Zolnierkiewicz <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    (cherry picked from commit 80934513b230bfcf70265f2ef0fdae89fb391633)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit 21086e13604d5a72a8cd75a6062b55762317b748
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:51:01 2012 +0900

    common: dma-mapping: add support for generic dma_mmap_* calls

    Commit 9adc5374 ('common: dma-mapping: introduce mmap method') added a
    generic method for implementing mmap user call to dma_map_ops structure.

    This patch converts ARM and PowerPC architectures (the only providers of
    dma_mmap_coherent/dma_mmap_writecombine calls) to use this generic
    dma_map_ops based call and adds a generic cross architecture
    definition for dma_mmap_attrs, dma_mmap_coherent, dma_mmap_writecombine
    functions.

    The generic mmap virt_to_page-based fallback implementation is provided for
    architectures which don't provide their own implementation for mmap method.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Reviewed-by: Kyungmin Park <[email protected]>
    (cherry picked from commit 64ccc9c033c6089b2d426dad3c56477ab066c999)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit e6877b7aaa30541e2f2601032f48c8216076eac6
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:51:00 2012 +0900

    ARM: dma-mapping: fix error path for memory allocation failure

    This patch fixes incorrect check in error path. When the allocation of
    first page fails, the kernel ops appears due to accessing -1 element of
    the pages array.

    Reported-by: Sylwester Nawrocki <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 9fa8af91f0679f2abbebe1382b937264f3a8b981)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit e49dcb5b0ae74c85aca81d33aad8f3b8e8bcdad1
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:59 2012 +0900

    ARM: dma-mapping: add more sanity checks in arm_dma_mmap()

    Add some sanity checks and forbid mmaping of buffers into vma areas larger
    than allocated dma buffer.

    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 50262a4bf38dd70486e9fce2b8235d5ae3e0f627)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit a683c6762033c9c40292fc00813e8f51d0630945
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:58 2012 +0900

    ARM: dma-mapping: remove custom consistent dma region

    This patch changes dma-mapping subsystem to use generic vmalloc areas
    for all consistent dma allocations. This increases the total size limit
    of the consistent allocations and removes platform hacks and a lot of
    duplicated code.

    Atomic allocations are served from special pool preallocated on boot,
    because vmalloc areas cannot be reliably created in atomic context.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Reviewed-by: Kyungmin Park <[email protected]>
    Reviewed-by: Minchan Kim <[email protected]>
    (cherry picked from commit e9da6e9905e639b0f842a244bc770b48ad0523e9)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit 8a7d1dd986d8a25885b8d50b53f1c71d2d6130b3
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:57 2012 +0900

    mm: vmalloc: use const void * for caller argument

    'const void *' is a safer type for caller function type. This patch
    updates all references to caller function type.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Reviewed-by: Kyungmin Park <[email protected]>
    Reviewed-by: Minchan Kim <[email protected]>
    (cherry picked from commit 5e6cafc83e30f0f70c79a2b7aef237dc57e29f02)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>

commit f056881b91c8b256cc9d2e16b99ba520782ec0bc
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:56 2012 +0900

    ARM: relax conditions required for enabling Contiguous Memory Allocator

    Contiguous Memory Allocator requires only paging and MMU enabled not
    particular CPU architectures, so there is no need for strict dependency
    on CPU type. This enables to use CMA on some older ARM v5 systems which
    also might need large contiguous blocks for the multimedia processing hw
    modules.

    Reported-by: Prabhakar Lad <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Tested-by: Prabhakar Lad <[email protected]>
    (cherry picked from commit e092705bcd53de3bafc3053b0b55bf83e5d6711f)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 65ffaed254e6c2d6d37a99313b06b3dcdc8de611
Author: Chris Brand <[email protected]>
Date:   Mon Oct 29 16:50:55 2012 +0900

    ARM: mm: fix MMU mapping of CMA regions

    Fix dma_contiguous_remap() so that it continues through all the
    regions, even after encountering one that is outside lowmem.
    Without this change, if you have two CMA regions, the first outside
    lowmem and the seocnd inside lowmem, only the second one will get
    set up in the MMU. Data written to that region then doesn't get
    automatically flushed from the cache into memory.

    Signed-off-by: Chris Brand <[email protected]>
    [extended patch subject with 'fix' word]
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 39f78e70567a07a6fc0d7a4ca9e3331e44dd400d)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 0399c3b81c049913debe2bef12b53b961a6e46a9
Author: Prathyush K <[email protected]>
Date:   Mon Oct 29 16:50:54 2012 +0900

    ARM: dma-mapping: modify condition check while freeing pages

    WARNING: at mm/vmalloc.c:1471 __iommu_free_buffer+0xcc/0xd0()
    Trying to vfree() nonexistent vm area (ef095000)
    Modules linked in:
    [<c0015a18>] (unwind_backtrace+0x0/0xfc) from [<c0025a94>] (warn_slowpath_common+0x54/0x64)
    [<c0025a94>] (warn_slowpath_common+0x54/0x64) from [<c0025b38>] (warn_slowpath_fmt+0x30/0x40)
    [<c0025b38>] (warn_slowpath_fmt+0x30/0x40) from [<c0016de0>] (__iommu_free_buffer+0xcc/0xd0)
    [<c0016de0>] (__iommu_free_buffer+0xcc/0xd0) from [<c0229a5c>] (exynos_drm_free_buf+0xe4/0x138)
    [<c0229a5c>] (exynos_drm_free_buf+0xe4/0x138) from [<c022b358>] (exynos_drm_gem_destroy+0x80/0xfc)
    [<c022b358>] (exynos_drm_gem_destroy+0x80/0xfc) from [<c0211230>] (drm_gem_object_free+0x28/0x34)
    [<c0211230>] (drm_gem_object_free+0x28/0x34) from [<c0211bd0>] (drm_gem_object_release_handle+0xcc/0xd8)
    [<c0211bd0>] (drm_gem_object_release_handle+0xcc/0xd8) from [<c01abe10>] (idr_for_each+0x74/0xb8)
    [<c01abe10>] (idr_for_each+0x74/0xb8) from [<c02114e4>] (drm_gem_release+0x1c/0x30)
    [<c02114e4>] (drm_gem_release+0x1c/0x30) from [<c0210ae8>] (drm_release+0x608/0x694)
    [<c0210ae8>] (drm_release+0x608/0x694) from [<c00b75a0>] (fput+0xb8/0x228)
    [<c00b75a0>] (fput+0xb8/0x228) from [<c00b40c4>] (filp_close+0x64/0x84)
    [<c00b40c4>] (filp_close+0x64/0x84) from [<c0029d54>] (put_files_struct+0xe8/0x104)
    [<c0029d54>] (put_files_struct+0xe8/0x104) from [<c002b930>] (do_exit+0x608/0x774)
    [<c002b930>] (do_exit+0x608/0x774) from [<c002bae4>] (do_group_exit+0x48/0xb4)
    [<c002bae4>] (do_group_exit+0x48/0xb4) from [<c002bb60>] (sys_exit_group+0x10/0x18)
    [<c002bb60>] (sys_exit_group+0x10/0x18) from [<c000ee80>] (ret_fast_syscall+0x0/0x30)

    This patch modifies the condition while freeing to match the condition
    used while allocation. This fixes the above warning which arises when
    array size is equal to PAGE_SIZE where allocation is done using kzalloc
    but free is done using vfree.

    Signed-off-by: Prathyush K <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 46c87852e99cf8ce97e207b11cde19085837e39c)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit e26a2e078e5483a54b9531868c1d18177b6382b8
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:53 2012 +0900

    mm: cma: fix condition check when setting global cma area

    dev_set_cma_area incorrectly assigned cma to global area on first call
    due to incorrect check. This patch fixes this issue.

    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit cc2caea5b6152b8ce66dc2bbe83dc72b60612da8)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 037af057ec4b8dc147ecce464e6cbb3be92510fd
Author: Rabin Vincent <[email protected]>
Date:   Mon Oct 29 16:50:52 2012 +0900

    mm: cma: don't replace lowmem pages with highmem

    The filesystem layer expects pages in the block device's mapping to not
    be in highmem (the mapping's gfp mask is set in bdget()), but CMA can
    currently replace lowmem pages with highmem pages, leading to crashes in
    filesystem code such as the one below:

      Unable to handle kernel NULL pointer dereference at virtual address 00000400
      pgd = c0c98000
      [00000400] *pgd=00c91831, *pte=00000000, *ppte=00000000
      Internal error: Oops: 817 [#1] PREEMPT SMP ARM
      CPU: 0    Not tainted  (3.5.0-rc5+ #80)
      PC is at __memzero+0x24/0x80
      ...
      Process fsstress (pid: 323, stack limit = 0xc0cbc2f0)
      Backtrace:
      [<c010e3f0>] (ext4_getblk+0x0/0x180) from [<c010e58c>] (ext4_bread+0x1c/0x98)
      [<c010e570>] (ext4_bread+0x0/0x98) from [<c0117944>] (ext4_mkdir+0x160/0x3bc)
       r4:c15337f0
      [<c01177e4>] (ext4_mkdir+0x0/0x3bc) from [<c00c29e0>] (vfs_mkdir+0x8c/0x98)
      [<c00c2954>] (vfs_mkdir+0x0/0x98) from [<c00c2a60>] (sys_mkdirat+0x74/0xac)
       r6:00000000 r5:c152eb40 r4:000001ff r3:c14b43f0
      [<c00c29ec>] (sys_mkdirat+0x0/0xac) from [<c00c2ab8>] (sys_mkdir+0x20/0x24)
       r6:beccdcf0 r5:00074000 r4:beccdbbc
      [<c00c2a98>] (sys_mkdir+0x0/0x24) from [<c000e3c0>] (ret_fast_syscall+0x0/0x30)

    Fix this by replacing only highmem pages with highmem.

    Reported-by: Laura Abbott <[email protected]>
    Signed-off-by: Rabin Vincent <[email protected]>
    Acked-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 6a6dccba2fdc2a69f1f36b8f1c0acc8598e7221b)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 56792e85bc2f8c14c4f64f46fde3afb4fd10cd61
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:51 2012 +0900

    x86: dma-mapping: fix broken allocation when dma_mask has been provided

    Commit 0a2b9a6ea93 ("X86: integrate CMA with DMA-mapping subsystem")
    broke memory allocation with dma_mask. This patch fixes possible kernel
    ops caused by lack of resetting page variable when jumping to 'again' label.

    Reported-by: Konrad Rzeszutek Wilk <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Michal Nazarewicz <[email protected]>
    (cherry picked from commit c080e26edc3a2a3cdfa4c430c663ee1c3bbd8fae)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 136dac72225ac4399522b8a42b29bb39c2e94b97
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:50 2012 +0900

    ARM: dma-mapping: fix debug messages in dmabounce code

    This patch fixes the usage of uninitialized variables in dmabounce code
    intoduced by commit a227fb92 ('ARM: dma-mapping: remove offset parameter
    to prepare for generic dma_ops'):
    arch/arm/common/dmabounce.c: In function ‘dmabounce_sync_for_device’:
    arch/arm/common/dmabounce.c:409: warning: ‘off’ may be used uninitialized in this function
    arch/arm/common/dmabounce.c:407: note: ‘off’ was declared here
    arch/arm/common/dmabounce.c: In function ‘dmabounce_sync_for_cpu’:
    arch/arm/common/dmabounce.c:369: warning: ‘off’ may be used uninitialized in this function
    arch/arm/common/dmabounce.c:367: note: ‘off’ was declared here

    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit fdb1117325ad719dc39e81209bc622d511db70e0)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 825d00daacd8c2ee76e297c9ce0dfc17d8a2bb85
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:49 2012 +0900

    ARM: mm: fix type of the arm_dma_limit global variable

    arm_dma_limit stores physical address of maximal address accessible by DMA,
    so the phys_addr_t type makes much more sense for it instead of u32. This
    patch fixes the following build warning:

    arch/arm/mm/init.c:380: warning: comparison of distinct pointer types lacks a cast

    Reported-by: Russell King <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 4986e5c7cd91817d0f58dd15073c9080d47980cf)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 5d6075133b365ae6a34dba6c0a108445d99e4a3c
Author: Sachin Kamat <[email protected]>
Date:   Mon Oct 29 16:50:48 2012 +0900

    ARM: dma-mapping: Add missing static storage class specifier

    Fixes the following sparse warnings:
    arch/arm/mm/dma-mapping.c:231:15: warning: symbol 'consistent_base' was not
    declared. Should it be static?
    arch/arm/mm/dma-mapping.c:326:8: warning: symbol 'coherent_pool_size' was not
    declared. Should it be static?

    Signed-off-by: Sachin Kamat <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit e53f517ff236a0ec5413ff3935c53406b69bc1e2)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit b53b5181a0d2683f2f5de207136410e785eff85c
Author: Ohad Ben-Cohen <[email protected]>
Date:   Mon Oct 29 16:50:47 2012 +0900

    iommu/core: pass a user-provided token to fault handlers

    Sometimes a single IOMMU user may have to deal with several
    different IOMMU devices (e.g. remoteproc).

    When an IOMMU fault happens, such users have to regain their
    context in order to deal with the fault.

    Users can't use the private fields of neither the iommu_domain nor
    the IOMMU device, because those are already used by the IOMMU core
    and low level driver (respectively).

    This patch just simply allows users to pass a private token (most
    notably their own context pointer) to iommu_set_fault_handler(),
    and then makes sure it is provided back to the users whenever
    an IOMMU fault happens.

    The patch also adopts remoteproc to the new fault handling
    interface, but the real functionality using this (recovery of
    remote processors) will only be added later in a subsequent patch
    set.

    Cc: Fernando Guzman Lugo <[email protected]>
    Signed-off-by: Ohad Ben-Cohen <[email protected]>
    Signed-off-by: Joerg Roedel <[email protected]>
    (cherry picked from commit 77ca23323594589ac8cba1c8d59bfe7e85d3cb8b)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 95f907b4158975160624b86ea7575298148c51db
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:46 2012 +0900

    ARM: dma-mapping: remove unconditional dependency on CMA

    CMA has been enabled unconditionally on all ARMv6+ systems to solve the
    long standing issue of double kernel mappings for all dma coherent
    buffers. This however created a dependency on CONFIG_EXPERIMENTAL for
    the whole ARM architecture what should be really avoided. This patch
    removes this dependency and lets one use old, well-tested dma-mapping
    implementation also on ARMv6+ systems without the need to use
    EXPERIMENTAL stuff.

    Reported-by: Russell King <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit f1ae98da8525c6b8b1c301c3a2b0bd2b6515cca2)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 53195e721e0e6106325417acd91d274095d210b1
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:45 2012 +0900

    ARM: dma-mapping: add support for IOMMU mapper

    This patch add a complete implementation of DMA-mapping API for
    devices which have IOMMU support.

    This implementation tries to optimize dma address space usage by remapping
    all possible physical memory chunks into a single dma address space chunk.

    DMA address space is managed on top of the bitmap stored in the
    dma_iommu_mapping structure stored in device->archdata. Platform setup
    code has to initialize parameters of the dma address space (base address,
    size, allocation precision order) with arm_iommu_create_mapping() function.
    To reduce the size of the bitmap, all allocations are aligned to the
    specified order of base 4 KiB pages.

    dma_alloc_* functions allocate physical memory in chunks, each with
    alloc_pages() function to avoid failing if the physical memory gets
    fragmented. In worst case the allocated buffer is composed of 4 KiB page
    chunks.

    dma_map_sg() function minimizes the total number of dma address space
    chunks by merging of physical memory chunks into one larger dma address
    space chunk. If requested chunk (scatter list entry) boundaries
    match physical page boundaries, most calls to dma_map_sg() requests will
    result in creating only one chunk in dma address space.

    dma_map_page() simply creates a mapping for the given page(s) in the dma
    address space.

    All dma functions also perform required cache operation like their
    counterparts from the arm linear physical memory mapping version.

    This patch contains code and fixes kindly provided by:
    - Krishna Reddy <[email protected]>,
    - Andrzej Pietrasiewicz <[email protected]>,
    - Hiroshi DOYU <[email protected]>

    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Kyungmin Park <[email protected]>
    Reviewed-by: Konrad Rzeszutek Wilk <[email protected]>
    Tested-By: Subash Patel <[email protected]>
    (cherry picked from commit 4ce63fcd919c32d22528e54dcd89506962933719)

    Conflicts:

            arch/arm/mm/dma-mapping.c

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit dba04c0f43513f07d3d4e7f5869111e92e885c37
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:44 2012 +0900

    ARM: dma-mapping: use alloc, mmap, free from dma_ops

    This patch converts dma_alloc/free/mmap_{coherent,writecombine}
    functions to use generic alloc/free/mmap methods from dma_map_ops
    structure. A new DMA_ATTR_WRITE_COMBINE DMA attribute have been
    introduced to implement writecombine methods.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Kyungmin Park <[email protected]>
    Acked-by: Arnd Bergmann <[email protected]>
    Tested-By: Subash Patel <[email protected]>
    (cherry picked from commit f99d60341238fe73fc514129cd9ae4e44e1b2c47)

    Conflicts:

    	arch/arm/mm/dma-mapping.c

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 242efb8681142625d1776c0d2a8d257e98b10eee
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:43 2012 +0900

    ARM: dma-mapping: remove redundant code and do the cleanup

    This patch just performs a global cleanup in DMA mapping implementation
    for ARM architecture. Some of the tiny helper functions have been moved
    to the caller code, some have been merged together.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Kyungmin Park <[email protected]>
    Acked-by: Arnd Bergmann <[email protected]>
    Tested-By: Subash Patel <[email protected]>
    (cherry picked from commit 51fde3499b531d4cf278f4d2eaa6c45b2865b16b)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 099faed3a8826eb7d3b7adc795cdcc19b52e9c70
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:42 2012 +0900

    ARM: dma-mapping: move all dma bounce code to separate dma ops structure

    This patch removes dma bounce hooks from the common dma mapping
    implementation on ARM architecture and creates a separate set of
    dma_map_ops for dma bounce devices.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Kyungmin Park <[email protected]>
    Tested-By: Subash Patel <[email protected]>
    (cherry picked from commit 15237e1f505b3e5c2276f240b01cd2133e110cbc)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit ae47af4cf52b478f5e37d4aa4ed0bd7ff50f8a07
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:41 2012 +0900

    ARM: dma-mapping: implement dma sg methods on top of any generic dma ops

    This patch converts all dma_sg methods to be generic (independent of the
    current DMA mapping implementation for ARM architecture). All dma sg
    operations are now implemented on top of respective
    dma_map_page/dma_sync_single_for* operations from dma_map_ops structure.

    Before this patch there were custom methods for all scatter/gather
    related operations. They iterated over the whole scatter list and called
    cache related operations directly (which in turn checked if we use dma
    bounce code or not and called respective version). This patch changes
    them not to use such shortcut. Instead it provides similar loop over
    scatter list and calls methods from the device's dma_map_ops structure.
    This enables us to use device dependent implementations of cache related
    operations (direct linear or dma bounce) depending on the provided
    dma_map_ops structure.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Kyungmin Park <[email protected]>
    Tested-By: Subash Patel <[email protected]>
    (cherry picked from commit 2a550e73d3e5f040a3e8eb733c942ab352eafb36)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 3eda90191d76d3fe2cb2a09bb8ce03b686b61d38
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:40 2012 +0900

    ARM: dma-mapping: use asm-generic/dma-mapping-common.h

    This patch modifies dma-mapping implementation on ARM architecture to
    use common dma_map_ops structure and asm-generic/dma-mapping-common.h
    helpers.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Kyungmin Park <[email protected]>
    Tested-By: Subash Patel <[email protected]>
    (cherry picked from commit 2dc6a016bbedf18f18ad73997e5338307d6dbde9)

    Conflicts:

    	arch/arm/Kconfig

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 93bb1a72f475b0cd7422fcfd9a130210ab32a6a5
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:39 2012 +0900

    ARM: dma-mapping: remove offset parameter to prepare for generic dma_ops

    This patch removes the need for the offset parameter in dma bounce
    functions. This is required to let dma-mapping framework on ARM
    architecture to use common, generic dma_map_ops based dma-mapping
    helpers.

    Background and more detailed explaination:

    dma_*_range_* functions are available from the early days of the dma
    mapping api. They are the correct way of doing a partial syncs on the
    buffer (usually used by the network device drivers). This patch changes
    only the internal implementation of the dma bounce functions to let
    them tunnel through dma_map_ops structure. The driver api stays
    unchanged, so driver are obliged to call dma_*_range_* functions to
    keep code clean and easy to understand.

    The only drawback from this patch is reduced detection of the dma api
    abuse. Let us consider the following code:

    dma_addr = dma_map_single(dev, ptr, 64, DMA_TO_DEVICE);
    dma_sync_single_range_for_cpu(dev, dma_addr+16, 0, 32, DMA_TO_DEVICE);

    Without the patch such code fails, because dma bounce code is unable
    to find the bounce buffer for the given dma_address. After the patch
    the above sync call will be equivalent to:

    dma_sync_single_range_for_cpu(dev, dma_addr, 16, 32, DMA_TO_DEVICE);

    which succeeds.

    I don't consider this as a real problem, because DMA API abuse should be
    caught by debug_dma_* function family. This patch lets us to simplify
    the internal low-level implementation without chaning the driver visible
    API.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Kyungmin Park <[email protected]>
    Tested-By: Subash Patel <[email protected]>
    (cherry picked from commit a227fb92a0f5f0dd8282719386e9b3a29f0d16b2)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 79a80f4e467558717c6ac76302a31e0c69af738a
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:38 2012 +0900

    ARM: dma-mapping: introduce DMA_ERROR_CODE constant

    Replace all uses of ~0 with DMA_ERROR_CODE, what should make the code
    easier to read.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Kyungmin Park <[email protected]>
    Tested-By: Subash Patel <[email protected]>
    (cherry picked from commit 553ac78877242b6d8b591323731df304140d0f99)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit b8aca1f7638ae019015546e91b0a741200cd0236
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:37 2012 +0900

    ARM: dma-mapping: use pr_* instread of printk

    Replace all calls to printk with pr_* functions family.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Kyungmin Park <[email protected]>
    Acked-by: Arnd Bergmann <[email protected]>
    Tested-By: Subash Patel <[email protected]>
    (cherry picked from commit 6b6f770b573903f8a7d1cfab1fc662685653f413)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 6632fab348a3322f9324b41d0733272eb5d39f16
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:36 2012 +0900

    ARM: dma-mapping: use dma_mmap_from_coherent()

    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 47142f07eea32e9c108f548a4b06c28bec7df6e4)

    Conflicts:

    	arch/arm/mm/dma-mapping.c

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 67527009619d1015b075a53502cb184db483c655
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:35 2012 +0900

    common: add dma_mmap_from_coherent() function

    Add a common helper for dma-mapping core for mapping a coherent buffer
    to userspace.

    Reported-by: Subash Patel <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Kyungmin Park <[email protected]>
    Tested-By: Subash Patel <[email protected]>
    (cherry picked from commit bca0fa5f12a6744a2b2e53154af65a51402b3426)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 5428b0199de7881667896f6ef126c4887af4a2c3
Author: Vitaly Andrianov <[email protected]>
Date:   Mon Oct 29 16:50:34 2012 +0900

    ARM: dma-mapping: use PMD size for section unmap

    The dma_contiguous_remap() function clears existing section maps using
    the wrong size (PGDIR_SIZE instead of PMD_SIZE).  This is a bug which
    does not affect non-LPAE systems, where PGDIR_SIZE and PMD_SIZE are the same.
    On LPAE systems, however, this bug causes the kernel to hang at this point.

    This fix has been tested on both LPAE and non-LPAE kernel builds.

    Signed-off-by: Vitaly Andrianov <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 61f6c7a47a2f84b7ba4b65240ffe9247df772b06)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 0245439393f82996f3cf4b8271cb1939fd8df951
Author: Minchan Kim <[email protected]>
Date:   Mon Oct 29 16:50:33 2012 +0900

    cma: fix migration mode

    __alloc_contig_migrate_range calls migrate_pages with wrong argument
    for migrate_mode. Fix it.

    Cc: Marek Szyprowski <[email protected]>
    Signed-off-by: Minchan Kim <[email protected]>
    Acked-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    (cherry picked from commit 58f42fd54144346898e6dc6d6ae3acd4c591b42f)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit f3655d25bcd287bfb62a1b202b1019c321900335
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:32 2012 +0900

    ARM: integrate CMA with DMA-mapping subsystem

    This patch adds support for CMA to dma-mapping subsystem for ARM
    architecture. By default a global CMA area is used, but specific devices
    are allowed to have their private memory areas if required (they can be
    created with dma_declare_contiguous() function during board
    initialisation).

    Contiguous memory areas reserved for DMA are remapped with 2-level page
    tables on boot. Once a buffer is requested, a low memory kernel mapping
    is updated to to match requested memory access type.

    GFP_ATOMIC allocations are performed from special pool which is created
    early during boot. This way remapping page attributes is not needed on
    allocation time.

    CMA has been enabled unconditionally for ARMv6+ systems.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Signed-off-by: Kyungmin Park <[email protected]>
    CC: Michal Nazarewicz <[email protected]>
    Acked-by: Arnd Bergmann <[email protected]>
    Tested-by: Rob Clark <[email protected]>
    Tested-by: Ohad Ben-Cohen <[email protected]>
    Tested-by: Benjamin Gaignard <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit c79095092834a18ae74cfc08def1a5a101dc106c)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 0c66ce4969334b97079c4de068e7d2d812081681
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:31 2012 +0900

    X86: integrate CMA with DMA-mapping subsystem

    This patch adds support for CMA to dma-mapping subsystem for x86
    architecture that uses common pci-dma/pci-nommu implementation. This
    allows to test CMA on KVM/QEMU and a lot of common x86 boxes.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Signed-off-by: Kyungmin Park <[email protected]>
    CC: Michal Nazarewicz <[email protected]>
    Acked-by: Arnd Bergmann <[email protected]>
    (cherry picked from commit 0a2b9a6ea93650b8a00f9fd5ee8fdd25671e2df6)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 18c54c03865092e597897815ee0aadd69b8b3754
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:30 2012 +0900

    drivers: add Contiguous Memory Allocator

    The Contiguous Memory Allocator is a set of helper functions for DMA
    mapping framework that improves allocations of contiguous memory chunks.

    CMA grabs memory on system boot, marks it with MIGRATE_CMA migrate type
    and gives back to the system. Kernel is allowed to allocate only movable
    pages within CMA's managed memory so that it can be used for example for
    page cache when DMA mapping do not use it. On
    dma_alloc_from_contiguous() request such pages are migrated out of CMA
    area to free required contiguous block and fulfill the request. This
    allows to allocate large contiguous chunks of memory at any time
    assuming that there is enough free memory available in the system.

    This code is heavily based on earlier works by Michal Nazarewicz.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Signed-off-by: Kyungmin Park <[email protected]>
    Signed-off-by: Michal Nazarewicz <[email protected]>
    Acked-by: Arnd Bergmann <[email protected]>
    Tested-by: Rob Clark <[email protected]>
    Tested-by: Ohad Ben-Cohen <[email protected]>
    Tested-by: Benjamin Gaignard <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit c64be2bb1c6eb43c838b2c6d57b074078be208dd)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 92b0e095dc5a0367c6be5e24842ce670d10367fa
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:29 2012 +0900

    mm: trigger page reclaim in alloc_contig_range() to stabilise watermarks

    alloc_contig_range() performs memory allocation so it also should keep
    track on keeping the correct level of memory watermarks. This commit adds
    a call to *_slowpath style reclaim to grab enough pages to make sure that
    the final collection of contiguous pages from freelists will not starve
    the system.

    Signed-off-by: Marek Szyprowski <[email protected]>
    Signed-off-by: Kyungmin Park <[email protected]>
    CC: Michal Nazarewicz <[email protected]>
    Tested-by: Rob Clark <[email protected]>
    Tested-by: Ohad Ben-Cohen <[email protected]>
    Tested-by: Benjamin Gaignard <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit 49f223a9cd96c7293d7258ff88c2bdf83065f69c)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 130d5a94aa9a38cb0c389a7b16614e31d6e91373
Author: Marek Szyprowski <[email protected]>
Date:   Mon Oct 29 16:50:28 2012 +0900

    mm: extract reclaim code from __alloc_pages_direct_reclaim()

    This patch extracts common reclaim code from __alloc_pages_direct_reclaim()
    function to separate function: __perform_reclaim() which can be later used
    by alloc_contig_range().

    Signed-off-by: Marek Szyprowski <[email protected]>
    Signed-off-by: Kyungmin Park <[email protected]>
    Cc: Michal Nazarewicz <[email protected]>
    Acked-by: Mel Gorman <[email protected]>
    Tested-by: Rob Clark <[email protected]>
    Tested-by: Ohad Ben-Cohen <[email protected]>
    Tested-by: Benjamin Gaignard <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit bba9071087108d3de70bea274e35064cc480487b)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 6f59300ba9e7e4dd1b46767ba8d705227a0e3df5
Author: Mel Gorman <[email protected]>
Date:   Mon Oct 29 16:50:27 2012 +0900

    mm: Serialize access to min_free_kbytes

    There is a race between the min_free_kbytes sysctl, memory hotplug
    and transparent hugepage support enablement.  Memory hotplug uses a
    zonelists_mutex to avoid a race when building zonelists. Reuse it to
    serialise watermark updates.

    [[email protected]: Older patch fixed the race with spinlock]
    Signed-off-by: Mel Gorman <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit cfd3da1e49bb95c355c01c0f502d657deb3d34a4)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 297403e910814abed263194dc6bce58a0bedb300
Author: Michal Nazarewicz <[email protected]>
Date:   Mon Oct 29 16:50:26 2012 +0900

    mm: page_isolation: MIGRATE_CMA isolation functions added

    This commit changes various functions that change pages and
    pageblocks migrate type between MIGRATE_ISOLATE and
    MIGRATE_MOVABLE in such a way as to allow to work with
    MIGRATE_CMA migrate type.

    Signed-off-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
    Tested-by: Rob Clark <[email protected]>
    Tested-by: Ohad Ben-Cohen <[email protected]>
    Tested-by: Benjamin Gaignard <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit 0815f3d81d76dfbf2abcfd93a85ff0a6008fe4c0)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 4b1c9f454608e87e1924226913b284dfd8cbffce
Author: Michal Nazarewicz <[email protected]>
Date:   Mon Oct 29 16:50:25 2012 +0900

    mm: mmzone: MIGRATE_CMA migration type added

    The MIGRATE_CMA migration type has two main characteristics:
    (i) only movable pages can be allocated from MIGRATE_CMA
    pageblocks and (ii) page allocator will never change migration
    type of MIGRATE_CMA pageblocks.

    This guarantees (to some degree) that page in a MIGRATE_CMA page
    block can always be migrated somewhere else (unless there's no
    memory left in the system).

    It is designed to be used for allocating big chunks (eg. 10MiB)
    of physically contiguous memory.  Once driver requests
    contiguous memory, pages from MIGRATE_CMA pageblocks may be
    migrated away to create a contiguous block.

    To minimise number of migrations, MIGRATE_CMA migration type
    is the last type tried when page allocator falls back to other
    migration types when requested.

    Signed-off-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Signed-off-by: Kyungmin Park <[email protected]>
    Acked-by: Mel Gorman <[email protected]>
    Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
    Tested-by: Rob Clark <[email protected]>
    Tested-by: Ohad Ben-Cohen <[email protected]>
    Tested-by: Benjamin Gaignard <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit 47118af076f64844b4f423bc2f545b2da9dab50d)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit e3148a6a302d737cb0a469984a959d6e6432b8d1
Author: Michal Nazarewicz <[email protected]>
Date:   Mon Oct 29 16:50:24 2012 +0900

    mm: page_alloc: change fallbacks array handling

    This commit adds a row for MIGRATE_ISOLATE type to the fallbacks array
    which was missing from it.  It also, changes the array traversal logic
    a little making MIGRATE_RESERVE an end marker.  The letter change,
    removes the implicit MIGRATE_UNMOVABLE from the end of each row which
    was read by __rmqueue_fallback() function.

    Signed-off-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Mel Gorman <[email protected]>
    Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
    Tested-by: Rob Clark <[email protected]>
    Tested-by: Ohad Ben-Cohen <[email protected]>
    Tested-by: Benjamin Gaignard <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit 6d4a49160de2c684fb59fa627bce80e200224331)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 3254c033faf3461b6292463e31f852379da1f662
Author: Michal Nazarewicz <[email protected]>
Date:   Mon Oct 29 16:50:23 2012 +0900

    mm: page_alloc: introduce alloc_contig_range()

    This commit adds the alloc_contig_range() function which tries
    to allocate given range of pages.  It tries to migrate all
    already allocated pages that fall in the range thus freeing them.
    Once all pages in the range are freed they are removed from the
    buddy system thus allocated for the caller to use.

    Signed-off-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Mel Gorman <[email protected]>
    Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
    Tested-by: Rob Clark <[email protected]>
    Tested-by: Ohad Ben-Cohen <[email protected]>
    Tested-by: Benjamin Gaignard <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit 041d3a8cdc18dc375a128d90bbb753949a81b1fb)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 64dc481111efa88074521b73399c7aea1da58b0c
Author: Michal Nazarewicz <[email protected]>
Date:   Mon Oct 29 16:50:22 2012 +0900

    mm: compaction: export some of the functions

    This commit exports some of the functions from compaction.c file
    outside of it adding their declaration into internal.h header
    file so that other mm related code can use them.

    This forced compaction.c to always be compiled (as opposed to being
    compiled only if CONFIG_COMPACTION is defined) but as to avoid
    introducing code that user did not ask for, part of the compaction.c
    is now wrapped in on #ifdef.

    Signed-off-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Mel Gorman <[email protected]>
    Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
    Tested-by: Rob Clark <[email protected]>
    Tested-by: Ohad Ben-Cohen <[email protected]>
    Tested-by: Benjamin Gaignard <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit ff9543fd32060917beb080b1eb2d1d41ec7f39e0)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 4a9146950d6c41d522b06d9134d55ff06ea5a4c6
Author: Michal Nazarewicz <[email protected]>
Date:   Mon Oct 29 16:50:21 2012 +0900

    mm: compaction: introduce isolate_freepages_range()

    This commit introduces isolate_freepages_range() function which
    generalises isolate_freepages_block() so that it can be used on
    arbitrary PFN ranges.

    isolate_freepages_block() is left with only minor changes.

    Signed-off-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Mel Gorman <[email protected]>
    Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
    Tested-by: Rob Clark <[email protected]>
    Tested-by: Ohad Ben-Cohen <[email protected]>
    Tested-by: Benjamin Gaignard <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit 85aa125f001f87f96a72e9e6ee515490843b1202)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 200926c2bd77f1e240f648a28bb8cbc794c04d9e
Author: Michal Nazarewicz <[email protected]>
Date:   Mon Oct 29 16:50:20 2012 +0900

    mm: compaction: introduce map_pages()

    This commit creates a map_pages() function which map pages freed
    using split_free_pages().  This merely moves some code from
    isolate_freepages() so that it can be reused in other places.

    Signed-off-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Mel Gorman <[email protected]>
    Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit 03d44192f69a45d780ba124f691e76020a44ebae)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 7500c34c9b094308107176ccbc79e2104a972eb3
Author: Michal Nazarewicz <[email protected]>
Date:   Mon Oct 29 16:50:19 2012 +0900

    mm: compaction: introduce isolate_migratepages_range()

    This commit introduces isolate_migratepages_range() function which
    extracts functionality from isolate_migratepages() so that it can be
    used on arbitrary PFN ranges.

    isolate_migratepages() function is implemented as a simple wrapper
    around isolate_migratepages_range().

    Signed-off-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Mel Gorman <[email protected]>
    Reviewed-by: KAMEZAWA Hiroyuki <[email protected]>
    Tested-by: Rob Clark <[email protected]>
    Tested-by: Ohad Ben-Cohen <[email protected]>
    Tested-by: Benjamin Gaignard <[email protected]>
    Tested-by: Robert Nelson <[email protected]>
    Tested-by: Barry Song <[email protected]>
    (cherry picked from commit 2fe86e0004076128f05d5a774b5c9c03d9dc3de2)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>

commit 936e23ee1a0cf7323f5f9d20d6f885eacb2008a7
Author: Michal Nazarewicz <[email protected]>
Date:   Mon Oct 29 16:50:18 2012 +0900

    mm: page_alloc: remove trailing whitespace

    Signed-off-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Marek Szyprowski <[email protected]>
    Acked-by: Mel Gorman <[email protected]>
    (cherry picked from commit 5f63b720b62925ef3c6a85473dcd547b0fd90616)

    Signed-off-by: Damian Hobson-Garcia <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>
@michalliu
Copy link
Collaborator

I remember there is rt5370 drivers in the kernel already https://github.com/mmplayer/linux-sunxi/tree/dev/sunxi-3.4/drivers/net/wireless/rtxx7x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants