2015-12-15 11:25:35

by Alexander Aring

[permalink] [raw]
Subject: [PATCH bluetooth-next] 6lowpan: fix debugfs interface entry name

This patches moves the debugfs interface related register after
netdevice register. The function lowpan_dev_debugfs_init will use
"dev->name" which can be before register_netdevice a format string.
The function register_netdevice will evaluate the format string if
necessary and replace "dev->name" to the real interface name.

Reported-by: Lukasz Duda <[email protected]>
Signed-off-by: Alexander Aring <[email protected]>
---
net/6lowpan/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c
index c7f06f5..faf65ba 100644
--- a/net/6lowpan/core.c
+++ b/net/6lowpan/core.c
@@ -29,13 +29,13 @@ int lowpan_register_netdevice(struct net_device *dev,

lowpan_priv(dev)->lltype = lltype;

- ret = lowpan_dev_debugfs_init(dev);
+ ret = register_netdevice(dev);
if (ret < 0)
return ret;

- ret = register_netdevice(dev);
+ ret = lowpan_dev_debugfs_init(dev);
if (ret < 0)
- lowpan_dev_debugfs_exit(dev);
+ unregister_netdevice(dev);

return ret;
}
--
2.6.1



2015-12-20 07:22:04

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH bluetooth-next] 6lowpan: fix debugfs interface entry name

Hi Alex,

> This patches moves the debugfs interface related register after
> netdevice register. The function lowpan_dev_debugfs_init will use
> "dev->name" which can be before register_netdevice a format string.
> The function register_netdevice will evaluate the format string if
> necessary and replace "dev->name" to the real interface name.
>
> Reported-by: Lukasz Duda <[email protected]>
> Signed-off-by: Alexander Aring <[email protected]>
> ---
> net/6lowpan/core.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


2015-12-15 11:47:27

by Lukasz Duda

[permalink] [raw]
Subject: RE: [PATCH bluetooth-next] 6lowpan: fix debugfs interface entry name

Hi Alex,

> -----Original Message-----
> From: Alexander Aring [mailto:[email protected]]
> Sent: Tuesday, December 15, 2015 12:26
> To: [email protected]
> Cc: [email protected]; [email protected];
> [email protected]; Duda, Lukasz; Alexander Aring
> Subject: [PATCH bluetooth-next] 6lowpan: fix debugfs interface entry name
>
> This patches moves the debugfs interface related register after netdevice
> register. The function lowpan_dev_debugfs_init will use "dev->name" which
> can be before register_netdevice a format string.
> The function register_netdevice will evaluate the format string if necessary
> and replace "dev->name" to the real interface name.
>
> Reported-by: Lukasz Duda <[email protected]>
> Signed-off-by: Alexander Aring <[email protected]>
> ---
> net/6lowpan/core.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c index c7f06f5..faf65ba
> 100644
> --- a/net/6lowpan/core.c
> +++ b/net/6lowpan/core.c
> @@ -29,13 +29,13 @@ int lowpan_register_netdevice(struct net_device
> *dev,
>
> lowpan_priv(dev)->lltype = lltype;
>
> - ret = lowpan_dev_debugfs_init(dev);
> + ret = register_netdevice(dev);
> if (ret < 0)
> return ret;
>
> - ret = register_netdevice(dev);
> + ret = lowpan_dev_debugfs_init(dev);
> if (ret < 0)
> - lowpan_dev_debugfs_exit(dev);
> + unregister_netdevice(dev);
>
> return ret;
> }
> --
> 2.6.1

Thanks, after this change I do have correct interface name under
/sys/kernel/debug/6lowpan for Bluetooth Low Energy (bt0).

Acked-by: Lukasz Duda <[email protected]>

Best regards,
?ukasz