lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 7 Jul 2018 14:09:21 -0700
From:   Steve Longerbeam <slongerbeam@...il.com>
To:     Sakari Ailus <sakari.ailus@....fi>,
        Steve Longerbeam <slongerbeam@...il.com>
Cc:     linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 15/17] media: platform: Switch to
 v4l2_async_notifier_add_subdev

Hi Sakari,


On 07/02/2018 04:23 AM, Sakari Ailus wrote:
> On Fri, Jun 29, 2018 at 11:49:59AM -0700, Steve Longerbeam wrote:
>> diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
>> index a96f53c..8464ceb 100644
>> --- a/drivers/media/platform/davinci/vpif_capture.c
>> +++ b/drivers/media/platform/davinci/vpif_capture.c
>> @@ -1553,7 +1553,7 @@ vpif_capture_get_pdata(struct platform_device *pdev)
>>   					    sizeof(*chan->inputs),
>>   					    GFP_KERNEL);
>>   		if (!chan->inputs)
>> -			return NULL;
>> +			goto err_cleanup;
>>   
>>   		chan->input_count++;
>>   		chan->inputs[i].input.type = V4L2_INPUT_TYPE_CAMERA;
>> @@ -1587,28 +1587,30 @@ vpif_capture_get_pdata(struct platform_device *pdev)
>>   			rem->name, rem);
>>   		sdinfo->name = rem->full_name;
>>   
>> -		pdata->asd[i] = devm_kzalloc(&pdev->dev,
>> -					     sizeof(struct v4l2_async_subdev),
>> -					     GFP_KERNEL);
>> -		if (!pdata->asd[i]) {
>> +		pdata->asd[i] = v4l2_async_notifier_add_fwnode_subdev(
>> +			&vpif_obj.notifier, of_fwnode_handle(rem),
>> +			sizeof(struct v4l2_async_subdev));
>> +		if (IS_ERR(pdata->asd[i])) {
>>   			of_node_put(rem);
>> -			pdata = NULL;
>> -			goto done;
>> +			goto err_cleanup;
>>   		}
>>   
>> -		pdata->asd[i]->match_type = V4L2_ASYNC_MATCH_FWNODE;
>> -		pdata->asd[i]->match.fwnode = of_fwnode_handle(rem);
>> -		of_node_put(rem);
>> +		of_node_put(endpoint);
> You end up putting the same endpoint twice in the successful case.
>
> One way to address that would be to get the OF node's remote port parent
> (i.e. the device) immediately so you can forget OF node use counts in error
> handling.
>

Thanks for catching. I ended up doing what you suggested, moved the get
of remote port parent to just after getting local endpoint node, and removed
node puts in the done and cleanup paths, in vpif_capture_get_pdata().

Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ