From: Lennart Poettering Date: Mon, 26 Feb 2018 17:34:43 +0000 (+0100) Subject: logind: check file is device node before using .st_rdev X-Git-Tag: v238~51^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=51ead3e3774aa9306d637723d92bbddf2258d2cb;p=thirdparty%2Fsystemd.git logind: check file is device node before using .st_rdev --- diff --git a/src/login/logind.c b/src/login/logind.c index 875d467cbbe..5220861c1d3 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -453,6 +453,12 @@ static int manager_attach_fds(Manager *m) { continue; } + if (!S_ISCHR(st.st_mode) && !S_ISBLK(st.st_mode)) { + log_debug("Device fd doesn't actually point to device node: %m"); + close_nointr(fd); + continue; + } + sd = hashmap_get(s->devices, &st.st_rdev); if (!sd) { /* Weird, we got an fd for a session device which wasn't