mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: stop overreading monitor interface name
@ 2026-09-29 10:08 Amirhossein Hajimohammadi
  2026-09-29 14:12 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Amirhossein Hajimohammadi @ 2026-09-29 10:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 30 bytes --]

Patch attached as text/plain.

[-- Attachment #2: 0001-staging-rtl8723bs-stop-overreading-monitor-interface.patch --]
[-- Type: application/octet-stream, Size: 1380 bytes --]

From 3a4bea4cf2133cb8a8929be1655ce2a95d685d40 Mon Sep 17 00:00:00 2001
From: AmirHossein HajiMohammadi <info@hajimohammadi.net>
Date: Tue, 29 Sep 2026 13:05:58 +0330
Subject: [PATCH] staging: rtl8723bs: stop overreading monitor interface name
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev,
    linux-kernel@vger.kernel.org

cfg80211 passes a NUL-terminated interface name. memcpy() always reads
IFNAMSIZ + 1 bytes, even when the caller supplied a shorter string.

Use strscpy() to stop at the terminator and bound the write to the
destination buffer.

Signed-off-by: AmirHossein HajiMohammadi <info@hajimohammadi.net>
---
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 4416d0ec..8f503284 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -2158,7 +2158,7 @@ static int rtw_cfg80211_add_monitor_if(struct adapter *padapter, char *name, str
 		goto out;
 
 	*ndev = pwdev_priv->pmon_ndev = mon_ndev;
-	memcpy(pwdev_priv->ifname_mon, name, IFNAMSIZ + 1);
+	strscpy(pwdev_priv->ifname_mon, name);
 
 out:
 	if (ret && mon_wdev) {
-- 
2.39.5 (Apple Git-154)


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

* Re: [PATCH] staging: rtl8723bs: stop overreading monitor interface name
  2026-09-29 10:08 [PATCH] staging: rtl8723bs: stop overreading monitor interface name Amirhossein Hajimohammadi
@ 2026-09-29 14:12 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2026-09-29 14:12 UTC (permalink / raw)
  To: Amirhossein Hajimohammadi; +Cc: linux-staging, linux-kernel

On Tue, Sep 29, 2026 at 01:38:19PM +0330, Amirhossein Hajimohammadi wrote:
> Patch attached as text/plain.

Please do not do that, please read the documentation for how to do this
properly.

thanks,

greg k-h

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

end of thread, other threads:[~2026-09-29 19:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 10:08 [PATCH] staging: rtl8723bs: stop overreading monitor interface name Amirhossein Hajimohammadi
2026-09-29 14:12 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®