All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 net-next] bluetooth: unregister correct BTPROTO for CMTP
@ 2023-04-04  1:52 Chenyuan Mi
  2023-04-04 15:40 ` Simon Horman
  0 siblings, 1 reply; 6+ messages in thread
From: Chenyuan Mi @ 2023-04-04  1:52 UTC (permalink / raw)
  To: isdn
  Cc: marcel, johan.hedberg, luiz.dentz, davem, edumazet, kuba, pabeni,
	netdev, linux-bluetooth, linux-kernel, michenyuan

On error unregister BTPROTO_CMTP to match the registration earlier in 
the same code-path. Without this change BTPROTO_HIDP is incorrectly 
unregistered.

This bug does not appear to cause serious security problem.

The function 'bt_sock_unregister' takes its parameter as an index and 
NULLs the corresponding element of 'bt_proto' which is an array of 
pointers. When 'bt_proto' dereferences each element, it would check 
whether the element is empty or not. Therefore, the problem of null 
pointer deference does not occur.

Found by inspection.

Fixes: 8c8de589cedd ("Bluetooth: Added /proc/net/cmtp via bt_procfs_init()")
Signed-off-by: Chenyuan Mi <michenyuan@huawei.com>
---
 net/bluetooth/cmtp/sock.c | 2 +-
 1 files changed, 1 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
index 96d49d9fae96..cf4370055ce2 100644
--- a/net/bluetooth/cmtp/sock.c
+++ b/net/bluetooth/cmtp/sock.c
@@ -250,7 +250,7 @@ int cmtp_init_sockets(void)
 	err = bt_procfs_init(&init_net, "cmtp", &cmtp_sk_list, NULL);
 	if (err < 0) {
 		BT_ERR("Failed to create CMTP proc file");
-		bt_sock_unregister(BTPROTO_HIDP);
+		bt_sock_unregister(BTPROTO_CMTP);
 		goto error;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net-next] bluetooth: unregister correct BTPROTO for CMTP
  2023-04-04  1:52 [PATCH v2 net-next] bluetooth: unregister correct BTPROTO for CMTP Chenyuan Mi
@ 2023-04-04 15:40 ` Simon Horman
  2023-04-04 18:24   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Horman @ 2023-04-04 15:40 UTC (permalink / raw)
  To: Chenyuan Mi
  Cc: isdn, marcel, johan.hedberg, luiz.dentz, davem, edumazet, kuba,
	pabeni, netdev, linux-bluetooth, linux-kernel

On Tue, Apr 04, 2023 at 09:52:58AM +0800, Chenyuan Mi wrote:
> On error unregister BTPROTO_CMTP to match the registration earlier in 
> the same code-path. Without this change BTPROTO_HIDP is incorrectly 
> unregistered.
> 
> This bug does not appear to cause serious security problem.
> 
> The function 'bt_sock_unregister' takes its parameter as an index and 
> NULLs the corresponding element of 'bt_proto' which is an array of 
> pointers. When 'bt_proto' dereferences each element, it would check 
> whether the element is empty or not. Therefore, the problem of null 
> pointer deference does not occur.
> 
> Found by inspection.
> 
> Fixes: 8c8de589cedd ("Bluetooth: Added /proc/net/cmtp via bt_procfs_init()")
> Signed-off-by: Chenyuan Mi <michenyuan@huawei.com>

Reviewed-by: Simon Horman <simon.horman@corigine.com>

> ---
>  net/bluetooth/cmtp/sock.c | 2 +-
>  1 files changed, 1 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
> index 96d49d9fae96..cf4370055ce2 100644
> --- a/net/bluetooth/cmtp/sock.c
> +++ b/net/bluetooth/cmtp/sock.c
> @@ -250,7 +250,7 @@ int cmtp_init_sockets(void)
>  	err = bt_procfs_init(&init_net, "cmtp", &cmtp_sk_list, NULL);
>  	if (err < 0) {
>  		BT_ERR("Failed to create CMTP proc file");
> -		bt_sock_unregister(BTPROTO_HIDP);
> +		bt_sock_unregister(BTPROTO_CMTP);
>  		goto error;
>  	}
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net-next] bluetooth: unregister correct BTPROTO for CMTP
  2023-04-04 15:40 ` Simon Horman
@ 2023-04-04 18:24   ` Luiz Augusto von Dentz
  2023-04-05 10:03     ` Simon Horman
  0 siblings, 1 reply; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2023-04-04 18:24 UTC (permalink / raw)
  To: Simon Horman
  Cc: Chenyuan Mi, isdn, marcel, johan.hedberg, davem, edumazet, kuba,
	pabeni, netdev, linux-bluetooth, linux-kernel

Hi,

On Tue, Apr 4, 2023 at 8:40 AM Simon Horman <simon.horman@corigine.com> wrote:
>
> On Tue, Apr 04, 2023 at 09:52:58AM +0800, Chenyuan Mi wrote:
> > On error unregister BTPROTO_CMTP to match the registration earlier in
> > the same code-path. Without this change BTPROTO_HIDP is incorrectly
> > unregistered.
> >
> > This bug does not appear to cause serious security problem.
> >
> > The function 'bt_sock_unregister' takes its parameter as an index and
> > NULLs the corresponding element of 'bt_proto' which is an array of
> > pointers. When 'bt_proto' dereferences each element, it would check
> > whether the element is empty or not. Therefore, the problem of null
> > pointer deference does not occur.
> >
> > Found by inspection.
> >
> > Fixes: 8c8de589cedd ("Bluetooth: Added /proc/net/cmtp via bt_procfs_init()")
> > Signed-off-by: Chenyuan Mi <michenyuan@huawei.com>
>
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
>
> > ---
> >  net/bluetooth/cmtp/sock.c | 2 +-
> >  1 files changed, 1 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
> > index 96d49d9fae96..cf4370055ce2 100644
> > --- a/net/bluetooth/cmtp/sock.c
> > +++ b/net/bluetooth/cmtp/sock.c
> > @@ -250,7 +250,7 @@ int cmtp_init_sockets(void)
> >       err = bt_procfs_init(&init_net, "cmtp", &cmtp_sk_list, NULL);
> >       if (err < 0) {
> >               BT_ERR("Failed to create CMTP proc file");
> > -             bt_sock_unregister(BTPROTO_HIDP);
> > +             bt_sock_unregister(BTPROTO_CMTP);
> >               goto error;
> >       }
> >
> > --
> > 2.25.1
> >

This one does not appear on pw for some reason, not sure if that was
because of subject or what, so please resubmit it, don't forget to add
Reviewed-by you got in this thread.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net-next] bluetooth: unregister correct BTPROTO for CMTP
  2023-04-04 18:24   ` Luiz Augusto von Dentz
@ 2023-04-05 10:03     ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2023-04-05 10:03 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: Chenyuan Mi, isdn, marcel, johan.hedberg, davem, edumazet, kuba,
	pabeni, netdev, linux-bluetooth, linux-kernel

On Tue, Apr 04, 2023 at 11:24:20AM -0700, Luiz Augusto von Dentz wrote:
> Hi,
> 
> On Tue, Apr 4, 2023 at 8:40 AM Simon Horman <simon.horman@corigine.com> wrote:
> >
> > On Tue, Apr 04, 2023 at 09:52:58AM +0800, Chenyuan Mi wrote:
> > > On error unregister BTPROTO_CMTP to match the registration earlier in
> > > the same code-path. Without this change BTPROTO_HIDP is incorrectly
> > > unregistered.
> > >
> > > This bug does not appear to cause serious security problem.
> > >
> > > The function 'bt_sock_unregister' takes its parameter as an index and
> > > NULLs the corresponding element of 'bt_proto' which is an array of
> > > pointers. When 'bt_proto' dereferences each element, it would check
> > > whether the element is empty or not. Therefore, the problem of null
> > > pointer deference does not occur.
> > >
> > > Found by inspection.
> > >
> > > Fixes: 8c8de589cedd ("Bluetooth: Added /proc/net/cmtp via bt_procfs_init()")
> > > Signed-off-by: Chenyuan Mi <michenyuan@huawei.com>
> >
> > Reviewed-by: Simon Horman <simon.horman@corigine.com>
> >
> > > ---
> > >  net/bluetooth/cmtp/sock.c | 2 +-
> > >  1 files changed, 1 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
> > > index 96d49d9fae96..cf4370055ce2 100644
> > > --- a/net/bluetooth/cmtp/sock.c
> > > +++ b/net/bluetooth/cmtp/sock.c
> > > @@ -250,7 +250,7 @@ int cmtp_init_sockets(void)
> > >       err = bt_procfs_init(&init_net, "cmtp", &cmtp_sk_list, NULL);
> > >       if (err < 0) {
> > >               BT_ERR("Failed to create CMTP proc file");
> > > -             bt_sock_unregister(BTPROTO_HIDP);
> > > +             bt_sock_unregister(BTPROTO_CMTP);
> > >               goto error;
> > >       }
> > >
> > > --
> > > 2.25.1
> > >
> 
> This one does not appear on pw for some reason, not sure if that was
> because of subject or what, so please resubmit it, don't forget to add
> Reviewed-by you got in this thread.

Yes, curious.

Perhaps it is due to the 'net-next' in the subject prefix.
I previously advised adding that, which I now see was
in correct as this is a Bluetooth patch. Sorry about that.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net-next] bluetooth: unregister correct BTPROTO for CMTP
@ 2023-05-10  3:56 michenyuan
  0 siblings, 0 replies; 6+ messages in thread
From: michenyuan @ 2023-05-10  3:56 UTC (permalink / raw)
  To: Simon Horman
  Cc: isdn, marcel, johan.hedberg, davem, edumazet, kuba, pabeni,
	netdev, linux-bluetooth, linux-kernel

Hi, this bug seems to have not been fixed, it still exists in the current main branch in linux kernel.
Is there anything blocking the bug fixing?

--------
On Tue, Apr 04, 2023 at 11:24:20AM -0700, Luiz Augusto von Dentz wrote:
> Hi,
> 
> On Tue, Apr 4, 2023 at 8:40 AM Simon Horman <simon.horman@corigine.com> wrote:
> >
> > On Tue, Apr 04, 2023 at 09:52:58AM +0800, Chenyuan Mi wrote:
> > > On error unregister BTPROTO_CMTP to match the registration earlier 
> > > in the same code-path. Without this change BTPROTO_HIDP is 
> > > incorrectly unregistered.
> > >
> > > This bug does not appear to cause serious security problem.
> > >
> > > The function 'bt_sock_unregister' takes its parameter as an index 
> > > and NULLs the corresponding element of 'bt_proto' which is an 
> > > array of pointers. When 'bt_proto' dereferences each element, it 
> > > would check whether the element is empty or not. Therefore, the 
> > > problem of null pointer deference does not occur.
> > >
> > > Found by inspection.
> > >
> > > Fixes: 8c8de589cedd ("Bluetooth: Added /proc/net/cmtp via 
> > > bt_procfs_init()")
> > > Signed-off-by: Chenyuan Mi <michenyuan@huawei.com>
> >
> > Reviewed-by: Simon Horman <simon.horman@corigine.com>
> >
> > > ---
> > >  net/bluetooth/cmtp/sock.c | 2 +-
> > >  1 files changed, 1 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c 
> > > index 96d49d9fae96..cf4370055ce2 100644
> > > --- a/net/bluetooth/cmtp/sock.c
> > > +++ b/net/bluetooth/cmtp/sock.c
> > > @@ -250,7 +250,7 @@ int cmtp_init_sockets(void)
> > >       err = bt_procfs_init(&init_net, "cmtp", &cmtp_sk_list, NULL);
> > >       if (err < 0) {
> > >               BT_ERR("Failed to create CMTP proc file");
> > > -             bt_sock_unregister(BTPROTO_HIDP);
> > > +             bt_sock_unregister(BTPROTO_CMTP);
> > >               goto error;
> > >       }
> > >
> > > --
> > > 2.25.1
> > >
> 
> This one does not appear on pw for some reason, not sure if that was 
> because of subject or what, so please resubmit it, don't forget to add 
> Reviewed-by you got in this thread.

Yes, curious.

Perhaps it is due to the 'net-next' in the subject prefix.
I previously advised adding that, which I now see was in correct as this is a Bluetooth patch. Sorry about that.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 net-next] bluetooth: unregister correct BTPROTO for CMTP
@ 2023-04-04  1:50 Chenyuan Mi
  0 siblings, 0 replies; 6+ messages in thread
From: Chenyuan Mi @ 2023-04-04  1:50 UTC (permalink / raw)
  To: isdn
  Cc: marcel, johan.hedberg, luiz.dentz, davem, edumazet, kuba, pabeni,
	netdev, linux-bluetooth, linux-kernel, michenyuan

This bug does not appear to cause serious security problem.

The function 'bt_sock_unregister' takes its parameter as an index and 
NULLs the corresponding element of 'bt_proto' which is an array of 
pointers. When 'bt_proto' dereferences each element, it would check 
whether the element is empty or not. Therefore, the problem of null 
pointer deference does not occur.

Found by inspection.

Fixes: 8c8de589cedd ("Bluetooth: Added /proc/net/cmtp via bt_procfs_init()")
Signed-off-by: Chenyuan Mi <michenyuan@huawei.com>
---
 net/bluetooth/cmtp/sock.c | 2 +-
 1 files changed, 1 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c
index 96d49d9fae96..cf4370055ce2 100644
--- a/net/bluetooth/cmtp/sock.c
+++ b/net/bluetooth/cmtp/sock.c
@@ -250,7 +250,7 @@ int cmtp_init_sockets(void)
 	err = bt_procfs_init(&init_net, "cmtp", &cmtp_sk_list, NULL);
 	if (err < 0) {
 		BT_ERR("Failed to create CMTP proc file");
-		bt_sock_unregister(BTPROTO_HIDP);
+		bt_sock_unregister(BTPROTO_CMTP);
 		goto error;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-10  3:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-04  1:52 [PATCH v2 net-next] bluetooth: unregister correct BTPROTO for CMTP Chenyuan Mi
2023-04-04 15:40 ` Simon Horman
2023-04-04 18:24   ` Luiz Augusto von Dentz
2023-04-05 10:03     ` Simon Horman
  -- strict thread matches above, loose matches on Subject: below --
2023-05-10  3:56 michenyuan
2023-04-04  1:50 Chenyuan Mi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.