From nobody Tue Apr 14 09:22:38 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90917C3DA79 for ; Fri, 23 Dec 2022 14:33:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236136AbiLWOd1 (ORCPT ); Fri, 23 Dec 2022 09:33:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbiLWOdZ (ORCPT ); Fri, 23 Dec 2022 09:33:25 -0500 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB2CB40818; Fri, 23 Dec 2022 06:33:22 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id A8D211864455; Fri, 23 Dec 2022 17:33:18 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id UFprKO6oY6NS; Fri, 23 Dec 2022 17:33:18 +0300 (MSK) Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 5CF381864449; Fri, 23 Dec 2022 17:33:18 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id oLOt4vvLP2u6; Fri, 23 Dec 2022 17:33:18 +0300 (MSK) Received: from localhost.localdomain (unknown [213.87.131.26]) by mail.astralinux.ru (Postfix) with ESMTPSA id 1EAF0186441A; Fri, 23 Dec 2022 17:33:17 +0300 (MSK) From: Ekaterina Esina To: Zhao Qiang Cc: Ekaterina Esina , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] net-wan: Add check for NULL for utdm in ucc_hdlc_probe Date: Fri, 23 Dec 2022 17:32:25 +0300 Message-Id: <20221223143225.23153-1-eesina@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If uhdlc_priv_tsa !=3D 1 then utdm is not initialized. And if ret !=3D NULL then goto undo_uhdlc_init, where utdm is dereferenced. Same if dev =3D=3D NULL. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Ekaterina Esina --- drivers/net/wan/fsl_ucc_hdlc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index 22edea6ca4b8..2ddb0f71e648 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.c +++ b/drivers/net/wan/fsl_ucc_hdlc.c @@ -1243,7 +1243,9 @@ static int ucc_hdlc_probe(struct platform_device *pde= v) free_dev: free_netdev(dev); undo_uhdlc_init: - iounmap(utdm->siram); + if (utdm !=3D NULL) { + iounmap(utdm->siram); + } unmap_si_regs: iounmap(utdm->si_regs); free_utdm: --=20 2.30.2