Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um: port_user: Improve error handling when port-helper is not found

Check if port-helper exists and is executable. If not, write an error
message to the kernel log with information to help the user diagnose the
issue and exit with an error. If UML_PORT_HELPER was not set, write a
message suggesting that the user set it. This makes it easier to understand
why telneting to the UML instance is failing and what can be done to fix it.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Signed-off-by: Richard Weinberger <richard@nod.at>

authored by

Glenn Washburn and committed by
Richard Weinberger
3cb5a7f1 db8109a8

+12
+12
arch/um/drivers/port_user.c
··· 5 5 6 6 #include <stdio.h> 7 7 #include <stdlib.h> 8 + #include <string.h> 8 9 #include <errno.h> 9 10 #include <termios.h> 10 11 #include <unistd.h> ··· 179 178 new = accept(fd, NULL, 0); 180 179 if (new < 0) 181 180 return -errno; 181 + 182 + err = os_access(argv[2], X_OK); 183 + if (err < 0) { 184 + printk(UM_KERN_ERR "port_connection : error accessing port-helper " 185 + "executable at %s: %s\n", argv[2], strerror(-err)); 186 + if (env == NULL) 187 + printk(UM_KERN_ERR "Set UML_PORT_HELPER environment " 188 + "variable to path to uml-utilities port-helper " 189 + "binary\n"); 190 + goto out_close; 191 + } 182 192 183 193 err = os_pipe(socket, 0, 0); 184 194 if (err < 0)