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: <b360242d-f488-da51-9d47-36b2abdf90cd@kernel.org>
Date:   Tue, 18 Aug 2020 10:35:21 +0200
From:   Jiri Slaby <jirislaby@...nel.org>
To:     Tong Zhang <ztong0001@...il.com>, jikos@...nel.org,
        dsterba@...e.com, gregkh@...uxfoundation.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tty: ipwireless: fix error handling

On 16. 08. 20, 9:43, Tong Zhang wrote:
> ipwireless_send_packet() can only return 0 on success and -ENOMEM on
> error, the caller should check non zero for error condition
> 
> Signed-off-by: Tong Zhang <ztong0001@...il.com>
> ---
>  drivers/tty/ipwireless/network.c | 4 ++--
>  drivers/tty/ipwireless/tty.c     | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/ipwireless/network.c b/drivers/tty/ipwireless/network.c
> index cf20616340a1..b6f677f4004c 100644
> --- a/drivers/tty/ipwireless/network.c
> +++ b/drivers/tty/ipwireless/network.c
> @@ -117,7 +117,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel,
>  					       skb->len,
>  					       notify_packet_sent,
>  					       network);
> -			if (ret == -1) {
> +			if (ret != 0) {

More consistent (with the rest of the kernel), would be to check "< 0"
in all the places.

>  				skb_pull(skb, 2);
>  				return 0;
>  			}
> @@ -134,7 +134,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel,
>  					       notify_packet_sent,
>  					       network);
>  			kfree(buf);
> -			if (ret == -1)
> +			if (ret != 0)
>  				return 0;
>  		}
>  		kfree_skb(skb);
> diff --git a/drivers/tty/ipwireless/tty.c b/drivers/tty/ipwireless/tty.c
> index fad3401e604d..0230e0fd3937 100644
> --- a/drivers/tty/ipwireless/tty.c
> +++ b/drivers/tty/ipwireless/tty.c
> @@ -218,7 +218,7 @@ static int ipw_write(struct tty_struct *linux_tty,
>  	ret = ipwireless_send_packet(tty->hardware, IPW_CHANNEL_RAS,
>  			       buf, count,
>  			       ipw_write_packet_sent_callback, tty);
> -	if (ret == -1) {
> +	if (ret != 0) {
>  		mutex_unlock(&tty->ipw_tty_mutex);
>  		return 0;
>  	}
> 


-- 
js
suse labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ