Re: [PATCH 2/2] staging:r8188eu: Use lib80211 to encrypt (CCMP) tx frames

From: Michael Straube
Date: Sun Aug 05 2018 - 16:46:23 EST


On 08/05/18 16:07, Greg Kroah-Hartman wrote:
On Thu, Aug 02, 2018 at 06:35:05PM +0200, Michael Straube wrote:
On 07/16/18 15:30, Michael Straube wrote:
On 07/14/18 19:54, Ivan Safonov wrote:
Put data to skb, decrypt with lib80211_crypt_ccmp, and place back to tx buffer.

Signed-off-by: Ivan Safonov <insafonov@xxxxxxxxx>
---
 drivers/staging/rtl8188eu/core/rtw_security.c | 778 +++-----------------------
 1 file changed, 72 insertions(+), 706 deletions(-)


Hi Ivan,

with this applied I get the following in dmesg:

[ÂÂÂ 3.901334] [drm] Initialized amdgpu 3.26.0 20150101 for 0000:07:00.0 on minor 0
[ÂÂÂ 4.108904] IPv6: ADDRCONF(NETDEV_UP): enp6s0: link is not ready
[ÂÂÂ 4.185502] r8169 0000:06:00.0 enp6s0: link down
[ÂÂÂ 4.185564] IPv6: ADDRCONF(NETDEV_UP): enp6s0: link is not ready
[ÂÂÂ 4.193647] IPv6: ADDRCONF(NETDEV_UP): wlp1s0f0u9: link is not ready
[ÂÂ 17.741809] MAC Address = 7c:8b:ca:08:80:7e
[ÂÂ 17.828850] IPv6: ADDRCONF(NETDEV_UP): wlp1s0f0u9: link is not ready
[ÂÂ 17.969593] R8188EU: indicate disassoc
[ÂÂ 18.081923] IPv6: ADDRCONF(NETDEV_UP): wlp1s0f0u9: link is not ready
[ÂÂ 18.123036] IPv6: ADDRCONF(NETDEV_UP): wlp1s0f0u9: link is not ready
[ÂÂ 23.034084] R8188EU: assoc success
[ÂÂ 23.085043] IPv6: ADDRCONF(NETDEV_CHANGE): wlp1s0f0u9: link becomes ready
[ÂÂ 23.093587] BUG: scheduling while atomic: NetworkManager/495/0x00000202
[ÂÂ 23.093590] Modules linked in: amdkfd amd_iommu_v2 amdgpu nls_iso8859_1 nls_cp437 vfat fat r8188eu(C) lib80211 snd_hda_codec_realtek cfg80211 snd_hda_codec_generic edac_mce_amd chash snd_hda_codec_hdmi gpu_sched kvm_amd i2c_algo_bit ttm ccp snd_hda_intel rng_core drm_kms_helper kvm snd_hda_codec input_leds led_class joydev mousedev drm rfkill irqbypass snd_hda_core crct10dif_pclmul agpgart crc32_pclmul snd_hwdep ghash_clmulni_intel syscopyarea sysfillrect sysimgblt pcbc wmi_bmof snd_pcm aesni_intel snd_timer aes_x86_64 crypto_simd cryptd k10temp fb_sys_fops snd r8169 sp5100_tco pcspkr glue_helper soundcore mii i2c_piix4 rtc_cmos pinctrl_amd evdev gpio_amdpt wmi mac_hid acpi_cpufreq crypto_user ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 fscrypto sd_mod hid_generic usbhid hid ahci libahci
[ÂÂ 23.093655]Â xhci_pci xhci_hcd libata crc32c_intel usbcore scsi_mod usb_common
[ÂÂ 23.093661] Preemption disabled at:
[ÂÂ 23.093667] [<ffffffffb9600954>] __dev_queue_xmit+0x74/0x910
[ÂÂ 23.093672] CPU: 7 PID: 495 Comm: NetworkManager Tainted: GÂÂÂÂÂÂÂÂ CÂÂÂÂÂÂÂ 4.18.0-rc5-staging+ #1
[ÂÂ 23.093673] Hardware name: Gigabyte Technology Co., Ltd. A320M-S2H/A320M-S2H-CF, BIOS F23d 04/17/2018
[ÂÂ 23.093675] Call Trace:
[ÂÂ 23.093683]Â dump_stack+0x5c/0x80
[ÂÂ 23.093686]Â ? __dev_queue_xmit+0x74/0x910
[ÂÂ 23.093691]Â __schedule_bug.cold.14+0x82/0x9b
[ÂÂ 23.093696]Â __schedule+0x705/0x8b0
[ÂÂ 23.093700]Â ? enqueue_task_fair+0xc3/0x730
[ÂÂ 23.093704]Â schedule+0x32/0x90
[ÂÂ 23.093707]Â schedule_timeout+0x311/0x4a0
[ÂÂ 23.093710]Â ? _raw_spin_unlock_irqrestore+0x20/0x40
[ÂÂ 23.093713]Â ? try_to_wake_up+0x23a/0x490
[ÂÂ 23.093716]Â wait_for_common+0x15f/0x190
[ÂÂ 23.093719]Â ? wake_up_q+0x70/0x70
[ÂÂ 23.093736]Â ? rtw_aes_encrypt+0x26f/0x290 [r8188eu]
[ÂÂ 23.093739]Â wait_for_completion_killable+0x19/0x30
[ÂÂ 23.093743]Â call_usermodehelper_exec+0x115/0x160
[ÂÂ 23.093747]Â __request_module+0x1ac/0x3e2
[ÂÂ 23.093764]Â rtw_aes_encrypt+0x26f/0x290 [r8188eu]
[ÂÂ 23.093778]Â ? rtw_get_stainfo+0xe6/0x130 [r8188eu]
[ÂÂ 23.093793]Â rtw_xmitframe_coalesce+0x950/0xb00 [r8188eu]
[ÂÂ 23.093799]Â ? _raw_spin_lock_irqsave+0x25/0x50
[ÂÂ 23.093812]Â rtw_hal_xmit+0x83/0x130 [r8188eu]
[ÂÂ 23.093826]Â rtw_xmit+0x258/0x5d0 [r8188eu]
[ÂÂ 23.093840]Â rtw_xmit_entry+0xe8/0x2e7 [r8188eu]
[ÂÂ 23.093845]Â dev_hard_start_xmit+0xa5/0x240
[ÂÂ 23.093849]Â sch_direct_xmit+0x150/0x340
[ÂÂ 23.093852]Â __dev_queue_xmit+0x2f6/0x910
[ÂÂ 23.093856]Â packet_sendmsg+0x945/0x1592
[ÂÂ 23.093860]Â ? attach_to_pi_state+0x18/0x110
[ÂÂ 23.093862]Â ? preempt_count_sub+0x60/0x90
[ÂÂ 23.093866]Â ? ep_item_poll.isra.1+0x40/0xc0
[ÂÂ 23.093871]Â sock_sendmsg+0x33/0x40
[ÂÂ 23.093874]Â __sys_sendto+0xee/0x160
[ÂÂ 23.093879]Â ? memzero_explicit+0xa/0x10
[ÂÂ 23.093883]Â ? urandom_read+0x120/0x270
[ÂÂ 23.093887]Â __x64_sys_sendto+0x24/0x30
[ÂÂ 23.093890]Â do_syscall_64+0x5b/0x170
[ÂÂ 23.093893]Â entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ÂÂ 23.093896] RIP: 0033:0x7fac0b700c12
[ÂÂ 23.093897] Code: 48 83 ec 18 44 89 4c 24 08 e8 9a f5 ff ff 44 8b 4c 24 08 4d 89 f8 45 89 f2 89 c5 4c 89 ea 4c 89 e6 89 df b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 3a 89 ef 48 89 44 24 08 e8 ca f5 ff ff 48 8b
[ÂÂ 23.093935] RSP: 002b:00007fffc46321b0 EFLAGS: 00000293 ORIG_RAX: 000000000000002c
[ÂÂ 23.093938] RAX: ffffffffffffffda RBX: 0000000000000011 RCX: 00007fac0b700c12
[ÂÂ 23.093939] RDX: 0000000000000148 RSI: 000055f8a5417c70 RDI: 0000000000000011
[ÂÂ 23.093940] RBP: 0000000000000000 R08: 000055f8a54154c0 R09: 0000000000000014
[ÂÂ 23.093942] R10: 0000000000000000 R11: 0000000000000293 R12: 000055f8a5417c70
[ÂÂ 23.093943] R13: 0000000000000148 R14: 0000000000000000 R15: 000055f8a54154c0
[ÂÂ 23.096167] lib80211_crypt: registered algorithm 'CCMP'
[ÂÂ 23.096544] ------------[ cut here ]------------
[ÂÂ 23.096549] DEBUG_LOCKS_WARN_ON(val > preempt_count())
[ÂÂ 23.096557] WARNING: CPU: 7 PID: 495 at kernel/sched/core.c:3246 preempt_count_sub+0x5a/0x90
[ÂÂ 23.096561] Modules linked in: lib80211_crypt_ccmp amdkfd amd_iommu_v2 amdgpu nls_iso8859_1 nls_cp437 vfat fat r8188eu(C) lib80211 snd_hda_codec_realtek cfg80211 snd_hda_codec_generic edac_mce_amd chash snd_hda_codec_hdmi gpu_sched kvm_amd i2c_algo_bit ttm ccp snd_hda_intel rng_core drm_kms_helper kvm snd_hda_codec input_leds led_class joydev mousedev drm rfkill irqbypass snd_hda_core crct10dif_pclmul agpgart crc32_pclmul snd_hwdep ghash_clmulni_intel syscopyarea sysfillrect sysimgblt pcbc wmi_bmof snd_pcm aesni_intel snd_timer aes_x86_64 crypto_simd cryptd k10temp fb_sys_fops snd r8169 sp5100_tco pcspkr glue_helper soundcore mii i2c_piix4 rtc_cmos pinctrl_amd evdev gpio_amdpt wmi mac_hid acpi_cpufreq crypto_user ip_tables x_tables ext4 crc32c_generic crc16 mbcache jbd2 fscrypto sd_mod hid_generic
[ÂÂ 23.096604]Â usbhid hid ahci libahci xhci_pci xhci_hcd libata crc32c_intel usbcore scsi_mod usb_common
[ÂÂ 23.096613] CPU: 7 PID: 495 Comm: NetworkManager Tainted: GÂÂÂÂÂÂÂ WCÂÂÂÂÂÂÂ 4.18.0-rc5-staging+ #1
[ÂÂ 23.096615] Hardware name: Gigabyte Technology Co., Ltd. A320M-S2H/A320M-S2H-CF, BIOS F23d 04/17/2018
[ÂÂ 23.096618] RIP: 0010:preempt_count_sub+0x5a/0x90
[ÂÂ 23.096619] Code: 15 f7 46 c3 e8 a7 86 2d 00 85 c0 74 f6 8b 15 15 6b 5a 01 85 d2 75 ec 48 c7 c6 be fb e6 b9 48 c7 c7 6b ad e5 b9 e8 c0 77 fd ff <0f> 0b c3 84 d2 75 c9 e8 7a 86 2d 00 85 c0 74 c9 8b 05 e8 6a 5a 01
[ÂÂ 23.096647] RSP: 0018:ffff9d5581447c48 EFLAGS: 00010286
[ÂÂ 23.096650] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000001
[ÂÂ 23.096652] RDX: 0000000080000001 RSI: ffffffffb9e82096 RDI: 00000000ffffffff
[ÂÂ 23.096653] RBP: ffff959ef568a600 R08: 0000001cb3397218 R09: 00000000000003f3
[ÂÂ 23.096655] R10: ffffffffba5f7700 R11: 0000000000000000 R12: ffff959ef568a6ac
[ÂÂ 23.096657] R13: ffff959f0db9a000 R14: ffff959f15441000 R15: 0000000000000007
[ÂÂ 23.096660] FS:Â 00007fac0dcd9000(0000) GS:ffff959f1edc0000(0000) knlGS:0000000000000000
[ÂÂ 23.096663] CS:Â 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ÂÂ 23.096665] CR2: 00007fffc462efe8 CR3: 0000000206e88000 CR4: 00000000003406e0
[ÂÂ 23.096667] Call Trace:
[ÂÂ 23.096674]Â _raw_spin_unlock+0x16/0x30
[ÂÂ 23.096678]Â sch_direct_xmit+0x178/0x340
[ÂÂ 23.096684]Â __dev_queue_xmit+0x2f6/0x910
[ÂÂ 23.096689]Â packet_sendmsg+0x945/0x1592
[ÂÂ 23.096694]Â ? attach_to_pi_state+0x18/0x110
[ÂÂ 23.096696]Â ? preempt_count_sub+0x60/0x90
[ÂÂ 23.096701]Â ? ep_item_poll.isra.1+0x40/0xc0
[ÂÂ 23.096706]Â sock_sendmsg+0x33/0x40
[ÂÂ 23.096710]Â __sys_sendto+0xee/0x160
[ÂÂ 23.096715]Â ? memzero_explicit+0xa/0x10
[ÂÂ 23.096719]Â ? urandom_read+0x120/0x270
[ÂÂ 23.096724]Â __x64_sys_sendto+0x24/0x30
[ÂÂ 23.096728]Â do_syscall_64+0x5b/0x170
[ÂÂ 23.096732]Â entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ÂÂ 23.096735] RIP: 0033:0x7fac0b700c12
[ÂÂ 23.096736] Code: 48 83 ec 18 44 89 4c 24 08 e8 9a f5 ff ff 44 8b 4c 24 08 4d 89 f8 45 89 f2 89 c5 4c 89 ea 4c 89 e6 89 df b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 3a 89 ef 48 89 44 24 08 e8 ca f5 ff ff 48 8b
[ÂÂ 23.096763] RSP: 002b:00007fffc46321b0 EFLAGS: 00000293 ORIG_RAX: 000000000000002c
[ÂÂ 23.096766] RAX: ffffffffffffffda RBX: 0000000000000011 RCX: 00007fac0b700c12
[ÂÂ 23.096767] RDX: 0000000000000148 RSI: 000055f8a5417c70 RDI: 0000000000000011
[ÂÂ 23.096769] RBP: 0000000000000000 R08: 000055f8a54154c0 R09: 0000000000000014
[ÂÂ 23.096770] R10: 0000000000000000 R11: 0000000000000293 R12: 000055f8a5417c70
[ÂÂ 23.096772] R13: 0000000000000148 R14: 0000000000000000 R15: 000055f8a54154c0
[ÂÂ 23.096775] ---[ end trace 8e7e0aecb937369e ]---
[ÂÂ 23.096792] BUG: using __this_cpu_read() in preemptible [00000000] code: NetworkManager/495
[ÂÂ 23.096795] caller is __local_bh_enable_ip+0x50/0x80
[ÂÂ 23.096798] CPU: 7 PID: 495 Comm: NetworkManager Tainted: GÂÂÂÂÂÂÂ WCÂÂÂÂÂÂÂ 4.18.0-rc5-staging+ #1
[ÂÂ 23.096799] Hardware name: Gigabyte Technology Co., Ltd. A320M-S2H/A320M-S2H-CF, BIOS F23d 04/17/2018
[ÂÂ 23.096800] Call Trace:
[ÂÂ 23.096804]Â dump_stack+0x5c/0x80
[ÂÂ 23.096808]Â check_preemption_disabled.cold.0+0x46/0x51
[ÂÂ 23.096812]Â __local_bh_enable_ip+0x50/0x80
[ÂÂ 23.096814]Â __dev_queue_xmit+0x450/0x910
[ÂÂ 23.096819]Â packet_sendmsg+0x945/0x1592
[ÂÂ 23.096823]Â ? attach_to_pi_state+0x18/0x110
[ÂÂ 23.096826]Â ? preempt_count_sub+0x60/0x90
[ÂÂ 23.096829]Â ? ep_item_poll.isra.1+0x40/0xc0
[ÂÂ 23.096833]Â sock_sendmsg+0x33/0x40
[ÂÂ 23.096835]Â __sys_sendto+0xee/0x160
[ÂÂ 23.096840]Â ? memzero_explicit+0xa/0x10
[ÂÂ 23.096842]Â ? urandom_read+0x120/0x270
[ÂÂ 23.096845]Â __x64_sys_sendto+0x24/0x30
[ÂÂ 23.096848]Â do_syscall_64+0x5b/0x170
[ÂÂ 23.096850]Â entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ÂÂ 23.096852] RIP: 0033:0x7fac0b700c12
[ÂÂ 23.096853] Code: 48 83 ec 18 44 89 4c 24 08 e8 9a f5 ff ff 44 8b 4c 24 08 4d 89 f8 45 89 f2 89 c5 4c 89 ea 4c 89 e6 89 df b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 3a 89 ef 48 89 44 24 08 e8 ca f5 ff ff 48 8b
[ÂÂ 23.096880] RSP: 002b:00007fffc46321b0 EFLAGS: 00000293 ORIG_RAX: 000000000000002c
[ÂÂ 23.096882] RAX: ffffffffffffffda RBX: 0000000000000011 RCX: 00007fac0b700c12
[ÂÂ 23.096885] RDX: 0000000000000148 RSI: 000055f8a5417c70 RDI: 0000000000000011
[ÂÂ 23.096886] RBP: 0000000000000000 R08: 000055f8a54154c0 R09: 0000000000000014
[ÂÂ 23.096888] R10: 0000000000000000 R11: 0000000000000293 R12: 000055f8a5417c70
[ÂÂ 23.096889] R13: 0000000000000148 R14: 0000000000000000 R15: 000055f8a54154c0




Hi,

I guess in addition to
Revert "staging:r8188eu: Use lib80211 to encrypt (TKIP) tx frames"

this patch should also be reverted. I still get the above messages in dmesg.
With this [1] reverted dmesg looks good.

[1]
515ce733e86ee2e1bea4dba76d2d4491013d0f73
staging:r8188eu: Use lib80211 to encrypt (CCMP) tx frames

Can you send me a patch to revert this?

Done. I hope it was not wrong to include the whole dmesg in the commit message.

Michael