From: coverity-bot <keescook@chromium.org>
To: Eric Dumazet <edumazet@google.com>
Cc: linux-kernel@vger.kernel.org,
Marc Kleine-Budde <mkl@pengutronix.de>,
Paolo Abeni <pabeni@redhat.com>,
Stefano Garzarella <sgarzare@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
Nikolay Aleksandrov <nikolay@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>,
netdev@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
linux-next@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Coverity: __sock_gen_cookie(): Error handling issues
Date: Thu, 17 Nov 2022 14:22:34 -0800 [thread overview]
Message-ID: <202211171422.7A7A7A9@keescook> (raw)
Hello!
This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221117 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:
Wed Nov 16 12:42:01 2022 +0000
4ebf802cf1c6 ("net: __sock_gen_cookie() cleanup")
Coverity reported the following:
*** CID 1527347: Error handling issues (CHECKED_RETURN)
net/core/sock_diag.c:33 in __sock_gen_cookie()
27 {
28 u64 res = atomic64_read(&sk->sk_cookie);
29
30 if (!res) {
31 u64 new = gen_cookie_next(&sock_cookie);
32
vvv CID 1527347: Error handling issues (CHECKED_RETURN)
vvv Calling "atomic64_try_cmpxchg" without checking return value (as is done elsewhere 8 out of 9 times).
33 atomic64_try_cmpxchg(&sk->sk_cookie, &res, new);
34 }
35 return res;
36 }
37
38 int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie)
If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527347 ("Error handling issues")
Fixes: 4ebf802cf1c6 ("net: __sock_gen_cookie() cleanup")
Thanks for your attention!
--
Coverity-bot
next reply other threads:[~2022-11-17 22:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 22:22 coverity-bot [this message]
2022-11-17 22:49 ` Coverity: __sock_gen_cookie(): Error handling issues Eric Dumazet
2022-11-17 23:14 ` Kees Cook
2022-11-17 23:22 ` Eric Dumazet
2022-11-18 0:25 ` Kees Cook
2022-11-18 1:24 ` Eric Dumazet
2022-11-18 2:16 ` Kees Cook
2022-11-18 4:40 ` Eric Dumazet
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=202211171422.7A7A7A9@keescook \
--to=keescook@chromium.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=gustavo@embeddedor.com \
--cc=kuba@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=pabeni@redhat.com \
--cc=sgarzare@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.