All of lore.kernel.org
 help / color / mirror / Atom feed
* kernel/bpf/helpers.c:1260:33-38: ERROR: t is NULL but dereferenced.
@ 2024-12-01 10:01 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-12-01 10:01 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Julia Lawall

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-01 10:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-01 10:01 kernel/bpf/helpers.c:1260:33-38: ERROR: t is NULL but dereferenced kernel test robot

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.