From: Jérôme Pouiller Date: Wed, 1 Apr 2020 11:03:34 +0000 (+0200) Subject: staging: wfx: add sanity checks to hif_join() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a6bdff3f627bbb116c63f4b8464345af84d68ce8;p=linux.git staging: wfx: add sanity checks to hif_join() Add a few check on start of hif_join(). Reviewed-by: Dan Carpenter Signed-off-by: Jérôme Pouiller Link: https://lore.kernel.org/r/20200401110405.80282-2-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 77bca43aca428..445906035e9d3 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -297,6 +297,8 @@ int hif_join(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf, struct hif_req_join *body = wfx_alloc_hif(sizeof(*body), &hif); WARN_ON(!conf->basic_rates); + WARN_ON(sizeof(body->ssid) < ssidlen); + WARN(!conf->ibss_joined && !ssidlen, "joining an unknown BSS"); body->infrastructure_bss_mode = !conf->ibss_joined; body->short_preamble = conf->use_short_preamble; if (channel && channel->flags & IEEE80211_CHAN_NO_IR)