All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Gowtham Anandha Babu <gowtham.ab@samsung.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: Query regarding MAP 1.2 implementation
Date: Wed, 3 Sep 2014 15:19:12 +0300	[thread overview]
Message-ID: <CABBYNZ+4-QdkZtV2_FVx49Xg+dRNXCGwFteCgc7gMMUX1_6sOw@mail.gmail.com> (raw)
In-Reply-To: <000301cfc771$2a4b8d20$7ee2a760$@samsung.com>

[-- Attachment #1: Type: text/plain, Size: 6848 bytes --]

Hi,

On Wed, Sep 3, 2014 at 3:18 PM, Gowtham Anandha Babu
<gowtham.ab@samsung.com> wrote:
> Hi,
>
>> -----Original Message-----
>> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
>> Sent: Wednesday, September 03, 2014 5:34 PM
>> To: Gowtham Anandha Babu
>> Cc: linux-bluetooth@vger.kernel.org; Bharat Panda
>> Subject: Re: Query regarding MAP 1.2 implementation
>>
>> Hi,
>>
>> On Wed, Sep 3, 2014 at 2:35 PM, Gowtham Anandha Babu
>> <gowtham.ab@samsung.com> wrote:
>> > Hi,
>> >
>> >> -----Original Message-----
>> >> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
>> >> Sent: Wednesday, September 03, 2014 3:57 PM
>> >> To: Gowtham Anandha Babu
>> >> Cc: linux-bluetooth@vger.kernel.org
>> >> Subject: Re: Query regarding MAP 1.2 implementation
>> >>
>> >> Hi,
>> >>
>> >> On Tue, Sep 2, 2014 at 11:28 AM, Luiz Augusto von Dentz
>> >> <luiz.dentz@gmail.com> wrote:
>> >> > Hi,
>> >> >
>> >> > On Tue, Sep 2, 2014 at 8:22 AM, Gowtham Anandha Babu
>> >> > <gowtham.ab@samsung.com> wrote:
>> >> >>
>> >> >> Hi Luiz,
>> >> >>
>> >> >>> -----Original Message-----
>> >> >>> From: linux-bluetooth-owner@vger.kernel.org
>> >> >>> [mailto:linux-bluetooth- owner@vger.kernel.org] On Behalf Of Luiz
>> >> >>> Augusto von Dentz
>> >> >>> Sent: Monday, September 01, 2014 6:37 PM
>> >> >>> To: Gowtham Anandha Babu
>> >> >>> Cc: linux-bluetooth@vger.kernel.org; Bharat Panda
>> >> >>> Subject: Re: Query regarding MAP 1.2 implementation
>> >> >>>
>> >> >>> Hi,
>> >> >>>
>> >> >>> On Mon, Sep 1, 2014 at 3:29 PM, Gowtham Anandha Babu
>> >> >>> <gowtham.ab@samsung.com> wrote:
>> >> >>>
>> >> >>> > The current message-dummy.c looks like, it is creating a
>> >> >>> > virtual folder in the
>> >> >>> system (Ex. Home/PC-NAME/map-messages/).
>> >> >>> > So, I created the map-messages directory in home/PC-NAME/.
>> Then
>> >> >>> > I tried
>> >> >>> SETPATH (mentioned in the previous thread).
>> >> >>> > The output is...
>> >> >>> >
>> >> >>> >  obexd[29146]: obexd/src/obex.c:cmd_setpath()
>> >> >>> > obexd[29146]: SETPATH(0x5), (null)(0xffffffff)
>> >> >>> > obexd[29146]: obexd/src/obex.c:parse_name() NAME:
>> >> >>> > obexd[29146]: obexd/plugins/mas.c:mas_setpath() SETPATH: name
>> >> >>> nonhdr
>> >> >>> > 0x20
>> >> >>> > obexd[29146]: SETPATH(0x5), SUCCESS(0x20)
>> >> >>> >
>> >> >>> > But When I tried to call GetFolderListing() The output is...
>> >> >>> >
>> >> >>> > obexd[29146]: obexd/src/obex.c:cmd_get() session 0x1008c40
>> >> >>> > obexd[29146]: GET(0x3), (null)(0xffffffff)
>> >> >>> > obexd[29146]: obexd/src/obex.c:parse_type() TYPE:
>> >> >>> > x-obex/folder-listing
>> >> >>> > obexd[29146]: obexd/plugins/mas.c:mas_get() GET: name (null)
>> >> >>> > type x-obex/folder-listing mas 0x1015c00
>> >> >>> > obexd[29146]: obexd/plugins/mas.c:get_params() Error when
>> >> >>> > parsing
>> >> >>> parameters!
>> >> >>> > obexd[29146]: GET(0x3), BAD_REQUEST(0x40)
>> >> >>> >
>> >> >>> > But I had few folders created inside the map-messages.
>> >> >>>
>> >> >>> Bad request is normally when there is something wrong with the
>> >> >>> command itself, the error comes from here:
>> >> >>>
>> >> >>> mas->inparams = g_obex_apparam_decode(buffer, size);
>> >> >>> if (mas->inparams == NULL) {
>> >> >>>     DBG("Error when parsing parameters!");
>> >> >>>     return -EBADR;
>> >> >>> }
>> >> >>>
>> >> >>> I suspect the problem is that there is no application parameters
>> >> >>> set which is fine since all the parameters of GetFolderListing
>> >> >>> are optional, please try with the attached patch I will send it
>> >> >>> shortly as a
>> >> proper patch to the mailing list.
>> >> >>>
>> >> >>>
>> >> >>> --
>> >> >>> Luiz Augusto von Dentz
>> >> >>
>> >> >>
>> >> >> I applied the patch which was attached in the previous reply.
>> >> >> Still I am
>> >> getting the same error.
>> >> >> I tried printing the "size" inside the get_params function. Its
>> >> >> value is '0' for
>> >> GetFolderListing request.
>> >> >> If size=0, then g_obex_apparam_decode()  function always return
>> >> >> NULL,
>> >> which leads to "Error when parsing parameters!".
>> >> >
>> >> > My bad, the check should be size <= 0 otherwise it will still cause
>> >> > this problem.
>> >>
>> >> Let me know if you can test the patch, I would like to push it asap if it
>> works.
>> >>
>> >>
>> >> --
>> >> Luiz Augusto von Dentz
>> >
>> >
>> > Now I am not getting the BAD_REQUEST error. But when I call the folder-
>> listing, it abruptly ends or terminate.
>> >
>> > The below one -- mas-connect
>> >
>> > obexd[14651]: obexd/plugins/bluetooth.c:profile_new_connection()
>> > device /org/bluez/hci0/dev_00_1B_DC_07_33_4E
>> > obexd[14651]: obexd/src/obex.c:obex_session_start()
>> > obexd[14651]: obexd/src/obex.c:cmd_connect()
>> > obexd[14651]: CONNECT(0x0), (null)(0xffffffff)
>> > obexd[14651]: obexd/src/obex.c:cmd_connect() Selected driver: Message
>> > Access server
>> > obexd[14651]: obexd/plugins/mas.c:mas_connect()
>> > obexd[14651]: CONNECT(0x0), (null)(0x0)
>> >
>> > The below one -- mas-setpath
>> >
>> > obexd[14651]: obexd/src/obex.c:cmd_setpath()
>> > obexd[14651]: SETPATH(0x5), (null)(0xffffffff)
>> > obexd[14651]: obexd/src/obex.c:parse_name() NAME:
>> > obexd[14651]: obexd/plugins/mas.c:mas_setpath() SETPATH: name
>> nonhdr
>> > 0x20
>> > obexd[14651]: SETPATH(0x5), SUCCESS(0x20)
>> >
>> > The below one -- mas-getFolderListing
>> >
>> > obexd[14651]: obexd/src/obex.c:cmd_get() session 0x1ecbd80
>> > obexd[14651]: GET(0x3), (null)(0xffffffff)
>> > obexd[14651]: obexd/src/obex.c:parse_type() TYPE:
>> > x-obex/folder-listing
>> > obexd[14651]: obexd/plugins/mas.c:mas_get() GET: name (null) type
>> > x-obex/folder-listing mas 0x1ecbc00
>> > obexd[14651]: obexd/plugins/mas.c:folder_listing_open() name = (null)
>> > obexd[14651]: obexd/src/obex.c:driver_get_headers() name=(null)
>> > type=x-obex/folder-listing object=0x1ecbc00
>> > obexd[14651]: obexd/plugins/mas.c:any_get_next_header()
>> > obexd[14651]: get_next_header(): Resource temporarily unavailable (11)
>> > obexd[14651]: obexd/src/obex.c:driver_get_headers() name=(null)
>> > type=x-obex/folder-listing object=0x1ecbc00
>> > obexd[14651]: obexd/plugins/mas.c:any_get_next_header()
>> > gowtham.ab@gowtham-ab:~/latest_bluez/bluez$
>>
>> I think I know what is the problem, outparams can also be NULL if no
>> application parameter has to be added to the response causing
>> g_obex_apparam_encode to crash, check with attached patch. Btw next
>> time please send the backtrace either using gdb or valgrind is highly
>> recommended.
>>
>> --
>> Luiz Augusto von Dentz
>
> Sorry, I didn’t see any patch attached.

There it go.

-- 
Luiz Augusto von Dentz

[-- Attachment #2: 0001-obexd-mas-Fix-crash-when-outparams-is-NULL.patch --]
[-- Type: text/x-patch, Size: 767 bytes --]

From 62cdfef597ef6bf142623e2cd1a743494102323d Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Wed, 3 Sep 2014 14:58:37 +0300
Subject: [PATCH BlueZ] obexd/mas: Fix crash when outparams is NULL

outparams can be NULL meaning no application parameters should be added
to the response.
---
 obexd/plugins/mas.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c
index 24b26ae..fb97fe3 100644
--- a/obexd/plugins/mas.c
+++ b/obexd/plugins/mas.c
@@ -676,6 +676,9 @@ static ssize_t any_get_next_header(void *object, void *buf, size_t mtu,
 		return 0;
 
 	mas->ap_sent = TRUE;
+	if (!mas->outparams)
+		return 0;
+
 	return g_obex_apparam_encode(mas->outparams, buf, mtu);
 }
 
-- 
1.9.3


  reply	other threads:[~2014-09-03 12:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06 11:30 Query regarding MAP 1.2 implementation Gowtham Anandha Babu
2014-08-06 12:02 ` Luiz Augusto von Dentz
     [not found]   ` <002101cfb550$afb1f400$0f15dc00$@samsung.com>
     [not found]     ` <CABBYNZL5OBA6iNhzTkpKTmSEj+5R_oU5KLOAsFcK0ZDHvridMw@mail.gmail.com>
2014-09-01 12:29       ` Gowtham Anandha Babu
2014-09-01 13:07         ` Luiz Augusto von Dentz
2014-09-02  5:22           ` Gowtham Anandha Babu
2014-09-02  8:28             ` Luiz Augusto von Dentz
2014-09-03 10:27               ` Luiz Augusto von Dentz
2014-09-03 11:35                 ` Gowtham Anandha Babu
2014-09-03 12:04                   ` Luiz Augusto von Dentz
2014-09-03 12:18                     ` Gowtham Anandha Babu
2014-09-03 12:19                       ` Luiz Augusto von Dentz [this message]
2014-09-03 13:52                         ` Gowtham Anandha Babu

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=CABBYNZ+4-QdkZtV2_FVx49Xg+dRNXCGwFteCgc7gMMUX1_6sOw@mail.gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=gowtham.ab@samsung.com \
    --cc=linux-bluetooth@vger.kernel.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.