Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: linux-afs@lists.infradead.org
Cc: Kees Cook <keescook@chromium.org>,
	dhowells@redhat.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/6] afs: Fix use of BUG()
Date: Tue, 09 Jun 2020 17:13:26 +0100	[thread overview]
Message-ID: <159171920664.3038039.18059422273265286162.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <159171918506.3038039.10915051218779105094.stgit@warthog.procyon.org.uk>

Fix afs_compare_addrs() to use WARN_ON(1) instead of BUG() and return 1
(ie. srx_a > srx_b).

There's no point trying to put actual error handling in as this should not
occur unless a new transport address type is allowed by AFS.  And even if
it does, in this particular case, it'll just never match unknown types of
addresses.  This BUG() was more of a 'you need to add a case here'
indicator.

Reported-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/afs/vl_alias.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/afs/vl_alias.c b/fs/afs/vl_alias.c
index 093895c49c21..136fc6164e00 100644
--- a/fs/afs/vl_alias.c
+++ b/fs/afs/vl_alias.c
@@ -73,7 +73,8 @@ static int afs_compare_addrs(const struct sockaddr_rxrpc *srx_a,
 	}
 
 	default:
-		BUG();
+		WARN_ON(1);
+		diff = 1;
 	}
 
 out:



  parent reply	other threads:[~2020-06-09 16:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 16:13 [PATCH 0/6] afs: Fixes David Howells
2020-06-09 16:13 ` [PATCH 1/6] afs: Fix memory leak in afs_put_sysnames() David Howells
2020-06-09 16:13 ` [PATCH 2/6] afs: Fix file locking David Howells
2020-06-09 16:13 ` David Howells [this message]
2020-06-09 16:19   ` [PATCH 3/6] afs: Fix use of BUG() Kees Cook
2020-06-09 16:13 ` [PATCH 4/6] afs: Fix debugging statements with %px to be %p David Howells
2020-06-09 16:18   ` Kees Cook
2020-06-09 17:08   ` Marc Dionne
2020-06-09 16:13 ` [PATCH 5/6] afs: Remove afs_zero_fid as it's not used David Howells
2020-06-09 16:13 ` [PATCH 6/6] afs: Make afs_zap_data() static David Howells

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=159171920664.3038039.18059422273265286162.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 3/6] afs: Fix use of BUG()' \
    /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

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