From patchwork Fri Dec 23 14:32:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ekaterina Esina X-Patchwork-Id: 36286 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp352632wrn; Fri, 23 Dec 2022 06:37:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXtHR3t7na5wciwGofPEhZNi02/r3GA8VLeiq31S6yXERv6T17xQaH1nX1wPfj2DPBomagAu X-Received: by 2002:a05:6402:321a:b0:475:5695:62b3 with SMTP id g26-20020a056402321a00b00475569562b3mr9631352eda.16.1671806254365; Fri, 23 Dec 2022 06:37:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671806254; cv=none; d=google.com; s=arc-20160816; b=AAHAXRBNazSKpTHFkbqePnn+aMVSKNXXd6A6TogwpusscLFqJoyByo3OyMn+61DN5s rDWRoN5B5Wgv9/gfm6q2HQuwPIfD9+sFqalVfXDzp6rBAIUQzV3St4AEu407DOo5tkJz Pho7o7LZ9FoA/HKeSYWCId01htxa7D7eVe+Nld7TsUZEXPvLy16A1/r3lZ727LuVf+Dk t6Am17t2mn9PeTQ8S7qESr2sokCjVD0N6YtnwKIu70EUs+WdlECQnqNiPGvsF1maZ9xA 9PPuAPmnGDNikZztbifuWhbXweEUTyRyYZxEYRJ6LB8ZoO1qR8gcIKu/EyMj3KZkbYZq hB3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=UP/dd21I1F5ogs2KE767IOLoG7Z9HtYrlWACg9Xw1+I=; b=rXz/QAsFt/fwpFwuciYjJm/9qTh0CBthEsZy197TYng0l2vl77BHn7G8BPT2OEWBwY t3OsGQxKT3XHySNWMDagSFF6m/wFRxxnu1Npd+lNyuk0EZaInRW0ZTQmr8orgG0nmYLT 75xfaXYBSyjOVs46aHSrlqWC+/2x6UbYbHOL8oIKQZvuJbId+tgCdFyvFrzkXsTCkuFv yWlDv4zV6/fWBaIqEl9yFstR8NQuFAkARLMtULnhEanj5Kcvr40YH2n8pUUAvffivG5E F3+fhUB7LGdqfzHwJbvk6X/4tQldO2YS+TaQZU2xPSYa2Txs0mPy12AMxe25W8Z9pLGd O+rA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y6-20020a056402358600b0047b2f983e93si3239384edc.277.2022.12.23.06.37.10; Fri, 23 Dec 2022 06:37:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230448AbiLWOd1 (ORCPT + 99 others); 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 X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00,RCVD_IN_SORBS_WEB, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753015914697333770?= X-GMAIL-MSGID: =?utf-8?q?1753015914697333770?= If uhdlc_priv_tsa != 1 then utdm is not initialized. And if ret != NULL then goto undo_uhdlc_init, where utdm is dereferenced. Same if dev == 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 *pdev) free_dev: free_netdev(dev); undo_uhdlc_init: - iounmap(utdm->siram); + if (utdm != NULL) { + iounmap(utdm->siram); + } unmap_si_regs: iounmap(utdm->si_regs); free_utdm: