linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: mac802154: Fix a condition in the receive path
@ 2022-08-26 14:29 Miquel Raynal
  2022-08-29  0:16 ` Alexander Aring
  2022-08-29  8:52 ` Stefan Schmidt
  0 siblings, 2 replies; 7+ messages in thread
From: Miquel Raynal @ 2022-08-26 14:29 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, linux-wpan
  Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	netdev, David Girault, Romuald Despres, Frederic Blain,
	Nicolas Schodet, Thomas Petazzoni, Miquel Raynal, stable

Upon reception, a packet must be categorized, either it's destination is
the host, or it is another host. A packet with no destination addressing
fields may be valid in two situations:
- the packet has no source field: only ACKs are built like that, we
  consider the host as the destination.
- the packet has a valid source field: it is directed to the PAN
  coordinator, as for know we don't have this information we consider we
  are not the PAN coordinator.

There was likely a copy/paste error made during a previous cleanup
because the if clause is now containing exactly the same condition as in
the switch case, which can never be true. In the past the destination
address was used in the switch and the source address was used in the
if, which matches what the spec says.

Cc: stable@vger.kernel.org
Fixes: ae531b9475f6 ("ieee802154: use ieee802154_addr instead of *_sa variants")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 net/mac802154/rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
index b8ce84618a55..c439125ef2b9 100644
--- a/net/mac802154/rx.c
+++ b/net/mac802154/rx.c
@@ -44,7 +44,7 @@ ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,
 
 	switch (mac_cb(skb)->dest.mode) {
 	case IEEE802154_ADDR_NONE:
-		if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE)
+		if (hdr->source.mode != IEEE802154_ADDR_NONE)
 			/* FIXME: check if we are PAN coordinator */
 			skb->pkt_type = PACKET_OTHERHOST;
 		else
-- 
2.34.1


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

* Re: [PATCH] net: mac802154: Fix a condition in the receive path
  2022-08-26 14:29 [PATCH] net: mac802154: Fix a condition in the receive path Miquel Raynal
@ 2022-08-29  0:16 ` Alexander Aring
  2022-08-29  5:28   ` Greg KH
  2022-08-29  8:52 ` Stefan Schmidt
  1 sibling, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2022-08-29  0:16 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Alexander Aring, Stefan Schmidt, linux-wpan - ML,
	David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	Network Development, David Girault, Romuald Despres,
	Frederic Blain, Nicolas Schodet, Thomas Petazzoni, stable

Hi,

On Fri, Aug 26, 2022 at 10:31 AM Miquel Raynal
<miquel.raynal@bootlin.com> wrote:
>
> Upon reception, a packet must be categorized, either it's destination is
> the host, or it is another host. A packet with no destination addressing
> fields may be valid in two situations:
> - the packet has no source field: only ACKs are built like that, we
>   consider the host as the destination.
> - the packet has a valid source field: it is directed to the PAN
>   coordinator, as for know we don't have this information we consider we
>   are not the PAN coordinator.
>
> There was likely a copy/paste error made during a previous cleanup
> because the if clause is now containing exactly the same condition as in
> the switch case, which can never be true. In the past the destination
> address was used in the switch and the source address was used in the
> if, which matches what the spec says.
>
> Cc: stable@vger.kernel.org
> Fixes: ae531b9475f6 ("ieee802154: use ieee802154_addr instead of *_sa variants")
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  net/mac802154/rx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
> index b8ce84618a55..c439125ef2b9 100644
> --- a/net/mac802154/rx.c
> +++ b/net/mac802154/rx.c
> @@ -44,7 +44,7 @@ ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,
>
>         switch (mac_cb(skb)->dest.mode) {
>         case IEEE802154_ADDR_NONE:
> -               if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE)
> +               if (hdr->source.mode != IEEE802154_ADDR_NONE)
>                         /* FIXME: check if we are PAN coordinator */
>                         skb->pkt_type = PACKET_OTHERHOST;
>                 else


This patch looks okay but it should not be addressed to stable. Leave
of course the fixes tag.

Wpan sends pull requests to net and they have their own way to get
into the stable tree when they are in net.

Thanks.

- Alex


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

* Re: [PATCH] net: mac802154: Fix a condition in the receive path
  2022-08-29  0:16 ` Alexander Aring
@ 2022-08-29  5:28   ` Greg KH
  2022-08-29  8:38     ` Stefan Schmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2022-08-29  5:28 UTC (permalink / raw)
  To: Alexander Aring
  Cc: Miquel Raynal, Alexander Aring, Stefan Schmidt, linux-wpan - ML,
	David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	Network Development, David Girault, Romuald Despres,
	Frederic Blain, Nicolas Schodet, Thomas Petazzoni, stable

On Sun, Aug 28, 2022 at 08:16:20PM -0400, Alexander Aring wrote:
> Hi,
> 
> On Fri, Aug 26, 2022 at 10:31 AM Miquel Raynal
> <miquel.raynal@bootlin.com> wrote:
> >
> > Upon reception, a packet must be categorized, either it's destination is
> > the host, or it is another host. A packet with no destination addressing
> > fields may be valid in two situations:
> > - the packet has no source field: only ACKs are built like that, we
> >   consider the host as the destination.
> > - the packet has a valid source field: it is directed to the PAN
> >   coordinator, as for know we don't have this information we consider we
> >   are not the PAN coordinator.
> >
> > There was likely a copy/paste error made during a previous cleanup
> > because the if clause is now containing exactly the same condition as in
> > the switch case, which can never be true. In the past the destination
> > address was used in the switch and the source address was used in the
> > if, which matches what the spec says.
> >
> > Cc: stable@vger.kernel.org
> > Fixes: ae531b9475f6 ("ieee802154: use ieee802154_addr instead of *_sa variants")
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  net/mac802154/rx.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
> > index b8ce84618a55..c439125ef2b9 100644
> > --- a/net/mac802154/rx.c
> > +++ b/net/mac802154/rx.c
> > @@ -44,7 +44,7 @@ ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,
> >
> >         switch (mac_cb(skb)->dest.mode) {
> >         case IEEE802154_ADDR_NONE:
> > -               if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE)
> > +               if (hdr->source.mode != IEEE802154_ADDR_NONE)
> >                         /* FIXME: check if we are PAN coordinator */
> >                         skb->pkt_type = PACKET_OTHERHOST;
> >                 else
> 
> 
> This patch looks okay but it should not be addressed to stable. Leave
> of course the fixes tag.

Why do that?  Do you not want this in the stable tree?

> Wpan sends pull requests to net and they have their own way to get
> into the stable tree when they are in net.

No, the normal method has been used for quite a while now.

Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

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

* Re: [PATCH] net: mac802154: Fix a condition in the receive path
  2022-08-29  5:28   ` Greg KH
@ 2022-08-29  8:38     ` Stefan Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Schmidt @ 2022-08-29  8:38 UTC (permalink / raw)
  To: Greg KH, Alexander Aring
  Cc: Miquel Raynal, Alexander Aring, linux-wpan - ML, David S. Miller,
	Jakub Kicinski, Paolo Abeni, Eric Dumazet, Network Development,
	David Girault, Romuald Despres, Frederic Blain, Nicolas Schodet,
	Thomas Petazzoni, stable


Hello Greg.

On 29.08.22 07:28, Greg KH wrote:
> On Sun, Aug 28, 2022 at 08:16:20PM -0400, Alexander Aring wrote:
>> Hi,
>>
>> On Fri, Aug 26, 2022 at 10:31 AM Miquel Raynal
>> <miquel.raynal@bootlin.com> wrote:
>>>
>>> Upon reception, a packet must be categorized, either it's destination is
>>> the host, or it is another host. A packet with no destination addressing
>>> fields may be valid in two situations:
>>> - the packet has no source field: only ACKs are built like that, we
>>>    consider the host as the destination.
>>> - the packet has a valid source field: it is directed to the PAN
>>>    coordinator, as for know we don't have this information we consider we
>>>    are not the PAN coordinator.
>>>
>>> There was likely a copy/paste error made during a previous cleanup
>>> because the if clause is now containing exactly the same condition as in
>>> the switch case, which can never be true. In the past the destination
>>> address was used in the switch and the source address was used in the
>>> if, which matches what the spec says.
>>>
>>> Cc: stable@vger.kernel.org
>>> Fixes: ae531b9475f6 ("ieee802154: use ieee802154_addr instead of *_sa variants")
>>> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
>>> ---
>>>   net/mac802154/rx.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
>>> index b8ce84618a55..c439125ef2b9 100644
>>> --- a/net/mac802154/rx.c
>>> +++ b/net/mac802154/rx.c
>>> @@ -44,7 +44,7 @@ ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,
>>>
>>>          switch (mac_cb(skb)->dest.mode) {
>>>          case IEEE802154_ADDR_NONE:
>>> -               if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE)
>>> +               if (hdr->source.mode != IEEE802154_ADDR_NONE)
>>>                          /* FIXME: check if we are PAN coordinator */
>>>                          skb->pkt_type = PACKET_OTHERHOST;
>>>                  else
>>
>>
>> This patch looks okay but it should not be addressed to stable. Leave
>> of course the fixes tag.
> 
> Why do that?  Do you not want this in the stable tree?

We want and we will leave the cc to stable in place, see below.

>> Wpan sends pull requests to net and they have their own way to get
>> into the stable tree when they are in net.
> 
> No, the normal method has been used for quite a while now.

I think Alex was refering to the times where netdev core changes have 
been brought to stable via a different route by DaveM.

This was never the case for ieee802154 though. We are such a small 
subsystem with little traffic that we followed the normal stable process 
and our patches ahve always been picked up by Sasha and the bots.

I will take this through my tree with stable cc and fixes tag preserved 
and it will go to Linux via net and follow the normal process.

regards
Stefan Schmidt

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

* Re: [PATCH] net: mac802154: Fix a condition in the receive path
  2022-08-26 14:29 [PATCH] net: mac802154: Fix a condition in the receive path Miquel Raynal
  2022-08-29  0:16 ` Alexander Aring
@ 2022-08-29  8:52 ` Stefan Schmidt
  2022-08-29  9:01   ` Miquel Raynal
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Schmidt @ 2022-08-29  8:52 UTC (permalink / raw)
  To: Miquel Raynal, Alexander Aring, linux-wpan
  Cc: David S. Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
	netdev, David Girault, Romuald Despres, Frederic Blain,
	Nicolas Schodet, Thomas Petazzoni, stable


Hello Miquel.

On 26.08.22 16:29, Miquel Raynal wrote:
> Upon reception, a packet must be categorized, either it's destination is
> the host, or it is another host. A packet with no destination addressing
> fields may be valid in two situations:
> - the packet has no source field: only ACKs are built like that, we
>    consider the host as the destination.
> - the packet has a valid source field: it is directed to the PAN
>    coordinator, as for know we don't have this information we consider we
>    are not the PAN coordinator.
> 
> There was likely a copy/paste error made during a previous cleanup
> because the if clause is now containing exactly the same condition as in
> the switch case, which can never be true. In the past the destination
> address was used in the switch and the source address was used in the
> if, which matches what the spec says.
> 
> Cc: stable@vger.kernel.org
> Fixes: ae531b9475f6 ("ieee802154: use ieee802154_addr instead of *_sa variants")
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>   net/mac802154/rx.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
> index b8ce84618a55..c439125ef2b9 100644
> --- a/net/mac802154/rx.c
> +++ b/net/mac802154/rx.c
> @@ -44,7 +44,7 @@ ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,
>   
>   	switch (mac_cb(skb)->dest.mode) {
>   	case IEEE802154_ADDR_NONE:
> -		if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE)
> +		if (hdr->source.mode != IEEE802154_ADDR_NONE)
>   			/* FIXME: check if we are PAN coordinator */
>   			skb->pkt_type = PACKET_OTHERHOST;
>   		else


This patch has been applied to the wpan tree and will be
part of the next pull request to net. Thanks!

regards
Stefan Schmidt

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

* Re: [PATCH] net: mac802154: Fix a condition in the receive path
  2022-08-29  8:52 ` Stefan Schmidt
@ 2022-08-29  9:01   ` Miquel Raynal
  2022-08-29  9:04     ` Stefan Schmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Miquel Raynal @ 2022-08-29  9:01 UTC (permalink / raw)
  To: Stefan Schmidt
  Cc: Alexander Aring, linux-wpan, David S. Miller, Jakub Kicinski,
	Paolo Abeni, Eric Dumazet, netdev, David Girault,
	Romuald Despres, Frederic Blain, Nicolas Schodet,
	Thomas Petazzoni, stable

Hi Stefan,

stefan@datenfreihafen.org wrote on Mon, 29 Aug 2022 10:52:52 +0200:

> Hello Miquel.
> 
> On 26.08.22 16:29, Miquel Raynal wrote:
> > Upon reception, a packet must be categorized, either it's destination is
> > the host, or it is another host. A packet with no destination addressing
> > fields may be valid in two situations:
> > - the packet has no source field: only ACKs are built like that, we
> >    consider the host as the destination.
> > - the packet has a valid source field: it is directed to the PAN
> >    coordinator, as for know we don't have this information we consider we
> >    are not the PAN coordinator.
> > 
> > There was likely a copy/paste error made during a previous cleanup
> > because the if clause is now containing exactly the same condition as in
> > the switch case, which can never be true. In the past the destination
> > address was used in the switch and the source address was used in the
> > if, which matches what the spec says.
> > 
> > Cc: stable@vger.kernel.org
> > Fixes: ae531b9475f6 ("ieee802154: use ieee802154_addr instead of *_sa variants")
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >   net/mac802154/rx.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
> > index b8ce84618a55..c439125ef2b9 100644
> > --- a/net/mac802154/rx.c
> > +++ b/net/mac802154/rx.c
> > @@ -44,7 +44,7 @@ ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,  
> >   >   	switch (mac_cb(skb)->dest.mode) {  
> >   	case IEEE802154_ADDR_NONE:
> > -		if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE)
> > +		if (hdr->source.mode != IEEE802154_ADDR_NONE)
> >   			/* FIXME: check if we are PAN coordinator */
> >   			skb->pkt_type = PACKET_OTHERHOST;
> >   		else  
> 
> 
> This patch has been applied to the wpan tree and will be
> part of the next pull request to net. Thanks!

Great, thanks!

We should expect it not to apply until the tag mentioned in Fixes
because in 2015 or so there was some cleaned done by Alexander which
move things around a little bit, but I think we are fine skipping those
older releases anyway.

Thanks,
Miquèl

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

* Re: [PATCH] net: mac802154: Fix a condition in the receive path
  2022-08-29  9:01   ` Miquel Raynal
@ 2022-08-29  9:04     ` Stefan Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Schmidt @ 2022-08-29  9:04 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Alexander Aring, linux-wpan, David S. Miller, Jakub Kicinski,
	Paolo Abeni, Eric Dumazet, netdev, David Girault,
	Romuald Despres, Frederic Blain, Nicolas Schodet,
	Thomas Petazzoni, stable

Hello Miquel

On 29.08.22 11:01, Miquel Raynal wrote:
> Hi Stefan,
> 
> stefan@datenfreihafen.org wrote on Mon, 29 Aug 2022 10:52:52 +0200:
> 
>> Hello Miquel.
>>
>> On 26.08.22 16:29, Miquel Raynal wrote:
>>> Upon reception, a packet must be categorized, either it's destination is
>>> the host, or it is another host. A packet with no destination addressing
>>> fields may be valid in two situations:
>>> - the packet has no source field: only ACKs are built like that, we
>>>     consider the host as the destination.
>>> - the packet has a valid source field: it is directed to the PAN
>>>     coordinator, as for know we don't have this information we consider we
>>>     are not the PAN coordinator.
>>>
>>> There was likely a copy/paste error made during a previous cleanup
>>> because the if clause is now containing exactly the same condition as in
>>> the switch case, which can never be true. In the past the destination
>>> address was used in the switch and the source address was used in the
>>> if, which matches what the spec says.
>>>
>>> Cc: stable@vger.kernel.org
>>> Fixes: ae531b9475f6 ("ieee802154: use ieee802154_addr instead of *_sa variants")
>>> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
>>> ---
>>>    net/mac802154/rx.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c
>>> index b8ce84618a55..c439125ef2b9 100644
>>> --- a/net/mac802154/rx.c
>>> +++ b/net/mac802154/rx.c
>>> @@ -44,7 +44,7 @@ ieee802154_subif_frame(struct ieee802154_sub_if_data *sdata,
>>>    >   	switch (mac_cb(skb)->dest.mode) {
>>>    	case IEEE802154_ADDR_NONE:
>>> -		if (mac_cb(skb)->dest.mode != IEEE802154_ADDR_NONE)
>>> +		if (hdr->source.mode != IEEE802154_ADDR_NONE)
>>>    			/* FIXME: check if we are PAN coordinator */
>>>    			skb->pkt_type = PACKET_OTHERHOST;
>>>    		else
>>
>>
>> This patch has been applied to the wpan tree and will be
>> part of the next pull request to net. Thanks!
> 
> Great, thanks!
> 
> We should expect it not to apply until the tag mentioned in Fixes
> because in 2015 or so there was some cleaned done by Alexander which
> move things around a little bit, but I think we are fine skipping those
> older releases anyway.

The machinery behind stable handles this already. It checks for the 
fixes tag and also sees if patches apply.

regards
Stefan Schmidt

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

end of thread, other threads:[~2022-08-29  9:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 14:29 [PATCH] net: mac802154: Fix a condition in the receive path Miquel Raynal
2022-08-29  0:16 ` Alexander Aring
2022-08-29  5:28   ` Greg KH
2022-08-29  8:38     ` Stefan Schmidt
2022-08-29  8:52 ` Stefan Schmidt
2022-08-29  9:01   ` Miquel Raynal
2022-08-29  9:04     ` Stefan Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).