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: <202111261743.2W1C2ZA9-lkp@intel.com>
Date:   Tue, 30 Nov 2021 16:04:03 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Rao Shoaib <rao.shoaib@...cle.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: net/unix/af_unix.c:2471 manage_oob() warn: returning freed memory
 'skb'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   a4849f6000e29235a2707f22e39da6b897bb9543
commit: 314001f0bf927015e459c9d387d62a231fe93af3 af_unix: Add OOB support
config: openrisc-randconfig-m031-20211123 (https://download.01.org/0day-ci/archive/20211126/202111261743.2W1C2ZA9-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 11.2.0

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

smatch warnings:
net/unix/af_unix.c:2471 manage_oob() warn: returning freed memory 'skb'

vim +/skb +2471 net/unix/af_unix.c

314001f0bf92701 Rao Shoaib 2021-08-01  2446  static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,
314001f0bf92701 Rao Shoaib 2021-08-01  2447  				  int flags, int copied)
314001f0bf92701 Rao Shoaib 2021-08-01  2448  {
314001f0bf92701 Rao Shoaib 2021-08-01  2449  	struct unix_sock *u = unix_sk(sk);
314001f0bf92701 Rao Shoaib 2021-08-01  2450  
314001f0bf92701 Rao Shoaib 2021-08-01  2451  	if (!unix_skb_len(skb) && !(flags & MSG_PEEK)) {
314001f0bf92701 Rao Shoaib 2021-08-01  2452  		skb_unlink(skb, &sk->sk_receive_queue);
314001f0bf92701 Rao Shoaib 2021-08-01  2453  		consume_skb(skb);
314001f0bf92701 Rao Shoaib 2021-08-01  2454  		skb = NULL;
314001f0bf92701 Rao Shoaib 2021-08-01  2455  	} else {
314001f0bf92701 Rao Shoaib 2021-08-01  2456  		if (skb == u->oob_skb) {
314001f0bf92701 Rao Shoaib 2021-08-01  2457  			if (copied) {
314001f0bf92701 Rao Shoaib 2021-08-01  2458  				skb = NULL;
314001f0bf92701 Rao Shoaib 2021-08-01  2459  			} else if (sock_flag(sk, SOCK_URGINLINE)) {
314001f0bf92701 Rao Shoaib 2021-08-01  2460  				if (!(flags & MSG_PEEK)) {
314001f0bf92701 Rao Shoaib 2021-08-01  2461  					u->oob_skb = NULL;
314001f0bf92701 Rao Shoaib 2021-08-01  2462  					consume_skb(skb);

skb = NULL?

314001f0bf92701 Rao Shoaib 2021-08-01  2463  				}
314001f0bf92701 Rao Shoaib 2021-08-01  2464  			} else if (!(flags & MSG_PEEK)) {
314001f0bf92701 Rao Shoaib 2021-08-01  2465  				skb_unlink(skb, &sk->sk_receive_queue);
314001f0bf92701 Rao Shoaib 2021-08-01  2466  				consume_skb(skb);
314001f0bf92701 Rao Shoaib 2021-08-01  2467  				skb = skb_peek(&sk->sk_receive_queue);
314001f0bf92701 Rao Shoaib 2021-08-01  2468  			}
314001f0bf92701 Rao Shoaib 2021-08-01  2469  		}
314001f0bf92701 Rao Shoaib 2021-08-01  2470  	}
314001f0bf92701 Rao Shoaib 2021-08-01 @2471  	return skb;
314001f0bf92701 Rao Shoaib 2021-08-01  2472  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ