All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Alexander Aring <alex.aring@gmail.com>,
	Stefan Schmidt <stefan@datenfreihafen.org>,
	linux-wpan@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, David Girault <david.girault@qorvo.com>,
	Romuald Despres <romuald.despres@qorvo.com>,
	Frederic Blain <frederic.blain@qorvo.com>,
	Nicolas Schodet <nico@ni.fr.eu.org>,
	Guilhem Imberton <guilhem.imberton@qorvo.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH wpan v2 2/6] ieee802154: Convert scan error messages to extack
Date: Tue, 28 Feb 2023 11:08:53 +0100	[thread overview]
Message-ID: <20230228110853.28e0cc1b@xps-13> (raw)
In-Reply-To: <CANn89iLGLcQKYCTi7Vu3fm7n6v3mgeedeG4sE0MR2WG-dOWsXw@mail.gmail.com>

Hi Eric,

edumazet@google.com wrote on Mon, 27 Feb 2023 21:41:51 +0100:

> On Tue, Feb 14, 2023 at 2:50 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > Instead of printing error messages in the kernel log, let's use extack.
> > When there is a netlink error returned that could be further specified
> > with a string, use extack as well.
> >
> > Apply this logic to the very recent scan/beacon infrastructure.
> >
> > Fixes: ed3557c947e1 ("ieee802154: Add support for user scanning requests")
> > Fixes: 9bc114504b07 ("ieee802154: Add support for user beaconing requests")
> > Suggested-by: Jakub Kicinski <kuba@kernel.org>
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  net/ieee802154/nl802154.c | 19 +++++++++++++------
> >  1 file changed, 13 insertions(+), 6 deletions(-)
> >
> > diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
> > index 64fa811e1f0b..d3b6e9e80941 100644
> > --- a/net/ieee802154/nl802154.c
> > +++ b/net/ieee802154/nl802154.c
> > @@ -1407,9 +1407,15 @@ static int nl802154_trigger_scan(struct sk_buff *skb, struct genl_info *info)
> >         u8 type;
> >         int err;
> >
> > -       /* Monitors are not allowed to perform scans */
> > -       if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
> > +       if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR) {
> > +               NL_SET_ERR_MSG(info->extack, "Monitors are not allowed to perform scans");
> >                 return -EPERM;
> > +       }
> > +
> > +       if (!nla_get_u8(info->attrs[NL802154_ATTR_SCAN_TYPE])) {
> 
> syzbot crashes hosts by _not_ adding NL802154_ATTR_SCAN_TYPE attribute.

I was looking at Sanan Hasanov's e-mail, I believe this is the same
breakage that is being reported?
Link: https://lore.kernel.org/netdev/IA1PR07MB98302CDCC21F6BA664FB7298ABAF9@IA1PR07MB9830.namprd07.prod.outlook.com/

> Did you mean to write :
> 
> diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
> index 2215f576ee3788f74ea175b046d05d285bac752d..d8f4379d4fa68b5b07bb2c45cd74d4b73213c107
> 100644
> --- a/net/ieee802154/nl802154.c
> +++ b/net/ieee802154/nl802154.c
> @@ -1412,7 +1412,7 @@ static int nl802154_trigger_scan(struct sk_buff
> *skb, struct genl_info *info)
>                 return -EOPNOTSUPP;
>         }
> 
> -       if (!nla_get_u8(info->attrs[NL802154_ATTR_SCAN_TYPE])) {
> +       if (!info->attrs[NL802154_ATTR_SCAN_TYPE]) {

That is absolutely what I intended to do, I will send a fix immediately.

>                 NL_SET_ERR_MSG(info->extack, "Malformed request,
> missing scan type");
>                 return -EINVAL;
>         }
> 

Thanks a lot,
Miquèl

  reply	other threads:[~2023-02-28 10:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14 13:50 [PATCH wpan v2 0/6] ieee802154: Scan/Beacon fixes Miquel Raynal
2023-02-14 13:50 ` [PATCH wpan v2 1/6] ieee802154: Use netlink policies when relevant on scan parameters Miquel Raynal
2023-02-14 13:50 ` [PATCH wpan v2 2/6] ieee802154: Convert scan error messages to extack Miquel Raynal
2023-02-27 20:41   ` Eric Dumazet
2023-02-28 10:08     ` Miquel Raynal [this message]
2023-02-14 13:50 ` [PATCH wpan v2 3/6] ieee802154: Change error code on monitor scan netlink request Miquel Raynal
2023-02-14 13:50 ` [PATCH wpan v2 4/6] mac802154: Send beacons using the MLME Tx path Miquel Raynal
2023-02-14 13:50 ` [PATCH wpan v2 5/6] mac802154: Fix an always true condition Miquel Raynal
2023-02-14 13:50 ` [PATCH wpan v2 6/6] ieee802154: Drop device trackers Miquel Raynal
2023-02-17  9:10 ` [PATCH wpan v2 0/6] ieee802154: Scan/Beacon fixes Miquel Raynal
2023-02-18 17:20   ` Stefan Schmidt
2023-02-18 20:04     ` Miquel Raynal
2023-02-20 17:59     ` Jakub Kicinski
2023-02-20 19:15       ` Stefan Schmidt
2023-02-20 19:14 ` Stefan Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230228110853.28e0cc1b@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=david.girault@qorvo.com \
    --cc=edumazet@google.com \
    --cc=frederic.blain@qorvo.com \
    --cc=guilhem.imberton@qorvo.com \
    --cc=kuba@kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nico@ni.fr.eu.org \
    --cc=pabeni@redhat.com \
    --cc=romuald.despres@qorvo.com \
    --cc=stefan@datenfreihafen.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.