lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 13 Oct 2018 17:05:28 -0500
From:   Michael Bringmann <mwb@...ux.vnet.ibm.com>
To:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        mwb@...ux.vnet.ibm.com
Cc:     "David S. Miller" <davem@...emloft.net>,
        Alexander Duyck <alexander.h.duyck@...el.com>,
        Tyler Hicks <tyhicks@...onical.com>,
        Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
        Amritha Nambiar <amritha.nambiar@...el.com>,
        Joe Perches <joe@...ches.com>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        David Decotigny <decot@...glers.com>,
        Roopa Prabhu <roopa@...ulusnetworks.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Nathan Fontenot <nfont@...ux.vnet.ibm.com>,
        Juliet Kim <minkim@...ibm.com>,
        Tyrel Datwyler <tyreld@...ux.vnet.ibm.com>,
        Thomas Falcon <tlfalcon@...ux.vnet.ibm.com>
Subject: [PATCH] net/sysfs: Remove devices without receive buffers

Testing ran into a case where a network device was created and
initialized, but then removed from the system before accepting
traffic through it.  In this case, no receive buffers were added
to the device prior to attempting to release the driver.  This
resulted in generation of a WARNING notice/stack trace in the
console log like,

kobject: '(null)' (c0000009e028a310): is not initialized, yet kobject_put() is being called.
------------[ cut here ]------------
WARNING: CPU: 1 PID: 7689 at lib/kobject.c:661 kobject_put+0x2a8/0x370
Modules linked in: bonding iptable_filter rpadlpar_io rpaphp tcp_diag udp_diag inet_diag unix_diag af_packet_diag netlink_diag btrfs raid6_pq pseries_rng xor sg ibmvnic nfsd auth_rpcgss nfs_acl lockd grace sunrpc binfmt_misc ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic crct10dif_common ibmvscsi scsi_transport_srp ibmvfc scsi_transport_fc ibmveth scsi_tgt dm_mirror dm_region_hash dm_log dm_mod [last unloaded: bonding]
CPU: 1 PID: 7689 Comm: drmgr Kdump: loaded Not tainted 3.10.0-948.el7.ppc64le #1
task: c0000009ddb55c00 ti: c0000009daea8000 task.ti: c0000009daea8000
NIP: c000000000551ff8 LR: c000000000551ff4 CTR: 0000000000770c6c
REGS: c0000009daeab4a0 TRAP: 0700   Not tainted  (3.10.0-948.el7.ppc64le)
MSR: 8000000100029033 <SF,EE,ME,IR,DR,RI,LE>  CR: 28088822  XER: 0000000d
CFAR: c000000000a97f78 SOFTE: 1
00551ff4 c0000009daeab720 c0000000013e4d00 000000000000005c
0194a820 c00000000195d728 0000bc6bd731da26 00000000000000ec
00000007 0000000000000000 0000000000ad0000 0000000000000000
00008000 c000000007af0900 0000000000000000 0000000000000000
00000000 0000000000000000 0000000000000000 0000000000000000
00000000 0000000000000000 0000000000000000 0000000000000007
00d19c28 c000000000d19c50 0000000000000000 0000000000000000
d7dca000 c0000009e364da00 0000000000000005 c0000009e028a310
NIP [c000000000551ff8] kobject_put+0x2a8/0x370
LR [c000000000551ff4] kobject_put+0x2a4/0x370
Call Trace:
[c0000009daeab720] [c000000000551ff4] kobject_put+0x2a4/0x370 (unreliable)
[c0000009daeab7b0] [c000000000905ae8] net_rx_queue_update_kobjects+0x128/0x190
[c0000009daeab860] [c000000000905d78] netdev_unregister_kobject+0x48/0xa0
[c0000009daeab890] [c0000000008d35f4] rollback_registered_many+0x374/0x4e0
[c0000009daeab950] [c0000000008d38f8] unregister_netdev+0x68/0xf0
[c0000009daeab9d0] [d00000000aac95d4] ibmvnic_remove+0x54/0x190 [ibmvnic]
[c0000009daeaba10] [c00000000003f744] vio_bus_remove+0x64/0xf0
[c0000009daeaba50] [c0000000006b3a30] device_release_driver+0xf0/0x1b0
[c0000009daeaba90] [c0000000006b2d10] bus_remove_device+0x180/0x220
[c0000009daeabb10] [c0000000006ab9ac] device_del+0x1fc/0x3b0
[c0000009daeabba0] [c0000000006abb9c] device_unregister+0x3c/0xa0
[c0000009daeabc10] [c00000000003f49c] vio_unregister_device+0x2c/0x60
[c0000009daeabc40] [d00000000eb0093c] dlpar_remove_slot+0x28c/0x340 [rpadlpar_io]
[c0000009daeabcd0] [d00000000eb00b1c] remove_slot_store+0x8c/0xd0 [rpadlpar_io]
[c0000009daeabd40] [c0000000005516d0] kobj_attr_store+0x30/0x60
[c0000009daeabd60] [c00000000044c97c] sysfs_kf_write+0x6c/0xa0
[c0000009daeabd80] [c00000000044b7d0] kernfs_fop_write+0x150/0x1e0
[c0000009daeabdd0] [c000000000369e74] SyS_write+0x164/0x430
[c0000009daeabe30] [c00000000000a284] system_call+0x38/0xfc

This patch removes the warning for unitialized receive queues.

Signed-off-by: Michael Bringmann <mwb@...ux.vnet.ibm.com>
---
 net/core/net-sysfs.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index bd67c4d..a1d3f67 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -971,6 +971,8 @@ static int rx_queue_add_kobject(struct net_device *dev, int index)
 	while (--i >= new_num) {
 		struct kobject *kobj = &dev->_rx[i].kobj;
 
+		if (!kobj->state_initialized)
+			continue;
 		if (!refcount_read(&dev_net(dev)->count))
 			kobj->uevent_suppress = 1;
 		if (dev->sysfs_rx_queue_group)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ