netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Khoroshilov <khoroshilov@ispras.ru>
To: Ekaterina Esina <eesina@astralinux.ru>, Zhao Qiang <qiang.zhao@nxp.com>
Cc: lvc-project@linuxtesting.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	linuxppc-dev@lists.ozlabs.org,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [lvc-project] [PATCH] net-wan: Add check for NULL for utdm in ucc_hdlc_probe
Date: Fri, 23 Dec 2022 18:30:31 +0300	[thread overview]
Message-ID: <1c4eaa0c-cb14-83c3-304f-9cf2567f7d31@ispras.ru> (raw)
In-Reply-To: <20221223143225.23153-1-eesina@astralinux.ru>

On 23.12.2022 17:32, Ekaterina Esina wrote:
> 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 <eesina@astralinux.ru>
> ---
>  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:


But what is about iounmap(utdm->si_regs); that dereferences utdm a few
lines below?

--
Alexey


  reply	other threads:[~2022-12-23 15:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-23 14:32 [PATCH] net-wan: Add check for NULL for utdm in ucc_hdlc_probe Ekaterina Esina
2022-12-23 15:30 ` Alexey Khoroshilov [this message]
2023-01-09 15:49 ` Christophe Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c4eaa0c-cb14-83c3-304f-9cf2567f7d31@ispras.ru \
    --to=khoroshilov@ispras.ru \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eesina@astralinux.ru \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=qiang.zhao@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).