Hi Mohamed,

On Fri, Jan 28, 2011 at 10:50:46AM -0800, Mohamed Abbas wrote:
> Add support to call registered proxy driver and report
> proxy to client.
> 
> Also Make sure we cancel proxy request if we got disconnected and still
> waiting for proxy request. Also make sure we set/clear token correctly
Ok, almost there. I only have one issue left:

> @@ -168,13 +173,16 @@ static int location_detect(struct connman_location 
> *location)
>       g_web_set_user_agent(data->web, "ConnMan/%s", VERSION);
>       g_web_set_close_connection(data->web, TRUE);
>  
> -     err = connman_proxy_lookup(interface, STATUS_URL,
> -                                     proxy_callback, location);
> -     if (err < 0)
> -             goto done;
> +     service = connman_location_get_service(location);
> +     data->token = connman_proxy_lookup(interface, STATUS_URL,
> +                                     service, proxy_callback, location);
>  
> -     connman_location_ref(location);
> -     err = 0;
> +     if (data->token == 0)
> +             err = -EINVAL;
> +     else {
> +             connman_location_ref(location);
> +             err = 0;
> +     }
So it seems to me that this is potentially racy: We should take the location
reference before calling connman_proxy_lookup(), and then unreferencing if
connman_proxy_lookup() fails.

I think there is another issue with referening here since we're unreferencing
the location pointer from the proxy callback, while we should be doing so from
the web_result() one. But we'll fix that in a separate patch.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to