From nobody Tue Feb 10 07:41:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1766327060; cv=none; d=zohomail.com; s=zohoarc; b=mifdp5xJdV0qdP0SdY8MQtyWpNWfhjFQKSlKUjWgzu3ZM9e5IDCLmQLRPdlU1mKqkmEKcuUFuWAUQqKKy+0FoZcazWCg81GDe1S0Js+//vE+FpwN8fE7MnZN5ingCOB3GdNWsQgOvp7K+tD9kVaILj5Bv571BKIwNjSDZa/txGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766327060; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BU0OmwMUtLRHOgUboEg+bahM1H9b5s2L6i2Kd1bJBh0=; b=OE8pG9XfpAsjhbNVc1I5lPNVn2QRg4qhVHdi8kouR4UHrL2OhPeiuF/6eaVK9F3JHbWV1ZIU0/asfsI9K8OV+Ry7WeqIskse96DJ/q+vXF3Jk8Pq+QMW6Q0ETQIzDjVYar7Pik6TKLyHaDj59b7G8us88Ce/9Rv0EDbQfSJYilc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1766327060595879.9181662043945; Sun, 21 Dec 2025 06:24:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vXKLK-0000yQ-Oi; Sun, 21 Dec 2025 09:23:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vXKLJ-0000xu-7P for qemu-devel@nongnu.org; Sun, 21 Dec 2025 09:23:29 -0500 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vXKLH-0001HH-SJ for qemu-devel@nongnu.org; Sun, 21 Dec 2025 09:23:28 -0500 Received: by mail-pf1-x443.google.com with SMTP id d2e1a72fcca58-7f0db5700b2so2925864b3a.0 for ; Sun, 21 Dec 2025 06:23:27 -0800 (PST) Received: from fedora.. ([118.151.210.82]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7ff7e48f258sm7590449b3a.47.2025.12.21.06.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Dec 2025 06:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766327006; x=1766931806; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BU0OmwMUtLRHOgUboEg+bahM1H9b5s2L6i2Kd1bJBh0=; b=GfLa3FFW1jO/kJy45MnD2CFmRWIqdLoxWL+0vSuZxGvwSsVT61MPBRGSkQ23aphlu5 +10FKOVBGzZ2bUx2BHMyyC09CWf4ALF897Rd17A4XY9RyxFVrms+0kKzoQXNUnU/F5BQ M/P8xkGOxlXTcjDNkJuONAAdeEEwYpNapf8xG16rfar8L214ojuFJtZpGpkuI/7Cqt/l /aqbIhgoEjU7/nh7E3WPANnfC2EVu/LcHB+Y1jjMJVW6JalTbn95pDZn22yQDXgzh1VU NzhGBtljO5U8cjV0D9QkNkIEGFz8NlUj5XVhYku4zgQhv8lnaUj6peGXo0x0B4AulHwM eW1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766327006; x=1766931806; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=BU0OmwMUtLRHOgUboEg+bahM1H9b5s2L6i2Kd1bJBh0=; b=JWnOVL9foYwfi9/UWb5XD0P9sOhy8+3dqfm/iEJ3S5FiLdCFPKsQF8ZS2KcubvQ4SI WJIj9JxLgNltyAxdjERChAVigmSNHjP31G+mnjVELmNpgfzPt7M4EL4CdUb12WYcgiBL 9CMubbKupzafOWXZwvvv9QD9lRX6T7QL90hRgYsSts2conduJPqtmSTbC2T1nrPyzdX3 jM6NNa1Heof8BkVYIBkdHl3woboiYYvfJWSmGgpKMUXcoIlVXrBtL6Bak3kvf0STMOg0 3I9YTV0px+9LJD1fADzIVbelYnaDSBsryDzoQqzYcQk/6wQU8nsSraPYiru6ilhtskT0 vX8g== X-Gm-Message-State: AOJu0Yz5yPlWZ6DfCLOnmr5HMpXcHTgxOqXvrQktCSDCrVED5FRG0G3i iU5/YDns18ARBYhTjDW/7os9/J2whKSIPsak/XE2i25w+JB8iir0r+y9OQdHz//NZ8M= X-Gm-Gg: AY/fxX5cnno5z26daFPuX/1qZU4blH1HoiMu4OODN5c32hagaW8uC/QJXdKyyyLM0jP K/2h4+8d6M/c/dqeTJxqGoKV6qKQv203loNp48uDnLccZInR6+87f+nORZneVUNjjMPxVsca9Na 3t5frmceodyWNm5tF5syfZoN/z5a6Z22aHHVf96uFhibvqxWK68cm/oJ0tdWMIU8MYVaSuuQoxm XdCPpRPhU6LwnzMcVymQqdxnLhDLiQtM5vUxfKsSszb/K1CiytBKfJRcHTNTtLwkfpX27p4ife9 g5GYbCx7huITDvD4YfQZ/s0HPfA+DOryQSRfIQiqOLsj492XnSUpq4ckeIvz7aw/+qQSusP1NB4 vNRnVMhQBO4Vy801+1jkH7BCm+FNALwff0h6+QWuaQlMfXR6iwTIi+MCNl82taYeRLSPjRr/ZTf 6SDNYfvtOV4U+oWXDYEu8= X-Google-Smtp-Source: AGHT+IEb/Mt4ckukNcGnYaloX47doF7ZK15R/8y8FTB6MtG6vJdVxRIxKLbdSH9LkstE+0nLd5tgeg== X-Received: by 2002:a05:6a00:e11:b0:7b8:8d43:fcd1 with SMTP id d2e1a72fcca58-7ff64215183mr6682163b3a.9.1766327006096; Sun, 21 Dec 2025 06:23:26 -0800 (PST) From: Soumyajyotii Ssarkar To: qemu-devel@nongnu.org, deller@gmx.de, sarkarsoumyajyoti23@gmail.com, mark.cave-ayland@ilande.co.uk, richard.henderson@linaro.org Cc: Soumyajyotii Ssarkar Subject: [PATCH 01/10] scsi:ncr710: Add null pointer checks Date: Sun, 21 Dec 2025 19:53:08 +0530 Message-ID: <20251221142317.266293-2-soumyajyotisarkar23@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20251221142317.266293-1-soumyajyotisarkar23@gmail.com> References: <20251221142317.266293-1-soumyajyotisarkar23@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::443; envelope-from=soumyajyotisarkar23@gmail.com; helo=mail-pf1-x443.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1766327061896158500 Content-Type: text/plain; charset="utf-8" Add nullpointer safety checks in ncr710_request_free() & ncr710_request_cancelled() to prevent crashed while handing invalid req structures Added to preventing memory corruption, which occured during device initialization Signed-off-by: Soumyajyotii Ssarkar Reviewed-by: Helge Deller --- hw/scsi/ncr53c710.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/scsi/ncr53c710.c b/hw/scsi/ncr53c710.c index 47a6983491..bab2ea7210 100644 --- a/hw/scsi/ncr53c710.c +++ b/hw/scsi/ncr53c710.c @@ -737,6 +737,12 @@ static void ncr710_add_msg_byte(NCR710State *s, uint8_= t data) =20 static void ncr710_request_free(NCR710State *s, NCR710Request *p) { + if (!p) { + return; + } + if (p->req && p->req->hba_private =3D=3D p) { + p->req->hba_private =3D NULL; + } if (p =3D=3D s->current) { s->current =3D NULL; } @@ -747,8 +753,11 @@ void ncr710_request_cancelled(SCSIRequest *req) { NCR710State *s =3D ncr710_from_scsi_bus(req->bus); NCR710Request *p =3D (NCR710Request *)req->hba_private; - req->hba_private =3D NULL; - ncr710_request_free(s, p); + if (p) { + req->hba_private =3D NULL; + p->req =3D NULL; + ncr710_request_free(s, p); + } scsi_req_unref(req); } =20 --=20 2.49.0