Linux kernel staging patches
 help / color / mirror / Atom feed
From: "yiyang (D)" <yiyang13@huawei.com>
To: Alex Elder <elder@ieee.org>, Dan Carpenter <dan.carpenter@linaro.org>
Cc: <vaibhav.sr@gmail.com>, <mgreer@animalcreek.com>,
	<johan@kernel.org>, <elder@kernel.org>,
	<gregkh@linuxfoundation.org>, <ankov_svetlin@projectara.com>,
	<greybus-dev@lists.linaro.org>, <linux-staging@lists.linux.dev>,
	<wangweiyang2@huawei.com>
Subject: Re: [PATCH] staging: greybus: fix possible null-ptr-deref in gb_audio_manager_get_module()
Date: Tue, 29 Oct 2024 10:58:30 +0800	[thread overview]
Message-ID: <541d16d3-ea2e-d956-5dd9-613ede430fe5@huawei.com> (raw)
In-Reply-To: <a9cfb5e6-33f4-495c-b329-7e97f626d1a1@ieee.org>


On 2024/10/28 20:46, Alex Elder wrote:
> On 10/26/24 5:50 AM, Dan Carpenter wrote:
>> On Sat, Oct 26, 2024 at 08:11:53AM +0000, Yi Yang wrote:
>>> The gb_audio_manager_get_module() is EXPORT_SYMBOL, and will return NULL
>>> when incoming parameter id < 0, fix possible null-ptr-deref by add check
>>> for return value.
>>>
>>> Fixes: 8db00736d365 ("greybus: audio: Add Audio Manager")
>>> Signed-off-by: Yi Yang <yiyang13@huawei.com>
>>
>> Where is gb_audio_manager_get_module() called from?  So far as I can 
>> see it's
>> never used.  Why not just delete it?
>>
>> regards,
>> dan carpenter
> 
> I agree with this.  I suspected all callers might have guaranteed
> that the "id" value passed would be always valid, but... there are
> no callers.
> 
> It is a simple function, and could be added back again if it is
> needed in the future (possibly even by reverting the commit that
> removes it).
> 
> If you do this, please remove gb_audio_put_module() in the same
> patch.  It too has no callers.
> 
> Thank you.
> 
>                      -Alex
> 
> .

I tried to find the caller before I modified it, but unfortunately I 
didn't find the caller, so I suspect some non-kernel driver code will 
try to call this functions.

I just found this problem while reading the code and I'm not sure if I 
should remove the function.

regards,
Yiyang
-- 

  reply	other threads:[~2024-10-29  2:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-26  8:11 [PATCH] staging: greybus: fix possible null-ptr-deref in gb_audio_manager_get_module() Yi Yang
2024-10-26 10:50 ` Dan Carpenter
2024-10-28 12:46   ` Alex Elder
2024-10-29  2:58     ` yiyang (D) [this message]
2024-10-29 15:31       ` Alex Elder
2024-10-29 15:36         ` Dan Carpenter

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=541d16d3-ea2e-d956-5dd9-613ede430fe5@huawei.com \
    --to=yiyang13@huawei.com \
    --cc=ankov_svetlin@projectara.com \
    --cc=dan.carpenter@linaro.org \
    --cc=elder@ieee.org \
    --cc=elder@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=johan@kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mgreer@animalcreek.com \
    --cc=vaibhav.sr@gmail.com \
    --cc=wangweiyang2@huawei.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