--- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -3663,8 +3663,9 @@ static inline bool netif_attr_test_online(unsigned long j, static inline unsigned int netif_attrmask_next(int n, const unsigned long *srcp, unsigned int nr_bits) { - /* n is a prior cpu */ - cpu_max_bits_warn(n + 1, nr_bits); + /* -1 is a legal arg here. */ + if (n != -1) + cpu_max_bits_warn(n, nr_bits); if (srcp) return find_next_bit(srcp, nr_bits, n + 1); @@ -3685,8 +3686,9 @@ static inline int netif_attrmask_next_and(int n, const unsigned long *src1p, const unsigned long *src2p, unsigned int nr_bits) { - /* n is a prior cpu */ - cpu_max_bits_warn(n + 1, nr_bits); + /* -1 is a legal arg here. */ + if (n != -1) + cpu_max_bits_warn(n, nr_bits); if (src1p && src2p) return find_next_and_bit(src1p, src2p, nr_bits, n + 1); --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c @@ -715,6 +715,7 @@ err_unlock: return NULL; } +static void __kernfs_activate(struct kernfs_node *); /** * kernfs_add_one - add kernfs_node to parent without warning * @kn: kernfs_node to be added @@ -763,8 +764,6 @@ int kernfs_add_one(struct kernfs_node *k ps_iattr->ia_mtime = ps_iattr->ia_ctime; } - up_write(&root->kernfs_rwsem); - /* * Activate the new node unless CREATE_DEACTIVATED is requested. * If not activated here, the kernfs user is responsible for @@ -773,7 +772,9 @@ int kernfs_add_one(struct kernfs_node *k * trigger deactivation. */ if (!(kernfs_root(kn)->flags & KERNFS_ROOT_CREATE_DEACTIVATED)) - kernfs_activate(kn); + __kernfs_activate(kn); + + up_write(&root->kernfs_rwsem); return 0; out_unlock: @@ -1320,6 +1321,14 @@ static void kernfs_activate_one(struct k atomic_sub(KN_DEACTIVATED_BIAS, &kn->active); } +static void __kernfs_activate(struct kernfs_node *kn) +{ + struct kernfs_node *pos = NULL; + + while ((pos = kernfs_next_descendant_post(pos, kn))) + kernfs_activate_one(pos); +} + /** * kernfs_activate - activate a node which started deactivated * @kn: kernfs_node whose subtree is to be activated @@ -1335,15 +1344,10 @@ static void kernfs_activate_one(struct k */ void kernfs_activate(struct kernfs_node *kn) { - struct kernfs_node *pos; struct kernfs_root *root = kernfs_root(kn); down_write(&root->kernfs_rwsem); - - pos = NULL; - while ((pos = kernfs_next_descendant_post(pos, kn))) - kernfs_activate_one(pos); - + __kernfs_activate(kn); up_write(&root->kernfs_rwsem); } --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -3664,7 +3664,10 @@ void device_del(struct device *dev) unsigned int noio_flag; device_lock(dev); - kill_device(dev); + if (kill_device(dev) == false) { + device_unlock(dev); + return; + } device_unlock(dev); if (dev->fwnode && dev->fwnode->dev == dev)