public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Chen Zhongjin <chenzhongjin@huawei.com>
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	martyn@welchs.me.uk, manohar.vanga@gmail.com, arnd@arndb.de
Subject: Re: [PATCH] vme: Fix error not catched in fake_init()
Date: Mon, 5 Dec 2022 13:31:43 +0100	[thread overview]
Message-ID: <Y43kr/73sorrMWA0@kroah.com> (raw)
In-Reply-To: <20221205084805.147436-1-chenzhongjin@huawei.com>

On Mon, Dec 05, 2022 at 04:48:05PM +0800, Chen Zhongjin wrote:
> In fake_init(), __root_device_register() is possible to fail but it's
> ignored, which can cause unregistering vme_root fail when exit.
> 
>  general protection fault,
>  probably for non-canonical address 0xdffffc000000008c
>  KASAN: null-ptr-deref in range [0x0000000000000460-0x0000000000000467]
>  RIP: 0010:root_device_unregister+0x26/0x60
>  Call Trace:
>   <TASK>
>   __x64_sys_delete_module+0x34f/0x540
>   do_syscall_64+0x38/0x90
>   entry_SYSCALL_64_after_hwframe+0x63/0xcd
> 
> Return error when __root_device_register() fails.
> 
> Fixes: 658bcdae9c67 ("vme: Adding Fake VME driver")
> Signed-off-by: Chen Zhongjin <chenzhongjin@huawei.com>
> ---
>  drivers/staging/vme_user/vme_fake.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/vme_user/vme_fake.c b/drivers/staging/vme_user/vme_fake.c
> index dd646b0c531d..1ee432c223e2 100644
> --- a/drivers/staging/vme_user/vme_fake.c
> +++ b/drivers/staging/vme_user/vme_fake.c
> @@ -1073,6 +1073,8 @@ static int __init fake_init(void)
>  
>  	/* We need a fake parent device */
>  	vme_root = __root_device_register("vme", THIS_MODULE);

This should be calling root_device_register() as well, not this version
of the call.

thanks,

greg k-h

  reply	other threads:[~2022-12-05 12:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05  8:48 [PATCH] vme: Fix error not catched in fake_init() Chen Zhongjin
2022-12-05 12:31 ` Greg KH [this message]
2022-12-06  1:53   ` Chen Zhongjin

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=Y43kr/73sorrMWA0@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=chenzhongjin@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=manohar.vanga@gmail.com \
    --cc=martyn@welchs.me.uk \
    /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