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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202007231701.CV9tyb31%lkp@intel.com>
Date:   Thu, 23 Jul 2020 17:29:14 +0800
From:   kernel test robot <lkp@...el.com>
To:     Johan Hovold <johan@...nel.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Dmitry Safonov <0x7f454c46@...il.com>
Subject: drivers/tty/serial/pmac_zilog.c:255:36: sparse: sparse: context
 imbalance in 'pmz_receive_chars' - unexpected unlock

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d15be546031cf65a0fc34879beca02fd90fe7ac7
commit: 08d5470308ac3598e7709d08b8979ce6e9de8da2 serial: core: fix sysrq overhead regression
date:   4 weeks ago
config: m68k-randconfig-s032-20200723 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-93-g4c6cbe55-dirty
        git checkout 08d5470308ac3598e7709d08b8979ce6e9de8da2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=m68k 

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


sparse warnings: (new ones prefixed by >>)

>> drivers/tty/serial/pmac_zilog.c:255:36: sparse: sparse: context imbalance in 'pmz_receive_chars' - unexpected unlock

vim +/pmz_receive_chars +255 drivers/tty/serial/pmac_zilog.c

7cf82b1b65833f drivers/tty/serial/pmac_zilog.c Finn Thain      2011-12-06  214  
2e124b4a390ca8 drivers/tty/serial/pmac_zilog.c Jiri Slaby      2013-01-03  215  static bool pmz_receive_chars(struct uart_pmac_port *uap)
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  216  {
92a19f9cec9a80 drivers/tty/serial/pmac_zilog.c Jiri Slaby      2013-01-03  217  	struct tty_port *port;
13b4353bb05568 drivers/tty/serial/pmac_zilog.c YueHaibing      2018-09-20  218  	unsigned char ch, r1, drop, flag;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  219  	int loops = 0;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  220  
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  221  	/* Sanity check, make sure the old bug is no longer happening */
2e124b4a390ca8 drivers/tty/serial/pmac_zilog.c Jiri Slaby      2013-01-03  222  	if (uap->port.state == NULL) {
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  223  		WARN_ON(1);
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  224  		(void)read_zsdata(uap);
2e124b4a390ca8 drivers/tty/serial/pmac_zilog.c Jiri Slaby      2013-01-03  225  		return false;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  226  	}
92a19f9cec9a80 drivers/tty/serial/pmac_zilog.c Jiri Slaby      2013-01-03  227  	port = &uap->port.state->port;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  228  
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  229  	while (1) {
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  230  		drop = 0;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  231  
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  232  		r1 = read_zsreg(uap, R1);
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  233  		ch = read_zsdata(uap);
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  234  
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  235  		if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) {
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  236  			write_zsreg(uap, R0, ERR_RES);
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  237  			zssync(uap);
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  238  		}
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  239  
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  240  		ch &= uap->parity_mask;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  241  		if (ch == 0 && uap->flags & PMACZILOG_FLAG_BREAK) {
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  242  			uap->flags &= ~PMACZILOG_FLAG_BREAK;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  243  		}
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  244  
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  245  #if defined(CONFIG_MAGIC_SYSRQ) && defined(CONFIG_SERIAL_CORE_CONSOLE)
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  246  #ifdef USE_CTRL_O_SYSRQ
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  247  		/* Handle the SysRq ^O Hack */
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  248  		if (ch == '\x0f') {
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  249  			uap->port.sysrq = jiffies + HZ*5;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  250  			goto next_char;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  251  		}
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  252  #endif /* USE_CTRL_O_SYSRQ */
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  253  		if (uap->port.sysrq) {
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  254  			int swallow;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16 @255  			spin_unlock(&uap->port.lock);
7d12e780e003f9 drivers/serial/pmac_zilog.c     David Howells   2006-10-05  256  			swallow = uart_handle_sysrq_char(&uap->port, ch);
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  257  			spin_lock(&uap->port.lock);
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  258  			if (swallow)
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  259  				goto next_char;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  260  		}
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  261  #endif /* CONFIG_MAGIC_SYSRQ && CONFIG_SERIAL_CORE_CONSOLE */
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  262  
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  263  		/* A real serial line, record the character and status.  */
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  264  		if (drop)
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  265  			goto next_char;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  266  
33f0f88f1c51ae drivers/serial/pmac_zilog.c     Alan Cox        2006-01-09  267  		flag = TTY_NORMAL;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  268  		uap->port.icount.rx++;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  269  
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  270  		if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR | BRK_ABRT)) {
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  271  			if (r1 & BRK_ABRT) {
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  272  				pmz_debug("pmz: got break !\n");
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  273  				r1 &= ~(PAR_ERR | CRC_ERR);
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  274  				uap->port.icount.brk++;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  275  				if (uart_handle_break(&uap->port))
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  276  					goto next_char;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  277  			}
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  278  			else if (r1 & PAR_ERR)
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  279  				uap->port.icount.parity++;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  280  			else if (r1 & CRC_ERR)
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  281  				uap->port.icount.frame++;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  282  			if (r1 & Rx_OVR)
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  283  				uap->port.icount.overrun++;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  284  			r1 &= uap->port.read_status_mask;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  285  			if (r1 & BRK_ABRT)
33f0f88f1c51ae drivers/serial/pmac_zilog.c     Alan Cox        2006-01-09  286  				flag = TTY_BREAK;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  287  			else if (r1 & PAR_ERR)
33f0f88f1c51ae drivers/serial/pmac_zilog.c     Alan Cox        2006-01-09  288  				flag = TTY_PARITY;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  289  			else if (r1 & CRC_ERR)
33f0f88f1c51ae drivers/serial/pmac_zilog.c     Alan Cox        2006-01-09  290  				flag = TTY_FRAME;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  291  		}
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  292  
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  293  		if (uap->port.ignore_status_mask == 0xff ||
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  294  		    (r1 & uap->port.ignore_status_mask) == 0) {
92a19f9cec9a80 drivers/tty/serial/pmac_zilog.c Jiri Slaby      2013-01-03  295  			tty_insert_flip_char(port, ch, flag);
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  296  		}
33f0f88f1c51ae drivers/serial/pmac_zilog.c     Alan Cox        2006-01-09  297  		if (r1 & Rx_OVR)
92a19f9cec9a80 drivers/tty/serial/pmac_zilog.c Jiri Slaby      2013-01-03  298  			tty_insert_flip_char(port, 0, TTY_OVERRUN);
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  299  	next_char:
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  300  		/* We can get stuck in an infinite loop getting char 0 when the
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  301  		 * line is in a wrong HW state, we break that here.
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  302  		 * When that happens, I disable the receive side of the driver.
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  303  		 * Note that what I've been experiencing is a real irq loop where
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  304  		 * I'm getting flooded regardless of the actual port speed.
25985edcedea63 drivers/tty/serial/pmac_zilog.c Lucas De Marchi 2011-03-30  305  		 * Something strange is going on with the HW
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  306  		 */
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  307  		if ((++loops) > 1000)
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  308  			goto flood;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  309  		ch = read_zsreg(uap, R0);
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  310  		if (!(ch & Rx_CH_AV))
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  311  			break;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  312  	}
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  313  
2e124b4a390ca8 drivers/tty/serial/pmac_zilog.c Jiri Slaby      2013-01-03  314  	return true;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  315   flood:
7cf82b1b65833f drivers/tty/serial/pmac_zilog.c Finn Thain      2011-12-06  316  	pmz_interrupt_control(uap, 0);
ec9cbe09899e36 drivers/serial/pmac_zilog.c     Finn Thain      2009-11-17  317  	pmz_error("pmz: rx irq flood !\n");
2e124b4a390ca8 drivers/tty/serial/pmac_zilog.c Jiri Slaby      2013-01-03  318  	return true;
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  319  }
^1da177e4c3f41 drivers/serial/pmac_zilog.c     Linus Torvalds  2005-04-16  320  

:::::: The code at line 255 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@...970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@...970.osdl.org>

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

Download attachment ".config.gz" of type "application/gzip" (21908 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ