diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2017-10-27 16:51:51 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-29 11:16:22 +0900 |
commit | ee28de6bbd78c2e18111a0aef43ea746f28d2073 (patch) | |
tree | 133ee7dfb02cc14e42b9a88043d0ab26d2059513 /include/asm-generic/syscall.h | |
parent | 3953ae7b218df4d1e544b98a393666f9ae58a78c (diff) |
l2tp: initialise l2tp_eth sessions before registering them
Sessions must be initialised before being made externally visible by
l2tp_session_register(). Otherwise the session may be concurrently
deleted before being initialised, which can confuse the deletion path
and eventually lead to kernel oops.
Therefore, we need to move l2tp_session_register() down in
l2tp_eth_create(), but also handle the intermediate step where only the
session or the netdevice has been registered.
We can't just call l2tp_session_register() in ->ndo_init() because
we'd have no way to properly undo this operation in ->ndo_uninit().
Instead, let's register the session and the netdevice in two different
steps and protect the session's device pointer with RCU.
And now that we allow the session's .dev field to be NULL, we don't
need to prevent the netdevice from being removed anymore. So we can
drop the dev_hold() and dev_put() calls in l2tp_eth_create() and
l2tp_eth_dev_uninit().
Fixes: d9e31d17ceba ("l2tp: Add L2TP ethernet pseudowire support")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-generic/syscall.h')
0 files changed, 0 insertions, 0 deletions