From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: kernel/bpf/helpers.c:1260:33-38: ERROR: t is NULL but dereferenced.
Date: Sun, 1 Dec 2024 18:01:49 +0800 [thread overview]
Message-ID: <202412011718.lsm0y2Aw-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Alexei Starovoitov <ast@kernel.org>
CC: Daniel Borkmann <daniel@iogearbox.net>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bcc8eda6d34934d80b96adb8dc4ff5dfc632a53a
commit: b00628b1c7d595ae5b544e059c27b1f5828314b4 bpf: Introduce bpf timers.
date: 3 years, 5 months ago
:::::: branch date: 7 hours ago
:::::: commit date: 3 years, 5 months ago
config: x86_64-randconfig-102-20241120 (https://download.01.org/0day-ci/archive/20241201/202412011718.lsm0y2Aw-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202412011718.lsm0y2Aw-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> kernel/bpf/helpers.c:1260:33-38: ERROR: t is NULL but dereferenced.
vim +1260 kernel/bpf/helpers.c
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1232
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1233 BPF_CALL_1(bpf_timer_cancel, struct bpf_timer_kern *, timer)
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1234 {
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1235 struct bpf_hrtimer *t;
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1236 int ret = 0;
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1237
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1238 if (in_nmi())
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1239 return -EOPNOTSUPP;
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1240 __bpf_spin_lock_irqsave(&timer->lock);
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1241 t = timer->timer;
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1242 if (!t) {
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1243 ret = -EINVAL;
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1244 goto out;
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1245 }
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1246 if (this_cpu_read(hrtimer_running) == t) {
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1247 /* If bpf callback_fn is trying to bpf_timer_cancel()
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1248 * its own timer the hrtimer_cancel() will deadlock
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1249 * since it waits for callback_fn to finish
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1250 */
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1251 ret = -EDEADLK;
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1252 goto out;
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1253 }
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1254 drop_prog_refcnt(t);
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1255 out:
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1256 __bpf_spin_unlock_irqrestore(&timer->lock);
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1257 /* Cancel the timer and wait for associated callback to finish
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1258 * if it was running.
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1259 */
b00628b1c7d595 Alexei Starovoitov 2021-07-14 @1260 ret = ret ?: hrtimer_cancel(&t->timer);
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1261 return ret;
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1262 }
b00628b1c7d595 Alexei Starovoitov 2021-07-14 1263
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-12-01 10:02 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=202412011718.lsm0y2Aw-lkp@intel.com \
--to=lkp@intel.com \
--cc=julia.lawall@inria.fr \
--cc=oe-kbuild@lists.linux.dev \
/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.