patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Shigeru Yoshida <syoshida@redhat.com>,
	Jiri Pirko <jiri@nvidia.com>, Jakub Kicinski <kuba@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	syzbot+5138ca807af9d2b42574@syzkaller.appspotmail.com,
	syzbot+9425c47dccbcb4c17d51@syzkaller.appspotmail.com
Subject: [PATCH 4.19 73/88] tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING
Date: Wed, 15 Nov 2023 15:36:25 -0500	[thread overview]
Message-ID: <20231115191430.482252154@linuxfoundation.org> (raw)
In-Reply-To: <20231115191426.221330369@linuxfoundation.org>

4.19-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Shigeru Yoshida <syoshida@redhat.com>

[ Upstream commit 19b3f72a41a8751e26bffc093bb7e1cef29ad579 ]

syzbot reported the following uninit-value access issue [1]:

=====================================================
BUG: KMSAN: uninit-value in strlen lib/string.c:418 [inline]
BUG: KMSAN: uninit-value in strstr+0xb8/0x2f0 lib/string.c:756
 strlen lib/string.c:418 [inline]
 strstr+0xb8/0x2f0 lib/string.c:756
 tipc_nl_node_reset_link_stats+0x3ea/0xb50 net/tipc/node.c:2595
 genl_family_rcv_msg_doit net/netlink/genetlink.c:971 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:1051 [inline]
 genl_rcv_msg+0x11ec/0x1290 net/netlink/genetlink.c:1066
 netlink_rcv_skb+0x371/0x650 net/netlink/af_netlink.c:2545
 genl_rcv+0x40/0x60 net/netlink/genetlink.c:1075
 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
 netlink_unicast+0xf47/0x1250 net/netlink/af_netlink.c:1368
 netlink_sendmsg+0x1238/0x13d0 net/netlink/af_netlink.c:1910
 sock_sendmsg_nosec net/socket.c:730 [inline]
 sock_sendmsg net/socket.c:753 [inline]
 ____sys_sendmsg+0x9c2/0xd60 net/socket.c:2541
 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2595
 __sys_sendmsg net/socket.c:2624 [inline]
 __do_sys_sendmsg net/socket.c:2633 [inline]
 __se_sys_sendmsg net/socket.c:2631 [inline]
 __x64_sys_sendmsg+0x307/0x490 net/socket.c:2631
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Uninit was created at:
 slab_post_alloc_hook+0x12f/0xb70 mm/slab.h:767
 slab_alloc_node mm/slub.c:3478 [inline]
 kmem_cache_alloc_node+0x577/0xa80 mm/slub.c:3523
 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:559
 __alloc_skb+0x318/0x740 net/core/skbuff.c:650
 alloc_skb include/linux/skbuff.h:1286 [inline]
 netlink_alloc_large_skb net/netlink/af_netlink.c:1214 [inline]
 netlink_sendmsg+0xb34/0x13d0 net/netlink/af_netlink.c:1885
 sock_sendmsg_nosec net/socket.c:730 [inline]
 sock_sendmsg net/socket.c:753 [inline]
 ____sys_sendmsg+0x9c2/0xd60 net/socket.c:2541
 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2595
 __sys_sendmsg net/socket.c:2624 [inline]
 __do_sys_sendmsg net/socket.c:2633 [inline]
 __se_sys_sendmsg net/socket.c:2631 [inline]
 __x64_sys_sendmsg+0x307/0x490 net/socket.c:2631
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

TIPC bearer-related names including link names must be null-terminated
strings. If a link name which is not null-terminated is passed through
netlink, strstr() and similar functions can cause buffer overrun. This
causes the above issue.

This patch changes the nla_policy for bearer-related names from NLA_STRING
to NLA_NUL_STRING. This resolves the issue by ensuring that only
null-terminated strings are accepted as bearer-related names.

syzbot reported similar uninit-value issue related to bearer names [2]. The
root cause of this issue is that a non-null-terminated bearer name was
passed. This patch also resolved this issue.

Fixes: 7be57fc69184 ("tipc: add link get/dump to new netlink api")
Fixes: 0655f6a8635b ("tipc: add bearer disable/enable to new netlink api")
Reported-and-tested-by: syzbot+5138ca807af9d2b42574@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=5138ca807af9d2b42574 [1]
Reported-and-tested-by: syzbot+9425c47dccbcb4c17d51@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=9425c47dccbcb4c17d51 [2]
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20231030075540.3784537-1-syoshida@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/tipc/netlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c
index 9b36163d951eb..bf11d57ef3aea 100644
--- a/net/tipc/netlink.c
+++ b/net/tipc/netlink.c
@@ -87,7 +87,7 @@ const struct nla_policy tipc_nl_net_policy[TIPC_NLA_NET_MAX + 1] = {
 
 const struct nla_policy tipc_nl_link_policy[TIPC_NLA_LINK_MAX + 1] = {
 	[TIPC_NLA_LINK_UNSPEC]		= { .type = NLA_UNSPEC },
-	[TIPC_NLA_LINK_NAME]		= { .type = NLA_STRING,
+	[TIPC_NLA_LINK_NAME]		= { .type = NLA_NUL_STRING,
 					    .len = TIPC_MAX_LINK_NAME },
 	[TIPC_NLA_LINK_MTU]		= { .type = NLA_U32 },
 	[TIPC_NLA_LINK_BROADCAST]	= { .type = NLA_FLAG },
@@ -116,7 +116,7 @@ const struct nla_policy tipc_nl_prop_policy[TIPC_NLA_PROP_MAX + 1] = {
 
 const struct nla_policy tipc_nl_bearer_policy[TIPC_NLA_BEARER_MAX + 1]	= {
 	[TIPC_NLA_BEARER_UNSPEC]	= { .type = NLA_UNSPEC },
-	[TIPC_NLA_BEARER_NAME]		= { .type = NLA_STRING,
+	[TIPC_NLA_BEARER_NAME]		= { .type = NLA_NUL_STRING,
 					    .len = TIPC_MAX_BEARER_NAME },
 	[TIPC_NLA_BEARER_PROP]		= { .type = NLA_NESTED },
 	[TIPC_NLA_BEARER_DOMAIN]	= { .type = NLA_U32 }
-- 
2.42.0




  parent reply	other threads:[~2023-11-15 20:45 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 20:35 [PATCH 4.19 00/88] 4.19.299-rc1 review Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 01/88] vfs: fix readahead(2) on block devices Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 02/88] genirq/matrix: Exclude managed interrupts in irq_matrix_allocated() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 03/88] i40e: fix potential memory leaks in i40e_remove() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 04/88] tcp_metrics: add missing barriers on delete Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 05/88] tcp_metrics: properly set tp->snd_ssthresh in tcp_init_metrics() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 06/88] tcp_metrics: do not create an entry from tcp_init_metrics() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 07/88] wifi: rtlwifi: fix EDCA limit set by BT coexistence Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 08/88] can: dev: move driver related infrastructure into separate subdir Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 09/88] can: dev: can_restart(): dont crash kernel if carrier is OK Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 10/88] can: dev: can_restart(): fix race condition between controller restart and netif_carrier_on() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 11/88] thermal: core: prevent potential string overflow Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 12/88] chtls: fix tp->rcv_tstamp initialization Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 13/88] ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 14/88] ipv6: avoid atomic fragment on GSO packets Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 15/88] macsec: Fix traffic counters/statistics Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 16/88] macsec: use DEV_STATS_INC() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 17/88] net: add DEV_STATS_READ() helper Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 18/88] ipvlan: properly track tx_errors Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 19/88] regmap: debugfs: Fix a erroneous check after snprintf() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 20/88] clk: qcom: clk-rcg2: Fix clock rate overflow for high parent frequencies Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 21/88] clk: keystone: pll: fix a couple NULL vs IS_ERR() checks Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 22/88] clk: npcm7xx: Fix incorrect kfree Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 23/88] clk: mediatek: clk-mt6797: Add check for mtk_alloc_clk_data Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 24/88] clk: mediatek: clk-mt2701: " Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 25/88] platform/x86: wmi: Fix probe failure when failing to register WMI devices Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 26/88] platform/x86: wmi: remove unnecessary initializations Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 27/88] platform/x86: wmi: Fix opening of char device Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 28/88] hwmon: (coretemp) Fix potentially truncated sysfs attribute name Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 29/88] drm/rockchip: vop: Fix reset of state in duplicate state crtc funcs Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 30/88] drm/radeon: possible buffer overflow Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 31/88] drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 32/88] ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 33/88] firmware: ti_sci: Mark driver as non removable Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 34/88] clk: scmi: Free scmi_clk allocated when the clocks with invalid info are skipped Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 35/88] hwrng: geode - fix accessing registers Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 36/88] sched/rt: Provide migrate_disable/enable() inlines Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 37/88] nd_btt: Make BTT lanes preemptible Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 38/88] HID: cp2112: Use irqchip template Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 39/88] hid: cp2112: Fix duplicate workqueue initialization Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 40/88] ARM: 9321/1: memset: cast the constant byte to unsigned char Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 41/88] ext4: move ix sanity check to corrent position Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 42/88] RDMA/hfi1: Workaround truncation compilation error Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 43/88] sh: bios: Revive earlyprintk support Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 44/88] ASoC: Intel: Skylake: Fix mem leak when parsing UUIDs fails Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 45/88] ASoC: ams-delta.c: use component after check Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 46/88] mfd: dln2: Fix double put in dln2_probe Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 47/88] leds: pwm: simplify if condition Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 48/88] leds: pwm: convert to atomic PWM API Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 49/88] leds: pwm: Dont disable the PWM when the LED should be off Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 50/88] ledtrig-cpu: Limit to 8 CPUs Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 51/88] leds: trigger: ledtrig-cpu:: Fix output may be truncated issue for cpu Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 52/88] tty: tty_jobctrl: fix pid memleak in disassociate_ctty() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 53/88] usb: dwc2: fix possible NULL pointer dereference caused by driver concurrency Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 54/88] dmaengine: ti: edma: handle irq_of_parse_and_map() errors Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 55/88] misc: st_core: Do not call kfree_skb() under spin_lock_irqsave() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 56/88] tools: iio: privatize globals and functions in iio_generic_buffer.c file Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 57/88] tools: iio: iio_generic_buffer: Fix some integer type and calculation Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 58/88] tools: iio: iio_generic_buffer ensure alignment Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 59/88] USB: usbip: fix stub_dev hub disconnect Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 60/88] dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 61/88] f2fs: fix to initialize map.m_pblk in f2fs_precache_extents() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 62/88] pcmcia: cs: fix possible hung task and memory leak pccardd() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 63/88] pcmcia: ds: fix refcount leak in pcmcia_device_add() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 64/88] pcmcia: ds: fix possible name leak in error path " Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 65/88] media: bttv: fix use after free error due to btv->timeout timer Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 66/88] media: s3c-camif: Avoid inappropriate kfree() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 67/88] media: dvb-usb-v2: af9035: fix missing unlock Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 68/88] pwm: sti: Avoid conditional gotos Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 69/88] pwm: sti: Reduce number of allocations and drop usage of chip_data Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 70/88] pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 71/88] Input: synaptics-rmi4 - fix use after free in rmi_unregister_function() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 72/88] llc: verify mac len before reading mac header Greg Kroah-Hartman
2023-11-15 20:36 ` Greg Kroah-Hartman [this message]
2023-11-15 20:36 ` [PATCH 4.19 74/88] dccp: Call security_inet_conn_request() after setting IPv4 addresses Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 75/88] dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 76/88] r8169: improve rtl_set_rx_mode Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 77/88] net: r8169: Disable multicast filter for RTL8168H and RTL8107E Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 78/88] net/smc: postpone release of clcsock Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 79/88] net/smc: wait for pending work before clcsock release_sock Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 80/88] net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 81/88] tg3: power down device only on SYSTEM_POWER_OFF Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 82/88] r8169: respect userspace disabling IFF_MULTICAST Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 83/88] netfilter: xt_recent: fix (increase) ipv6 literal buffer length Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 84/88] fbdev: imsttfb: Fix error path of imsttfb_probe() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 85/88] fbdev: imsttfb: fix a resource leak in probe Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 86/88] fbdev: fsl-diu-fb: mark wr_reg_wa() static Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 87/88] Revert "mmc: core: Capture correct oemid-bits for eMMC cards" Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 88/88] btrfs: use u64 for buffer sizes in the tree search ioctls Greg Kroah-Hartman
2023-11-16 11:13 ` [PATCH 4.19 00/88] 4.19.299-rc1 review Naresh Kamboju
2023-11-17  4:24 ` Guenter Roeck
2023-11-17 17:00 ` Pavel Machek

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=20231115191430.482252154@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syoshida@redhat.com \
    --cc=syzbot+5138ca807af9d2b42574@syzkaller.appspotmail.com \
    --cc=syzbot+9425c47dccbcb4c17d51@syzkaller.appspotmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).