linux-stable/drivers/vdpa/solidrun
Philipp Stanner 0b364cf53b vdpa: solidrun: Fix UB bug with devres
In psnet_open_pf_bar() and snet_open_vf_bar() a string later passed to
pcim_iomap_regions() is placed on the stack. Neither
pcim_iomap_regions() nor the functions it calls copy that string.

Should the string later ever be used, this, consequently, causes
undefined behavior since the stack frame will by then have disappeared.

Fix the bug by allocating the strings on the heap through
devm_kasprintf().

Cc: stable@vger.kernel.org	# v6.3
Fixes: 51a8f9d7f5 ("virtio: vdpa: new SolidNET DPU driver.")
Reported-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Closes: https://lore.kernel.org/all/74e9109a-ac59-49e2-9b1d-d825c9c9f891@wanadoo.fr/
Suggested-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20241028074357.9104-3-pstanner@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-11-06 04:40:07 -05:00
..
Makefile vdpa/snet: support getting and setting VQ state 2023-04-21 03:02:34 -04:00
snet_ctrl.c vdpa/snet: implement the resume vDPA callback 2023-06-27 10:47:08 -04:00
snet_hwmon.c vdpa: solidrun: constify pointers to hwmon_channel_info 2023-06-27 10:47:08 -04:00
snet_main.c vdpa: solidrun: Fix UB bug with devres 2024-11-06 04:40:07 -05:00
snet_vdpa.h vdpa/snet: implement the resume vDPA callback 2023-06-27 10:47:08 -04:00