All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] wifi: wireless: fix two more possible UBSAN-detected off-by-one errors
@ 2024-09-09  8:23 Dmitry Antipov
  2024-09-09  9:01 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Antipov @ 2024-09-09  8:23 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Kalle Valo, linux-wireless, Kees Cook, linux-hardening,
	lvc-project, Dmitry Antipov

Although not reproduced in practice, these two cases may be
considered by UBSAN as off-by-one errors. So fix them in the
same way as in commit a26a5107bc52 ("wifi: cfg80211: fix UBSAN
noise in cfg80211_wext_siwscan()").

Fixes: 807f8a8c3004 ("cfg80211/nl80211: add support for scheduled scans")
Fixes: 5ba63533bbf6 ("cfg80211: fix alignment problem in scan request")
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 net/wireless/nl80211.c | 3 ++-
 net/wireless/sme.c     | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 8bad3c6db39d..9ab777e0bd4d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -9778,7 +9778,8 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev,
 		return ERR_PTR(-ENOMEM);
 
 	if (n_ssids)
-		request->ssids = (void *)&request->channels[n_channels];
+		request->ssids = (void *)request +
+			struct_size(request, channels, n_channels);
 	request->n_ssids = n_ssids;
 	if (ie_len) {
 		if (n_ssids)
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index d9d7bf8bb5c1..431da30817a6 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -115,7 +115,8 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
 		n_channels = i;
 	}
 	request->n_channels = n_channels;
-	request->ssids = (void *)&request->channels[n_channels];
+	request->ssids = (void *)request +
+		struct_size(request, channels, n_channels);
 	request->n_ssids = 1;
 
 	memcpy(request->ssids[0].ssid, wdev->conn->params.ssid,
-- 
2.46.0


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

* Re: [PATCH] wifi: wireless: fix two more possible UBSAN-detected off-by-one errors
  2024-09-09  8:23 [PATCH] wifi: wireless: fix two more possible UBSAN-detected off-by-one errors Dmitry Antipov
@ 2024-09-09  9:01 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2024-09-09  9:01 UTC (permalink / raw)
  To: Dmitry Antipov
  Cc: Johannes Berg, linux-wireless, Kees Cook, linux-hardening,
	lvc-project

Dmitry Antipov <dmantipov@yandex.ru> writes:

> Although not reproduced in practice, these two cases may be
> considered by UBSAN as off-by-one errors. So fix them in the
> same way as in commit a26a5107bc52 ("wifi: cfg80211: fix UBSAN
> noise in cfg80211_wext_siwscan()").
>
> Fixes: 807f8a8c3004 ("cfg80211/nl80211: add support for scheduled scans")
> Fixes: 5ba63533bbf6 ("cfg80211: fix alignment problem in scan request")
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>

The title prefix should be "wifi: cfg80211:", not sure if Johannes can
fix that or not.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

end of thread, other threads:[~2024-09-09  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-09  8:23 [PATCH] wifi: wireless: fix two more possible UBSAN-detected off-by-one errors Dmitry Antipov
2024-09-09  9:01 ` Kalle Valo

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.