Open Source Telephony
 help / color / mirror / Atom feed
From: Alex J Lennon <ajlennon@dynamicdevices.co.uk>
To: ofono@ofono.org
Subject: Re: [PATCH 1/4] tc65: Replace tc65 plugin with cinterion plugin
Date: Wed, 13 May 2015 18:11:32 +0200	[thread overview]
Message-ID: <555377B4.1020400@dynamicdevices.co.uk> (raw)
In-Reply-To: <20150513151821.GC28082@rincewind.trouble.is>

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



On 13/05/2015 17:18, Philip Paeps wrote:
> On 2015-05-12 18:22:59 (+0100), Alex J Lennon <ajlennon@dynamicdevices.co.uk> wrote:
>> [...]
> Just paging through this driver this afternoon.  Sorry for not reviewing
> the earlier patches.  This caught my eye:
>
>> +static void cinterion_set_online(struct ofono_modem *modem, ofono_bool_t online,
>> +			ofono_modem_online_cb_t cb, void *user_data)
>> +{
>> +	GAtChat *chat = ofono_modem_get_data(modem);
>> +	struct cb_data *cbd = cb_data_new(cb, user_data);
>> +	char const *command = online ? "AT+CFUN=1" : "AT+CFUN=7";
>> +
>> +	DBG("modem %p %s", modem, online ? "online" : "offline");
>> +
>> +	if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
>> +		return;
>> +
>> +	g_free(cbd);
>> +
>> +	CALLBACK_WITH_FAILURE(cb, cbd->data);
>> +}
> Doesn't this expand into a use after free bug if g_at_chat_send() fails?
>

Yes I see what you mean. I also see other plugins (e.g. ublox) reverse
the order of the free and callback.

Have provided a patch to bring the cinterion plugin into line.

Regards,

Alex


  reply	other threads:[~2015-05-13 16:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12 17:22 [PATCH 1/4] tc65: Replace tc65 plugin with cinterion plugin Alex J Lennon
2015-05-12 17:23 ` [PATCH 2/4] atmodem: Add Cinterion quirk for signal strength Alex J Lennon
2015-05-13 14:58   ` Denis Kenzior
2015-05-12 17:23 ` [PATCH 3/4] cinterion: Register as OFONO_VENDOR_CINTERION Alex J Lennon
2015-05-13 14:59   ` Denis Kenzior
2015-05-12 17:23 ` [PATCH 4/4] udev: Add support for ehs6 name Alex J Lennon
2015-05-13 14:59   ` Denis Kenzior
2015-05-13 14:58 ` [PATCH 1/4] tc65: Replace tc65 plugin with cinterion plugin Denis Kenzior
2015-05-13 15:18 ` Philip Paeps
2015-05-13 16:11   ` Alex J Lennon [this message]
2015-05-13 20:58   ` Denis Kenzior

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=555377B4.1020400@dynamicdevices.co.uk \
    --to=ajlennon@dynamicdevices.co.uk \
    --cc=ofono@ofono.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox