]> git.baikalelectronics.ru Git - kernel.git/commit
driver core: Fix device link device name collision
authorSaravana Kannan <saravanak@google.com>
Sun, 10 Jan 2021 17:54:07 +0000 (09:54 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Jan 2021 19:12:40 +0000 (20:12 +0100)
commit2d53fdb64f4aefd22fd6d90a4c3206cdfc8b9357
treef6e0ab7384c3ab85a71ec5568fdace8135312a12
parent882badb65e7b6353473ecf0aef2f44d97216dce8
driver core: Fix device link device name collision

The device link device's name was of the form:
<supplier-dev-name>--<consumer-dev-name>

This can cause name collision as reported here [1] as device names are
not globally unique. Since device names have to be unique within the
bus/class, add the bus/class name as a prefix to the device names used to
construct the device link device name.

So the devuce link device's name will be of the form:
<supplier-bus-name>:<supplier-dev-name>--<consumer-bus-name>:<consumer-dev-name>

[1] - https://lore.kernel.org/lkml/20201229033440.32142-1-michael@walle.cc/

Fixes: 18c09e885bcb ("driver core: Expose device link details in sysfs")
Cc: stable@vger.kernel.org
Reported-by: Michael Walle <michael@walle.cc>
Tested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Saravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20210110175408.1465657-1-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/ABI/testing/sysfs-class-devlink
Documentation/ABI/testing/sysfs-devices-consumer
Documentation/ABI/testing/sysfs-devices-supplier
drivers/base/core.c
include/linux/device.h