All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Liang He <windhl@126.com>
Cc: davem@davemloft.net, jirislaby@kernel.org, sparclinux@vger.kernel.org
Subject: Re: [PATCH] tty: vcc: add check for mdesc_grab()
Date: Wed, 15 Mar 2023 07:32:54 +0100	[thread overview]
Message-ID: <ZBFmlu/iKFPdUaPy@kroah.com> (raw)
In-Reply-To: <20230315061121.1741454-1-windhl@126.com>

On Wed, Mar 15, 2023 at 02:11:21PM +0800, Liang He wrote:
> In vcc_probe(), we should check the return value of
> mdesc_grab() as it may return NULL. While the
> vio_vdev_node() has the NULL-check, but if there
> is still a call to mdesc_release() which may cause
> a NPD bug.

Have you actually triggered this issue?  If so, how?

> Fixes: 5d171050e28f ("sparc64: vcc: Enable VCC port probe and removal")
> Signed-off-by: Liang He <windhl@126.com>
> ---
>  drivers/tty/vcc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/tty/vcc.c b/drivers/tty/vcc.c
> index 34ba6e54789a..e3ba63d0a91f 100644
> --- a/drivers/tty/vcc.c
> +++ b/drivers/tty/vcc.c
> @@ -610,6 +610,9 @@ static int vcc_probe(struct vio_dev *vdev, const struct vio_device_id *id)
>  
>  	hp = mdesc_grab();
>  
> +	if (!hp)
> +		return -ENODEV;

This change is obviously not correct and has not been tested, sorry.
Please do not make changes like this without properly validating them.

greg k-h

  reply	other threads:[~2023-03-15  6:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15  6:11 [PATCH] tty: vcc: add check for mdesc_grab() Liang He
2023-03-15  6:32 ` Greg KH [this message]
2023-03-15  9:39   ` Liang He

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=ZBFmlu/iKFPdUaPy@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=jirislaby@kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=windhl@126.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.