]> git.baikalelectronics.ru Git - kernel.git/commit
devlink: Fix list access without lock while reading region
authorParav Pandit <parav@mellanox.com>
Tue, 12 Feb 2019 20:24:08 +0000 (14:24 -0600)
committerDavid S. Miller <davem@davemloft.net>
Thu, 14 Feb 2019 16:45:39 +0000 (11:45 -0500)
commit33e0d3a3b2c4f13dbd88bbba272558f21d8ed51e
tree8e7656b635d933726902556ed2c4a02546b390eb
parente1a601e56900cb54d6de4318ba65d266d3f3fa2f
devlink: Fix list access without lock while reading region

While finding the devlink device during region reading,
devlink device list is accessed and devlink device is
returned without holding a lock. This could lead to use-after-free
accesses.

While at it, add lockdep assert to ensure that all future callers hold
the lock when calling devlink_get_from_attrs().

Fixes: b41666a9e71d ("devlink: Add support for region snapshot read command")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/devlink.c