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>] [day] [month] [year] [list]
Message-ID: <202208151006.5QHVQK8p-lkp@intel.com>
Date:   Mon, 15 Aug 2022 11:28:15 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, David Howells <dhowells@...hat.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: fs/afs/server.c:406 afs_put_server() warn: variable dereferenced
 before check 'server' (see line 402)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   568035b01cfb107af8d2e4bd2fb9aea22cf5b868
commit: 2757a4dc184997c66ef1de32636f73b9f21aac14 afs: Fix access after dec in put functions
config: parisc-randconfig-m031-20220807 (https://download.01.org/0day-ci/archive/20220815/202208151006.5QHVQK8p-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
fs/afs/server.c:406 afs_put_server() warn: variable dereferenced before check 'server' (see line 402)

vim +/server +406 fs/afs/server.c

452181936931f0 David Howells  2019-06-20  399  void afs_put_server(struct afs_net *net, struct afs_server *server,
452181936931f0 David Howells  2019-06-20  400  		    enum afs_server_trace reason)
^1da177e4c3f41 Linus Torvalds 2005-04-16  401  {
2757a4dc184997 David Howells  2022-07-06 @402  	unsigned int a, debug_id = server->debug_id;
                                                                           ^^^^^^^^^^^^^^^^
Dereferenced

c56f9ec8b20f93 David Howells  2022-07-06  403  	bool zero;
c56f9ec8b20f93 David Howells  2022-07-06  404  	int r;
d2ddc776a4581d David Howells  2017-11-02  405  
^1da177e4c3f41 Linus Torvalds 2005-04-16 @406  	if (!server)
                                                    ^^^^^^^
Can this check be deleted?

^1da177e4c3f41 Linus Torvalds 2005-04-16  407  		return;
^1da177e4c3f41 Linus Torvalds 2005-04-16  408  
2757a4dc184997 David Howells  2022-07-06  409  	a = atomic_inc_return(&server->active);
c56f9ec8b20f93 David Howells  2022-07-06  410  	zero = __refcount_dec_and_test(&server->ref, &r);
2757a4dc184997 David Howells  2022-07-06  411  	trace_afs_server(debug_id, r - 1, a, reason);
c56f9ec8b20f93 David Howells  2022-07-06  412  	if (unlikely(zero))
977e5f8ed0ab27 David Howells  2020-04-17  413  		__afs_put_server(net, server);
977e5f8ed0ab27 David Howells  2020-04-17  414  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ