Subject: [sctp] cf8d0e3e58: WARNING:at_net/ipv4/af_inet.c:#inet_sock_destruct

From: kernel test robot <[email-masked]>
Date: Sat, 27 Jun 2020 15:57:34 +0800

Greeting,

FYI, we noticed the following commit (built with gcc-9):

commit: cf8d0e3e583cba8e7eb935f9b97ac94d84fccc2d ("[PATCH] sctp: Fix sk_buff leak when receiving a datagram")
url: https://github.com/0day-ci/linux/commits/Xiyu-Yang/sctp-Fix-sk_buff-leak-when-receiving-a-datagram/20200613-204024

in testcase: ltp
with following parameters:

	test: net.sctp

test-description: The LTP testsuite contains a collection of tools for testing the Linux kernel and related features.
test-url: http://linux-test-project.github.io/

on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):

+---------------------------------------------------+------------+------------+
|                                                   | df2fbf5bfa | cf8d0e3e58 |
+---------------------------------------------------+------------+------------+
| boot_successes                                    | 0          | 0          |
| boot_failures                                     | 2          | 4          |
| WARNING:at_fs/fuse/file.c:#tree_insert[fuse]      | 2          |            |
| RIP:tree_insert[fuse]                             | 2          |            |
| WARNING:at_net/ipv4/af_inet.c:#inet_sock_destruct | 0          | 4          |
| RIP:inet_sock_destruct                            | 0          | 4          |
| RIP:native_safe_halt                              | 0          | 4          |
+---------------------------------------------------+------------+------------+

If you fix the issue, kindly add following tag
Reported-by: kernel test robot <[email-masked]>

[   52.179668] WARNING: CPU: 1 PID: 2325 at net/ipv4/af_inet.c:154 inet_sock_destruct+0x199/0x1c0
[   52.181864] Modules linked in: sctp libcrc32c loop sr_mod cdrom sg intel_rapl_msr ppdev bochs_drm drm_vram_helper drm_ttm_helper ttm intel_rapl_common ata_generic drm_kms_helper crct10dif_pclmul crc32_pclmul pata_acpi crc32c_intel ghash_clmulni_intel snd_pcm syscopyarea aesni_intel sysfillrect sysimgblt fb_sys_fops snd_timer crypto_simd cryptd glue_helper snd ata_piix drm soundcore joydev pcspkr serio_raw libata i2c_piix4 parport_pc parport floppy ip_tables
[   52.192094] CPU: 1 PID: 2325 Comm: test_1_to_1_add Not tainted 5.7.0-14529-gcf8d0e3e583cb #1
[   52.194497] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
[   52.197030] RIP: 0010:inet_sock_destruct+0x199/0x1c0
[   52.199047] Code: 00 00 5b 41 5c e9 87 ca f3 ff 41 0f b6 44 24 12 3c 07 74 8f e9 24 09 00 00 4c 89 e7 e8 40 42 f1 ff e9 71 ff ff ff 0f 0b eb b6 <0f> 0b 41 8b 84 24 4c 01 00 00 85 c0 74 90 0f 0b 41 8b 94 24 48 01
[   52.204322] RSP: 0018:ffffab6340317d40 EFLAGS: 00010202
[   52.206435] RAX: 00000000000000ef RBX: ffff9f1fdffa21b0 RCX: 0000000000000020
[   52.208868] RDX: 0000000000000201 RSI: 0000000000000f11 RDI: ffff9f1fdffa21b0
[   52.211132] RBP: ffff9f1fdffa2100 R08: ffff9f1fdffa224c R09: 0000000000000000
[   52.213435] R10: ffff9f1fe329c700 R11: 0000000000000001 R12: ffff9f1fdffa2100
[   52.215899] R13: ffff9f1fdffa2188 R14: ffff9f1fdffa2180 R15: ffff9f2005d7d380
[   52.218327] FS:  0000000000000000(0000) GS:ffff9f20bfd00000(0000) knlGS:0000000000000000
[   52.220970] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   52.223361] CR2: 00007f39626d5f10 CR3: 00000003a240a000 CR4: 00000000000406e0
[   52.225886] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   52.228452] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   52.230985] Call Trace:
[   52.232898]  __sk_destruct+0x26/0x1e0
[   52.235011]  sctp_close+0x23a/0x320 [sctp]
[   52.237248]  inet_release+0x34/0x60
[   52.239411]  __sock_release+0x3d/0xa0
[   52.241422]  sock_close+0x11/0x20
[   52.243362]  __fput+0xf5/0x260
[   52.245211]  task_work_run+0x6f/0xc0
[   52.247257]  do_exit+0x391/0xbb0
[   52.249135]  do_group_exit+0x3a/0xb0
[   52.251083]  __x64_sys_exit_group+0x14/0x20
[   52.253066]  do_syscall_64+0x5b/0x1f0
[   52.254856]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[   52.257101] RIP: 0033:0x7f39626d5618
[   52.259140] Code: Bad RIP value.
[   52.261631] RSP: 002b:00007ffff5ead788 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
[   52.264092] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f39626d5618
[   52.266446] RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
[   52.268925] RBP: 00007f39629b28e0 R08: 00000000000000e7 R09: ffffffffffffff98
[   52.271434] R10: 00007f3962bd4260 R11: 0000000000000246 R12: 00007f39629b28e0
[   52.273912] R13: 00007f39629b7c20 R14: 0000000000000000 R15: 0000000000000000
[   52.276446] ---[ end trace 64f4aa61e173f4fb ]---

To reproduce:

        # build kernel
	cd linux
	cp config-5.7.0-14529-gcf8d0e3e583cb .config
	make HOSTCC=gcc-9 CC=gcc-9 ARCH=x86_64 olddefconfig prepare modules_prepare bzImage modules
	make HOSTCC=gcc-9 CC=gcc-9 ARCH=x86_64 INSTALL_MOD_PATH=<mod-install-dir> modules_install
	cd <mod-install-dir>
	find lib/ | cpio -o -H newc --quiet | gzip > modules.cgz

        git clone https://github.com/intel/lkp-tests.git
        cd lkp-tests
        bin/lkp qemu -k <bzImage> -m modules.cgz job-script # job-script is attached in this email

Thanks,
lkp