From fb52e9446e570146735876aa9b38e617316ea36f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 26 Feb 2018 18:34:43 +0100 Subject: [PATCH] logind: check file is device node before using .st_rdev --- src/login/logind.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/login/logind.c b/src/login/logind.c index ed250bc2a..481c5e40e 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -480,6 +480,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 -- 2.30.2