Re: [PATCH] tty: vcc: add check for mdesc_grab()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
> ---
>  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



[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux