mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Max Kellermann <max@duempel.org>
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	Shuah Khan <shuahkh@osg.samsung.com>
Subject: Re: [PATCH 5/6] drivers/media/media-device: add "release" callback
Date: Thu, 9 Jun 2016 08:56:34 -0300	[thread overview]
Message-ID: <20160609085634.5c17b2ae@recife.lan> (raw)
In-Reply-To: <145856703865.21117.13877102672522214541.stgit@woodpecker.blarg.de>

Em Mon, 21 Mar 2016 14:30:38 +0100
Max Kellermann <max@duempel.org> escreveu:

> Allow the client to free its data structures only after all files have
> been closed (fixing use-after-free bugs).

Hmm... Shuah is also working on fixing such issues at the media controller
stuff, and I made a few fix patches myself.

Our work is at:
	https://git.linuxtv.org/mchehab/experimental.git/log/?h=media_cdev_fix

Please base your changes on it, to avoid conflicting work or rework.

I just rebased it on the top of media_tree (plus the patches for it
that I didn't push yet).


Thanks!
Mauro


> 
> Signed-off-by: Max Kellermann <max@duempel.org>
> ---
>  drivers/media/media-device.c |    9 +++++++--
>  include/media/media-device.h |    2 ++
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index 5c4669c..a3901f9 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -551,9 +551,14 @@ static DEVICE_ATTR(model, S_IRUGO, show_model, NULL);
>   * Registration/unregistration
>   */
>  
> -static void media_device_release(struct media_devnode *mdev)
> +static void media_device_release(struct media_devnode *devnode)
>  {
> -	dev_dbg(mdev->parent, "Media device released\n");
> +	struct media_device *mdev = to_media_device(devnode);
> +
> +	dev_dbg(devnode->parent, "Media device released\n");
> +
> +	if (mdev->release)
> +		mdev->release(mdev);
>  }
>  
>  /**
> diff --git a/include/media/media-device.h b/include/media/media-device.h
> index d385589..d184d0c 100644
> --- a/include/media/media-device.h
> +++ b/include/media/media-device.h
> @@ -326,6 +326,8 @@ struct media_device {
>  
>  	int (*link_notify)(struct media_link *link, u32 flags,
>  			   unsigned int notification);
> +
> +	void (*release)(struct media_device *mdev);
>  };
>  
>  #ifdef CONFIG_MEDIA_CONTROLLER
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Thanks,
Mauro

  reply	other threads:[~2016-06-09 11:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-21 13:30 [PATCH 1/6] drivers/media/dvb-core/en50221: move code to dvb_ca_private_free() Max Kellermann
2016-03-21 13:30 ` [PATCH 2/6] drivers/media/dvb-core/en50221: postpone release until file is closed Max Kellermann
2016-06-09  9:38   ` Mauro Carvalho Chehab
2016-03-21 13:30 ` [PATCH 3/6] drivers/media/media-devnode: clear private_data before put_device() Max Kellermann
2016-03-21 13:30 ` [PATCH 4/6] drivers/media/media-device: move debug log before _devnode_unregister() Max Kellermann
2016-03-21 13:30 ` [PATCH 5/6] drivers/media/media-device: add "release" callback Max Kellermann
2016-06-09 11:56   ` Mauro Carvalho Chehab [this message]
2016-03-21 13:30 ` [PATCH 6/6] drivers/media/dvb-usb-dvb: postpone kfree(mdev) Max Kellermann
2016-03-21 13:45   ` kbuild test robot
2016-03-21 13:56   ` kbuild test robot
2016-03-21 13:55 ` [PATCH 1/6] drivers/media/dvb-core/en50221: move code to dvb_ca_private_free() kbuild test robot

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=20160609085634.5c17b2ae@recife.lan \
    --to=mchehab@osg.samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=max@duempel.org \
    --cc=shuahkh@osg.samsung.com \
    /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

Powered by JetHome