netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: matvejchikov@gmail.com, Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Jeff Dike <jdike@addtoit.com>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: Re: [PATCH] NET: slip, fix ldisc->open retval
Date: Sun, 08 May 2011 19:37:19 +0200	[thread overview]
Message-ID: <4DC6D4CF.2080006@hartkopp.net> (raw)
In-Reply-To: <BANLkTinWqaoMNHbOb5PbZzewQafWhBfY4Q@mail.gmail.com>

On 06.05.2011 18:23, Matvejchikov Ilya wrote:
> TTY layer expects 0 if the ldisc->open operation succeeded.
> 
> Signed-off-by : Matvejchikov Ilya <matvejchikov@gmail.com>
> ---
>  drivers/net/slip.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/slip.c b/drivers/net/slip.c
> index 86cbb9e..8ec1a9a 100644
> --- a/drivers/net/slip.c
> +++ b/drivers/net/slip.c
> @@ -853,7 +853,9 @@ static int slip_open(struct tty_struct *tty)
>  	/* Done.  We have linked the TTY line to a channel. */
>  	rtnl_unlock();
>  	tty->receive_room = 65536;	/* We don't flow control */
> -	return sl->dev->base_addr;
> +
> +	/* TTY layer expects 0 on success */
> +	return 0;
> 
>  err_free_bufs:
>  	sl_free_bufs(sl);

sl->dev->base_addr holds the index into the pointer array of the slip devices.
This is a value >= 0.

The return values of tty_ldisc_open in drivers/tty/tty_ldisc.c are checking
for errors with '< 0' but in some cases they check for '!= 0' which is
correctly addressed in this patch.

Looks reasonable to me.

Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>

Alan?

There is also a slip_open() in arch/um/drivers/slip_user.c which also returns
positive numbers (filedescriptors) having the same issue ... Jeff?

Once this patch is accepted, i would send a similar patch for
drivers/net/can/slcan.c too.

Regards,
Oliver

  reply	other threads:[~2011-05-08 17:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06 16:23 [PATCH] NET: slip, fix ldisc->open retval Matvejchikov Ilya
2011-05-08 17:37 ` Oliver Hartkopp [this message]
2011-05-08 18:25   ` Alan Cox
2011-05-09 18:53 ` David Miller

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=4DC6D4CF.2080006@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jdike@addtoit.com \
    --cc=matvejchikov@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).