tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS head: fc5b1a61061cb6d640f3336024fb616182ef2614 commit: 325d9be9a6518184aec9fdbd87f11759b1e32a56 [3143/23857] tty: fix possible deadlock in console_unlock config: arm64-randconfig-001-20241025 (https://download.01.org/0day-ci/archive/20241025/202410251039.YhQeKMJn-lkp@i...) compiler: aarch64-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241025/202410251039.YhQeKMJn-lkp@i...)
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 | Closes: https://lore.kernel.org/oe-kbuild-all/202410251039.YhQeKMJn-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/tty/tty_buffer.c: In function 'tty_buffer_alloc': drivers/tty/tty_buffer.c:170:9: error: implicit declaration of function 'printk_safe_enter'; did you mean 'printk_safe_init'? [-Werror=implicit-function-declaration] 170 | printk_safe_enter(); | ^~~~~~~~~~~~~~~~~ | printk_safe_init
drivers/tty/tty_buffer.c:172:9: error: implicit declaration of function 'printk_safe_exit'; did you mean 'printk_safe_init'? [-Werror=implicit-function-declaration]
172 | printk_safe_exit(); | ^~~~~~~~~~~~~~~~ | printk_safe_init cc1: some warnings being treated as errors
vim +172 drivers/tty/tty_buffer.c
137 138 /** 139 * tty_buffer_alloc - allocate a tty buffer 140 * @tty: tty device 141 * @size: desired size (characters) 142 * 143 * Allocate a new tty buffer to hold the desired number of characters. 144 * We round our buffers off in 256 character chunks to get better 145 * allocation behaviour. 146 * Return NULL if out of memory or the allocation would exceed the 147 * per device queue 148 */ 149 150 static struct tty_buffer *tty_buffer_alloc(struct tty_port *port, size_t size) 151 { 152 struct llist_node *free; 153 struct tty_buffer *p; 154 155 /* Round the buffer size out */ 156 size = __ALIGN_MASK(size, TTYB_ALIGN_MASK); 157 158 if (size <= MIN_TTYB_SIZE) { 159 free = llist_del_first(&port->buf.free); 160 if (free) { 161 p = llist_entry(free, struct tty_buffer, free); 162 goto found; 163 } 164 } 165 166 /* Should possibly check if this fails for the largest buffer we 167 have queued and recycle that ? */ 168 if (atomic_read(&port->buf.mem_used) > port->buf.mem_limit) 169 return NULL; 170 printk_safe_enter(); 171 p = kmalloc(sizeof(struct tty_buffer) + 2 * size, GFP_ATOMIC);
172 printk_safe_exit();
173 if (p == NULL) 174 return NULL; 175 176 found: 177 tty_buffer_reset(p, size); 178 atomic_add(size, &port->buf.mem_used); 179 return p; 180 } 181