From: Al Viro <viro@ZenIV.linux.org.uk>
To: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no>
Cc: netdev@vger.kernel.org
Subject: very odd check in caif_seqpkt_sendmsg()
Date: Thu, 20 Nov 2014 08:54:25 +0000 [thread overview]
Message-ID: <20141120085425.GM7996@ZenIV.linux.org.uk> (raw)
This check is very odd:
if (unlikely(msg->msg_iov->iov_base == NULL))
goto err;
What happens if we get call it with msg_iovlen being 0? verify_iovec()
(or rw_copy_check_uvector(), for that matter) is just fine with that -
sendmsg() purely for msg_control is normal on e.g. AF_UNIX sockets.
And we end with ->msg_iov pointing to iovstack[], with iovstack[0] being
uninitialized. So at the very least your check is going to yield random
results in that case.
What is it supposed to check for? Note that memcpy_fromiovec() won't blow
up on NULL ->iov_base - with zero len it won't even look there and with
non-zero it'll fail with -EFAULT.
Was that intended to be if (unlikely(!len)) fail with EINVAL? Something
entirely different?
reply other threads:[~2014-11-20 8:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20141120085425.GM7996@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=dmitry.tarnyagin@lockless.no \
--cc=netdev@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).