Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1618851

Re: [PATCH] [media] media-entity: only call dev_dbg_obj if mdev is not NULL

Path csiph.com!feeder.erje.net!1.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.unit0.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Helen Koike <helen.koike@collabora.com>
Newsgroups linux.kernel
Subject Re: [PATCH] [media] media-entity: only call dev_dbg_obj if mdev is not NULL
Date Fri, 07 Apr 2017 16:40:02 +0200
Message-ID <ttDdo-8mD-11@gated-at.bofh.it> (permalink)
References <ttlqa-58h-19@gated-at.bofh.it> <ttwOC-4ar-9@gated-at.bofh.it>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 55
Organization linux.* mail to news gateway
X-Original-Cc linux-media@vger.kernel.org, mchehab@kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Fri, 7 Apr 2017 11:36:29 -0300
X-Original-Message-ID <f3f83e8f-41e3-3567-8ec6-c4e693e7297e@collabora.com>
X-Original-References <1491507120-28112-1-git-send-email-helen.koike@collabora.com> <20170407074015.GB4192@valkosipuli.retiisi.org.uk>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1618851

Show key headers only | View raw


Hi Sakari,

On 2017-04-07 04:40 AM, Sakari Ailus wrote:
> Hi Helen,
>
> On Thu, Apr 06, 2017 at 04:32:00PM -0300, Helen Koike wrote:
>> Fix kernel Oops NULL pointer deference
>> Call dev_dbg_obj only after checking if gobj->mdev is not NULL
>>
>> Signed-off-by: Helen Koike <helen.koike@collabora.com>
>> ---
>>  drivers/media/media-entity.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
>> index 5640ca2..bc44193 100644
>> --- a/drivers/media/media-entity.c
>> +++ b/drivers/media/media-entity.c
>> @@ -199,12 +199,12 @@ void media_gobj_create(struct media_device *mdev,
>>
>>  void media_gobj_destroy(struct media_gobj *gobj)
>>  {
>> -	dev_dbg_obj(__func__, gobj);
>> -
>>  	/* Do nothing if the object is not linked. */
>>  	if (gobj->mdev == NULL)
>>  		return;
>>
>> +	dev_dbg_obj(__func__, gobj);
>> +
>>  	gobj->mdev->topology_version++;
>>
>>  	/* Remove the object from mdev list */
>
> Where is media_gobj_destroy() called with an object with NULL mdev?
>
> I do not object to the change, but would like to know because I don't think
> it's supposed to happen.


This happens when media_device_unregister(mdev) is called before 
unregistering the subdevices v4l2_device_unregister_subdev(sd) (which 
should be possible).

v4l2_device_unregister_subdev(sd) ends up calling v4l2_device_release() 
that calls media_device_unregister_entity() again (previously called by 
media_device_unregister(mdev)

Helen

>
> There are issues though, until the patches fixing object referencing are
> finished and merged. Unfortunately I haven't been able to work on those
> recently, will pick them up again soon...
>

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] [media] media-entity: only call dev_dbg_obj if mdev is not NULL Helen Koike <helen.koike@collabora.com> - 2017-04-06 21:40 +0200
  Re: [PATCH] [media] media-entity: only call dev_dbg_obj if mdev is  not NULL Sakari Ailus <sakari.ailus@iki.fi> - 2017-04-07 09:50 +0200
    Re: [PATCH] [media] media-entity: only call dev_dbg_obj if mdev is  not NULL Helen Koike <helen.koike@collabora.com> - 2017-04-07 16:40 +0200

csiph-web