Re: [PATCH BlueZ] shared/gatt-client: Fix possible crash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, Apr 1, 2015 at 3:18 PM, Luiz Augusto von Dentz
<luiz.dentz@xxxxxxxxx> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
>
> Similar to issue found with unit test it is necessary to protect
> bt_gatt_client instance before calling the callback otherwise it may
> destroy it causing a crash.
> ---
>  src/shared/gatt-client.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
> index df994d7..b92d7b1 100644
> --- a/src/shared/gatt-client.c
> +++ b/src/shared/gatt-client.c
> @@ -2456,14 +2456,17 @@ static void complete_write_long_op(struct request *req, bool success,
>         if (req->att_id)
>                 return;
>
> -
>         request_unref(req);
>         success = false;
>
> +       bt_gatt_client_ref(op->client);
> +
>         if (op->callback)
>                 op->callback(success, reliable_error, att_ecode, op->user_data);
>
>         start_next_long_write(op->client);
> +
> +       bt_gatt_client_unref(op->client);
>  }
>
>  static void prepare_write_cb(uint8_t opcode, const void *pdu, uint16_t length,
> --
> 2.1.0

Applied.


-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux