Date: Fri, 9 Feb 2024 19:57:07 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: eb86c6c5b462 - main - cam: Check if cam_simq_alloc fails for the xpt bus during module init Message-ID: <202402091957.419Jv7tl072527@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=eb86c6c5b462c996e44c45ba496937b75ef22da3 commit eb86c6c5b462c996e44c45ba496937b75ef22da3 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-02-09 19:53:43 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-02-09 19:53:43 +0000 cam: Check if cam_simq_alloc fails for the xpt bus during module init This is very unlikely to fail (and if it does, CAM isn't going to work regardless), but fail with an error rather than a gauranteed panic via NULL pointer dereference. PR: 276770 Reported by: Qiushi <w290680224@gmail.com> --- sys/cam/cam_xpt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 2acb106b087c..68aa6faae9a3 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -908,6 +908,8 @@ xpt_init(void *dummy) * perform other XPT functions. */ devq = cam_simq_alloc(16); + if (devq == NULL) + return (ENOMEM); xpt_sim = cam_sim_alloc(xptaction, xptpoll, "xpt",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402091957.419Jv7tl072527>