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]
Message-ID: <20100806165844.GB3364@suse.de>
Date:	Fri, 6 Aug 2010 09:58:44 -0700
From:	Greg KH <gregkh@...e.de>
To:	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] tty_io: add an API to get device corresponding to
 tty_struct

On Fri, Aug 06, 2010 at 08:29:28PM +0400, Dmitry Eremin-Solenikov wrote:
> Some device drivers (mostly tty line disciplines) would like to have way
> to get a struct device instancve corresponding to passed tty_struct. Add
> respective API call.
> 
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@...il.com>
> ---
>  drivers/char/tty_io.c |   20 ++++++++++++++++++++
>  include/linux/tty.h   |    1 +
>  2 files changed, 21 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
> index d71f0fc..43fdeef 100644
> --- a/drivers/char/tty_io.c
> +++ b/drivers/char/tty_io.c
> @@ -3017,6 +3017,26 @@ dev_t tty_devnum(struct tty_struct *tty)
>  }
>  EXPORT_SYMBOL(tty_devnum);
>  
> +static int dev_match_devt(struct device *dev, void *data)
> +{
> +	dev_t *devt = data;
> +	return dev->devt == *devt;
> +}
> +
> +/**
> + * 	tty_get_device - get a device corresponding to tty
> + * 	@tty: the struct that describes the tty device
> + *
> + * 	Returns a pointer to the struct device for this tty device
> + * 	(or NULL in case of error).

You should add some wording here that says that the device now has an
increased reference count and that you better drop it when you are done
with it, otherwise it will stay around for a while.

Other than that, I like the idea.

Care to redo it?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ