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: <CALx6S34LmkS1kYmYxaNZcUHFc8=f_oxauojG0b-t0zAD1YRKkQ@mail.gmail.com>
Date:   Tue, 24 Oct 2017 18:41:00 -0700
From:   Tom Herbert <tom@...bertland.com>
To:     "Gustavo A. R. Silva" <garsilva@...eddedor.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Linux Kernel Network Developers <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] rxrpc: recvmsg: use BUG_ON instead of if condition
 followed by BUG

Please combine these related patches fixing BUG in rxrpc into a patch
set with proper annotation,

Also, can any of these BUG_ONs be replaced by WARN_ONs? Warnings are
generally preferable to crashing the system.

Tom


On Tue, Oct 24, 2017 at 9:20 AM, Gustavo A. R. Silva
<garsilva@...eddedor.com> wrote:
> Use BUG_ON instead of if condition followed by BUG.
>
> This issue was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <garsilva@...eddedor.com>
> ---
>  net/rxrpc/recvmsg.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c
> index bdece21..9598b92 100644
> --- a/net/rxrpc/recvmsg.c
> +++ b/net/rxrpc/recvmsg.c
> @@ -243,8 +243,7 @@ static int rxrpc_verify_packet(struct rxrpc_call *call, struct sk_buff *skb,
>          */
>         if ((annotation & RXRPC_RX_ANNO_JUMBO) > 1) {
>                 __be16 tmp;
> -               if (skb_copy_bits(skb, offset - 2, &tmp, 2) < 0)
> -                       BUG();
> +               BUG_ON(skb_copy_bits(skb, offset - 2, &tmp, 2) < 0);
>                 cksum = ntohs(tmp);
>                 seq += (annotation & RXRPC_RX_ANNO_JUMBO) - 1;
>         }
> @@ -503,8 +502,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
>
>         release_sock(&rx->sk);
>
> -       if (test_bit(RXRPC_CALL_RELEASED, &call->flags))
> -               BUG();
> +       BUG_ON(test_bit(RXRPC_CALL_RELEASED, &call->flags));
>
>         if (test_bit(RXRPC_CALL_HAS_USERID, &call->flags)) {
>                 if (flags & MSG_CMSG_COMPAT) {
> --
> 2.7.4
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ