]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/core: Protect against changing dst->dev during destination resolve
authorParav Pandit <parav@mellanox.com>
Wed, 5 Sep 2018 09:54:23 +0000 (12:54 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 12 Sep 2018 22:32:16 +0000 (16:32 -0600)
commitf657d601381c02caa9be153e13707109d6a3915c
tree0abba89ab6efdc0f7bcb6f2503650f3f88aad038
parent4b77452a0c628249df704814902f9b5ad523e0e8
RDMA/core: Protect against changing dst->dev during destination resolve

During resolving address process, during route lookup and while performing
src address translation in case of loopback mode, hold the rcu lock so
that if netdevice is moving to different net namespace, or being
unregistered, it can be synchronized with net/core/dev.c, ie

change_net_namespace()
->dev_close_many()
  ->rt6_uncached_list_flush_dev() who would change dst->dev

to loopback device of the given net namespace.

Therefore, hold the rcu lock and sync with synchronize_net() of
change_net_namespace() to ensure that netdevice cannot get freed while
dst->dev is being used.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/addr.c