Linux wireless drivers development
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Dan Williams <dcbw@redhat.com>,
	Brian Norris <briannorris@chromium.org>,
	Kalle Valo <kvalo@kernel.org>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	linux-hardening@vger.kernel.org
Subject: Re: [RFC] wifi: mwifiex: Asking for some light on this, please :)
Date: Thu, 24 Aug 2023 21:16:58 -0600	[thread overview]
Message-ID: <fd700d21-aed7-ded0-1841-732aca570ef0@embeddedor.com> (raw)
In-Reply-To: <8e54e07eb0505302d601fd923e6cf0af0d60ff82.camel@redhat.com>



> Make the mwifiex_dbg() into a warning though. This is an error
> condition and shouldn't be hidden.
> 
>>                   mwifiex_dbg(priv->adapter, INFO,
>>                               "%pM tid=%d seq_num=%d bitmap_len=%d\n",
>>                               tlv_rxba->mac, tlv_rxba->tid, tlv_seq_num,
>>
>> I wanted to used `sizeof(*tlv_rxba) + tlv_bitmap_len` here instead of
>> `sizeof(tlv_rxba->header) + tlv_len` to avoid any issues in case there
>> is any (buggy) discrepancy between `tlv_len` and `tlv_bitmap_len`.
>> This is when for some (weird) reason
>>          `tlv_len - (sizeof(*tlv_rxba) - sizeof(tlv_rxba->header)) != tlv_bitmap_len`
> 
> tlv_len absolutely should also be checked. But you don't need that
> condition, just do the same thing right after tlv_len is retrieved from
> the header:
> 
> if (sizeof(tlv_rxba->header) + tlv_len > tlv_buf_left) {
>      <warn>
>      return;
> }
> 

Thanks for all the feedback, Dan:

https://lore.kernel.org/linux-hardening/cover.1692931954.git.gustavoars@kernel.org/

--
Gustavo

      reply	other threads:[~2023-08-25  3:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16  0:52 [RFC] wifi: mwifiex: Asking for some light on this, please :) Gustavo A. R. Silva
2023-08-16  1:06 ` Gustavo A. R. Silva
2023-08-22 17:00 ` Dan Williams
2023-08-22 19:23   ` Gustavo A. R. Silva
2023-08-23 14:31     ` Dan Williams
2023-08-25  3:16       ` Gustavo A. R. Silva [this message]

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=fd700d21-aed7-ded0-1841-732aca570ef0@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=briannorris@chromium.org \
    --cc=dcbw@redhat.com \
    --cc=gustavoars@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@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