]> git.baikalelectronics.ru Git - kernel.git/commit
l2tp: unhash l2tp sessions on delete, not on free
authorTom Parkin <tparkin@katalix.com>
Tue, 19 Mar 2013 06:11:23 +0000 (06:11 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Mar 2013 16:10:39 +0000 (12:10 -0400)
commit7f7bb9f5a8ba8b4c99252c0b59d74c31d24626ef
tree115d199ee9cd9fb9dbc296d3daad259cd9e0d682
parentd8ef7d6f454812e94465e1b39c3c9bac02c075f2
l2tp: unhash l2tp sessions on delete, not on free

If we postpone unhashing of l2tp sessions until the structure is freed, we
risk:

 1. further packets arriving and getting queued while the pseudowire is being
    closed down
 2. the recv path hitting "scheduling while atomic" errors in the case that
    recv drops the last reference to a session and calls l2tp_session_free
    while in atomic context

As such, l2tp sessions should be unhashed from l2tp_core data structures early
in the teardown process prior to calling pseudowire close.  For pseudowires
like l2tp_ppp which have multiple shutdown codepaths, provide an unhash hook.

Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/l2tp/l2tp_core.c
net/l2tp/l2tp_core.h
net/l2tp/l2tp_ppp.c