Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce627a1b authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'rtnl_lock_killable'



Kirill Tkhai says:

====================
Introduce rtnl_lock_killable()

rtnl_lock() is widely used mutex in kernel. Some of kernel code
does memory allocations under it. In case of memory deficit this
may invoke OOM killer, but the problem is a killed task can't
exit if it's waiting for the mutex. This may be a reason of deadlock
and panic.

This patchset adds a new primitive, which responds on SIGKILL,
and it allows to use it in the places, where we don't want
to sleep forever. Also, the first place is made to use it.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 320bd6de b0f3debc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ extern void rtnl_lock(void);
extern void rtnl_unlock(void);
extern int rtnl_trylock(void);
extern int rtnl_is_locked(void);
extern int rtnl_lock_killable(void);

extern wait_queue_head_t netdev_unregistering_wq;
extern struct rw_semaphore net_sem;
+2 −1
Original line number Diff line number Diff line
@@ -8018,7 +8018,8 @@ int register_netdev(struct net_device *dev)
{
	int err;

	rtnl_lock();
	if (rtnl_lock_killable())
		return -EINTR;
	err = register_netdevice(dev);
	rtnl_unlock();
	return err;
+6 −0
Original line number Diff line number Diff line
@@ -75,6 +75,12 @@ void rtnl_lock(void)
}
EXPORT_SYMBOL(rtnl_lock);

int rtnl_lock_killable(void)
{
	return mutex_lock_killable(&rtnl_mutex);
}
EXPORT_SYMBOL(rtnl_lock_killable);

static struct sk_buff *defer_kfree_skb_list;
void rtnl_kfree_skbs(struct sk_buff *head, struct sk_buff *tail)
{