All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: bharat panda <bharat22bhusan@gmail.com>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Bharat Panda <bharat.panda@samsung.com>,
	"linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH ] profiles: Fix crash due to NULL pointer access
Date: Thu, 5 Jun 2014 15:01:28 +0300	[thread overview]
Message-ID: <CABBYNZL5hfiUit5guGrHoDeneC5KEfvDeKMNFAJngfR_hcgwng@mail.gmail.com> (raw)
In-Reply-To: <CANBo3n89N56u8NCpd52EoEZSPxDmZjN9_GxHjSXVnT_V=5BO2A@mail.gmail.com>

Hi,

On Thu, Jun 5, 2014 at 2:40 PM, bharat panda <bharat22bhusan@gmail.com> wrote:
> Hi Marcel,
>
>>> NULL pointer check is added after memory allocation
>>> to prevent core dump due to NULL pointer access.
>>>
>>> Signed-off-by: Bharat Panda <bharat.panda@samsung.com>
>>> ---
>>> profiles/audio/a2dp.c  |    8 ++++++++
>>> profiles/audio/avctp.c |    4 ++++
>>> profiles/audio/avdtp.c |   16 ++++++++++++++++
>>> profiles/health/hdp.c  |    4 +++-
>>> profiles/health/mcap.c |    2 ++
>>> 5 files changed, 33 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
>>> index c9dac9a..580cb60 100644
>>> --- a/profiles/audio/a2dp.c
>>> +++ b/profiles/audio/a2dp.c
>>> @@ -523,6 +523,8 @@ static gboolean endpoint_getcap_ind(struct avdtp *session,
>>>                                                       a2dp_sep->user_data);
>>>
>>>       codec_caps = g_malloc0(sizeof(*codec_caps) + length);
>>> +     if(!codec_caps)
>>> +             return -ENOMEM;
>>
>> the only way this can return NULL is when the size argument is 0. In all other cases it will abort the program.
>>
> In one of our a2dp connection test, we found it restarted bluetoothd,
> and failed to store the capabilities because of NULL pointer abort.
> Just to avoid same issue in other cases, I have added this check to
> ignore the abort.

If it is reproducible I would like to see the backlog of the crash,
the length comes for dbus_message_iter_get_fixed_array which perhaps
is failing and returning a bogus value which we are not checking.


-- 
Luiz Augusto von Dentz

  parent reply	other threads:[~2014-06-05 12:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05 11:01 [PATCH ] profiles: Fix crash due to NULL pointer access Bharat Panda
2014-06-05 10:56 ` Marcel Holtmann
2014-06-05 11:40   ` bharat panda
2014-06-05 11:53     ` Johan Hedberg
2014-06-05 12:01     ` Luiz Augusto von Dentz [this message]
2014-06-05 12:58       ` bharat panda

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=CABBYNZL5hfiUit5guGrHoDeneC5KEfvDeKMNFAJngfR_hcgwng@mail.gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=bharat.panda@samsung.com \
    --cc=bharat22bhusan@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /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.