netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NET: slip, fix ldisc->open retval
@ 2011-05-06 16:23 Matvejchikov Ilya
  2011-05-08 17:37 ` Oliver Hartkopp
  2011-05-09 18:53 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Matvejchikov Ilya @ 2011-05-06 16:23 UTC (permalink / raw)
  To: netdev

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);
-- 
1.7.5.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] NET: slip, fix ldisc->open retval
  2011-05-06 16:23 [PATCH] NET: slip, fix ldisc->open retval Matvejchikov Ilya
@ 2011-05-08 17:37 ` Oliver Hartkopp
  2011-05-08 18:25   ` Alan Cox
  2011-05-09 18:53 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Oliver Hartkopp @ 2011-05-08 17:37 UTC (permalink / raw)
  To: matvejchikov, Alan Cox, Jeff Dike; +Cc: Linux Netdev List

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] NET: slip, fix ldisc->open retval
  2011-05-08 17:37 ` Oliver Hartkopp
@ 2011-05-08 18:25   ` Alan Cox
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2011-05-08 18:25 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: matvejchikov, Jeff Dike, Linux Netdev List

> Looks reasonable to me.

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

> Alan?

Acked-by: Alan Cox <alan@linux.intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] NET: slip, fix ldisc->open retval
  2011-05-06 16:23 [PATCH] NET: slip, fix ldisc->open retval Matvejchikov Ilya
  2011-05-08 17:37 ` Oliver Hartkopp
@ 2011-05-09 18:53 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2011-05-09 18:53 UTC (permalink / raw)
  To: matvejchikov; +Cc: netdev

From: Matvejchikov Ilya <matvejchikov@gmail.com>
Date: Fri, 6 May 2011 20:23:09 +0400

> TTY layer expects 0 if the ldisc->open operation succeeded.
> 
> Signed-off-by : Matvejchikov Ilya <matvejchikov@gmail.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-09 18:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-06 16:23 [PATCH] NET: slip, fix ldisc->open retval Matvejchikov Ilya
2011-05-08 17:37 ` Oliver Hartkopp
2011-05-08 18:25   ` Alan Cox
2011-05-09 18:53 ` David Miller

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).