From: karthek <mail@karthek.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: wlan-ng/p80211 : check userspacebuf size for sanity
Date: Mon, 22 Feb 2021 19:12:22 +0530 [thread overview]
Message-ID: <YDO0vtJyyGSSi44n@karthik-strix-linux.karthek.com> (raw)
In-Reply-To: <20210222132132.GU2222@kadam>
On Mon, Feb 22, 2021 at 04:21:33PM +0300, Dan Carpenter wrote:
> On Mon, Feb 22, 2021 at 06:16:24PM +0530, karthek wrote:
> > currently p80211knetdev_do_ioctl() is testing user passed
> > struct ifreq for sanity by checking for presence of a magic number,
> > in addition to that also check size field, preventing buffer overflow
> > before passing data to p80211req_dorequest() which casts it
> > to *struct p80211msg
> >
> > Signed-off-by: karthek <mail@karthek.com>
> > ---
> > is this correct?
> > is it necessary to check for size in addition to magicnum?
> > did i even understand the problem correctly?
> >
> > drivers/staging/wlan-ng/p80211netdev.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
> > index 70570e8a5..c7b78d870 100644
> > --- a/drivers/staging/wlan-ng/p80211netdev.c
> > +++ b/drivers/staging/wlan-ng/p80211netdev.c
> > @@ -568,7 +568,10 @@ static int p80211knetdev_do_ioctl(struct net_device *dev,
> > result = -EINVAL;
> > goto bail;
> > }
> > -
> > + if (req->len < sizeof(struct p80211msg)) {
> > + result = -EINVAL;
> > + goto bail;
> > + }
>
> Please don't send private emails. Always CC the list.
sorry
>
> That's only a partial solution. You need to check in p80211req_handlemsg()
> as well and probably other places.
currently p80211req_handlemsg() is only referenced in p80211req_dorequest()
can we check that there instead?
>
> regards,
> dan carpenter
>
next parent reply other threads:[~2021-02-22 14:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <YDOnoLJzHYXMZBA/@karthik-strix-linux.karthek.com>
[not found] ` <20210222132132.GU2222@kadam>
2021-02-22 13:42 ` karthek [this message]
2021-02-22 13:59 ` [PATCH] staging: wlan-ng/p80211 : check userspacebuf size for sanity Dan Carpenter
2021-02-22 15:13 ` karthek
2021-02-22 16:46 ` karthek
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=YDO0vtJyyGSSi44n@karthik-strix-linux.karthek.com \
--to=mail@karthek.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox