Linux-WPAN Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl
@ 2021-07-07 15:56 Dongliang Mu
  2021-07-07 16:10 ` Dongliang Mu
  2021-07-07 23:34 ` Alexander Aring
  0 siblings, 2 replies; 7+ messages in thread
From: Dongliang Mu @ 2021-07-07 15:56 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, David S. Miller, Jakub Kicinski
  Cc: Dongliang Mu, Alexander Aring, linux-wpan, netdev, linux-kernel

Both MAC802154_HWSIM_ATTR_RADIO_ID and MAC802154_HWSIM_ATTR_RADIO_EDGE
must be present to fix GPF.

Fixes: f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
---
 drivers/net/ieee802154/mac802154_hwsim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
index cae52bfb871e..8caa61ec718f 100644
--- a/drivers/net/ieee802154/mac802154_hwsim.c
+++ b/drivers/net/ieee802154/mac802154_hwsim.c
@@ -418,7 +418,7 @@ static int hwsim_new_edge_nl(struct sk_buff *msg, struct genl_info *info)
 	struct hwsim_edge *e;
 	u32 v0, v1;
 
-	if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] &&
+	if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] ||
 	    !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE])
 		return -EINVAL;
 
-- 
2.25.1


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

* Re: [PATCH] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl
  2021-07-07 15:56 [PATCH] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl Dongliang Mu
@ 2021-07-07 16:10 ` Dongliang Mu
  2021-07-07 18:55   ` Alexander Aring
  2021-07-07 23:34 ` Alexander Aring
  1 sibling, 1 reply; 7+ messages in thread
From: Dongliang Mu @ 2021-07-07 16:10 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt, David S. Miller, Jakub Kicinski
  Cc: Alexander Aring, linux-wpan - ML, open list:NETWORKING [GENERAL],
	linux-kernel

On Wed, Jul 7, 2021 at 11:56 PM Dongliang Mu <mudongliangabcd@gmail.com> wrote:
>
> Both MAC802154_HWSIM_ATTR_RADIO_ID and MAC802154_HWSIM_ATTR_RADIO_EDGE
> must be present to fix GPF.

I double-check the whole file, and there is only one similar issue
left in Line 421.

 mac802154_hwsim.c      187 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID])

mac802154_hwsim.c      299 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID])

mac802154_hwsim.c      421 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] &&

mac802154_hwsim.c      483 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] ||

mac802154_hwsim.c      531 if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID]  ||

mac80211_hwsim.c      3575 if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] ||

mac80211_hwsim.c      3663 if (!info->attrs[HWSIM_ATTR_ADDR_RECEIVER] ||

mac80211_hwsim.c      3982 if (!info->attrs[HWSIM_ATTR_RADIO_ID])

In addition, I check this pattern in the whole source code, it seems
if statements with "&&" in other files are correct. For example,

        if (!info->attrs[NFC_ATTR_DEVICE_INDEX] ||
            (!info->attrs[NFC_ATTR_LLC_PARAM_LTO] &&
             !info->attrs[NFC_ATTR_LLC_PARAM_RW] &&
             !info->attrs[NFC_ATTR_LLC_PARAM_MIUX]))
                return -EINVAL;

>
> Fixes: f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> ---
>  drivers/net/ieee802154/mac802154_hwsim.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
> index cae52bfb871e..8caa61ec718f 100644
> --- a/drivers/net/ieee802154/mac802154_hwsim.c
> +++ b/drivers/net/ieee802154/mac802154_hwsim.c
> @@ -418,7 +418,7 @@ static int hwsim_new_edge_nl(struct sk_buff *msg, struct genl_info *info)
>         struct hwsim_edge *e;
>         u32 v0, v1;
>
> -       if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] &&
> +       if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID] ||
>             !info->attrs[MAC802154_HWSIM_ATTR_RADIO_EDGE])
>                 return -EINVAL;
>
> --
> 2.25.1
>

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

* Re: [PATCH] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl
  2021-07-07 16:10 ` Dongliang Mu
@ 2021-07-07 18:55   ` Alexander Aring
  2021-07-07 23:14     ` Dongliang Mu
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2021-07-07 18:55 UTC (permalink / raw)
  To: Dongliang Mu
  Cc: Stefan Schmidt, David S. Miller, Jakub Kicinski, Alexander Aring,
	linux-wpan - ML, open list:NETWORKING [GENERAL],
	linux-kernel

Hi,

On Wed, 7 Jul 2021 at 12:11, Dongliang Mu <mudongliangabcd@gmail.com> wrote:
>
> On Wed, Jul 7, 2021 at 11:56 PM Dongliang Mu <mudongliangabcd@gmail.com> wrote:
> >
> > Both MAC802154_HWSIM_ATTR_RADIO_ID and MAC802154_HWSIM_ATTR_RADIO_EDGE
> > must be present to fix GPF.
>
> I double-check the whole file, and there is only one similar issue
> left in Line 421.
>

What about "hwsim_del_edge_nl()" line 483, I think it has the same issue?

- Alex

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

* Re: [PATCH] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl
  2021-07-07 18:55   ` Alexander Aring
@ 2021-07-07 23:14     ` Dongliang Mu
  2021-07-07 23:32       ` Alexander Aring
  0 siblings, 1 reply; 7+ messages in thread
From: Dongliang Mu @ 2021-07-07 23:14 UTC (permalink / raw)
  To: Alexander Aring
  Cc: Stefan Schmidt, David S. Miller, Jakub Kicinski, Alexander Aring,
	linux-wpan - ML, open list:NETWORKING [GENERAL],
	linux-kernel

On Thu, Jul 8, 2021 at 2:55 AM Alexander Aring <alex.aring@gmail.com> wrote:
>
> Hi,
>
> On Wed, 7 Jul 2021 at 12:11, Dongliang Mu <mudongliangabcd@gmail.com> wrote:
> >
> > On Wed, Jul 7, 2021 at 11:56 PM Dongliang Mu <mudongliangabcd@gmail.com> wrote:
> > >
> > > Both MAC802154_HWSIM_ATTR_RADIO_ID and MAC802154_HWSIM_ATTR_RADIO_EDGE
> > > must be present to fix GPF.
> >
> > I double-check the whole file, and there is only one similar issue
> > left in Line 421.
> >
>
> What about "hwsim_del_edge_nl()" line 483, I think it has the same issue?

Eric already submitted a patch [1] to fix this function and the patch
is already merged in the mainline.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0303b30375dff5351a79cc2c3c87dfa4fda29bed

>
> - Alex

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

* Re: [PATCH] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl
  2021-07-07 23:14     ` Dongliang Mu
@ 2021-07-07 23:32       ` Alexander Aring
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Aring @ 2021-07-07 23:32 UTC (permalink / raw)
  To: Dongliang Mu
  Cc: Stefan Schmidt, David S. Miller, Jakub Kicinski, Alexander Aring,
	linux-wpan - ML, open list:NETWORKING [GENERAL],
	linux-kernel

Hi,

On Wed, 7 Jul 2021 at 19:15, Dongliang Mu <mudongliangabcd@gmail.com> wrote:
>
> On Thu, Jul 8, 2021 at 2:55 AM Alexander Aring <alex.aring@gmail.com> wrote:
> >
> > Hi,
> >
> > On Wed, 7 Jul 2021 at 12:11, Dongliang Mu <mudongliangabcd@gmail.com> wrote:
> > >
> > > On Wed, Jul 7, 2021 at 11:56 PM Dongliang Mu <mudongliangabcd@gmail.com> wrote:
> > > >
> > > > Both MAC802154_HWSIM_ATTR_RADIO_ID and MAC802154_HWSIM_ATTR_RADIO_EDGE
> > > > must be present to fix GPF.
> > >
> > > I double-check the whole file, and there is only one similar issue
> > > left in Line 421.
> > >
> >
> > What about "hwsim_del_edge_nl()" line 483, I think it has the same issue?
>
> Eric already submitted a patch [1] to fix this function and the patch
> is already merged in the mainline.
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0303b30375dff5351a79cc2c3c87dfa4fda29bed

ah, yes. Thanks.

- Alex

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

* Re: [PATCH] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl
  2021-07-07 15:56 [PATCH] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl Dongliang Mu
  2021-07-07 16:10 ` Dongliang Mu
@ 2021-07-07 23:34 ` Alexander Aring
  2021-07-08  7:40   ` Stefan Schmidt
  1 sibling, 1 reply; 7+ messages in thread
From: Alexander Aring @ 2021-07-07 23:34 UTC (permalink / raw)
  To: Dongliang Mu
  Cc: Stefan Schmidt, David S. Miller, Jakub Kicinski, linux-wpan - ML,
	open list:NETWORKING [GENERAL],
	kernel list

Hi,

On Wed, 7 Jul 2021 at 11:56, Dongliang Mu <mudongliangabcd@gmail.com> wrote:
>
> Both MAC802154_HWSIM_ATTR_RADIO_ID and MAC802154_HWSIM_ATTR_RADIO_EDGE
> must be present to fix GPF.
>
> Fixes: f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>

Acked-by: Alexander Aring <aahringo@redhat.com>

- Alex

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

* Re: [PATCH] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl
  2021-07-07 23:34 ` Alexander Aring
@ 2021-07-08  7:40   ` Stefan Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Schmidt @ 2021-07-08  7:40 UTC (permalink / raw)
  To: Alexander Aring, Dongliang Mu
  Cc: David S. Miller, Jakub Kicinski, linux-wpan - ML,
	open list:NETWORKING [GENERAL],
	kernel list

Hello.

On 08.07.21 01:34, Alexander Aring wrote:
> Hi,
> 
> On Wed, 7 Jul 2021 at 11:56, Dongliang Mu <mudongliangabcd@gmail.com> wrote:
>>
>> Both MAC802154_HWSIM_ATTR_RADIO_ID and MAC802154_HWSIM_ATTR_RADIO_EDGE
>> must be present to fix GPF.
>>
>> Fixes: f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb")
>> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> 
> Acked-by: Alexander Aring <aahringo@redhat.com>

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 15:56 [PATCH] ieee802154: hwsim: fix GPF in hwsim_new_edge_nl Dongliang Mu
2021-07-07 16:10 ` Dongliang Mu
2021-07-07 18:55   ` Alexander Aring
2021-07-07 23:14     ` Dongliang Mu
2021-07-07 23:32       ` Alexander Aring
2021-07-07 23:34 ` Alexander Aring
2021-07-08  7:40   ` Stefan Schmidt

Linux-WPAN Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wpan/0 linux-wpan/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wpan linux-wpan/ https://lore.kernel.org/linux-wpan \
		linux-wpan@vger.kernel.org
	public-inbox-index linux-wpan

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wpan


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git