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]
Date:   Wed, 9 Jun 2021 18:06:24 +0000
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Qian Cai <quic_qiancai@...cinc.com>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        David Sterba <dsterba@...e.com>,
        Miklos Szeredi <miklos@...redi.hu>,
        Anton Altaparmakov <anton@...era.com>,
        David Howells <dhowells@...hat.com>,
        Matthew Wilcox <willy@...radead.org>,
        Pavel Begunkov <asml.silence@...il.com>
Subject: Re: [RFC PATCH 16/37] iov_iter_gap_alignment(): get rid of
 iterate_all_kinds()

On Wed, Jun 09, 2021 at 09:01:36AM -0400, Qian Cai wrote:

> On 6/6/2021 3:10 PM, Al Viro wrote:
> > For one thing, it's only used for iovec (and makes sense only for those).
                        ^^^^^^^^^^^^^^^^^^^

[snip]

> > -	if (unlikely(iov_iter_is_pipe(i) || iov_iter_is_discard(i))) {
> > +	if (unlikely(iter_is_iovec(i))) {
                     ^^^^^^^^^^^^^^^^
This.  A nice demonstration of braino repeatedly overlooked on read-through,
especially when the change described in commit message is obvious and
looks similar to the change done in the patch.

Happens without any deliberate attacks involved - as the matter of fact,
it's easier to spot that kind of crap in somebody else's patch...

Anyway, the obvious fix (
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 3a68f578695f..6569e3f5d01d 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1402,10 +1402,8 @@ unsigned long iov_iter_gap_alignment(const struct iov_iter *i)
 	size_t size = i->count;
 	unsigned k;
 
-	if (unlikely(iter_is_iovec(i))) {
-		WARN_ON(1);
+	if (WARN_ON(!iter_is_iovec(i)))
 		return ~0U;
-	}
 
 	for (k = 0; k < i->nr_segs; k++) {
 		if (i->iov[k].iov_len) {
) folded in and pushed...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ