[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/22] hw/net/spapr: prevent potential NULL dereference
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 01/22] hw/net/spapr: prevent potential NULL dereference |
Date: |
Tue, 2 Jul 2024 07:00:51 +0200 |
From: Oleg Sviridov <oleg.sviridov@red-soft.ru>
Pointer, returned from function 'spapr_vio_find_by_reg',
may be NULL and is dereferenced immediately after.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Oleg Sviridov <oleg.sviridov@red-soft.ru>
Message-ID: <20240531073636.3779559-1-oleg.sviridov@red-soft.ru>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/net/spapr_llan.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
index ecb30b7c76..8af33d91b6 100644
--- a/hw/net/spapr_llan.c
+++ b/hw/net/spapr_llan.c
@@ -770,6 +770,12 @@ static target_ulong h_change_logical_lan_mac(PowerPCCPU
*cpu,
SpaprVioVlan *dev = VIO_SPAPR_VLAN_DEVICE(sdev);
int i;
+ if (!dev) {
+ hcall_dprintf("H_CHANGE_LOGICAL_LAN_MAC called when "
+ "no NIC is present\n");
+ return H_PARAMETER;
+ }
+
for (i = 0; i < ETH_ALEN; i++) {
dev->nicconf.macaddr.a[ETH_ALEN - i - 1] = macaddr & 0xff;
macaddr >>= 8;
--
2.41.0
- [PULL 00/22] Misc HW patches for 2024-07-02, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 01/22] hw/net/spapr: prevent potential NULL dereference,
Philippe Mathieu-Daudé <=
- [PULL 02/22] include/hw: add helpers for defining versioned machine types, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 04/22] hw/s390x: convert 'ccw' machine definitions to use new macros, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 05/22] hw/ppc: convert 'spapr' machine definitions to use new macros, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 06/22] hw/m68k: convert 'virt' machine definitions to use new macros, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 03/22] hw/arm: convert 'virt' machine definitions to use new macros, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 07/22] hw/i386: convert 'i440fx' machine definitions to use new macros, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 08/22] hw/i386: convert 'q35' machine definitions to use new macros, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 09/22] include/hw: add macros for deprecation & removal of versioned machines, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 10/22] include/hw: temporarily disable deletion of versioned machine types, Philippe Mathieu-Daudé, 2024/07/02
- [PULL 11/22] hw: set deprecation info for all versioned machine types, Philippe Mathieu-Daudé, 2024/07/02