Gerd Hoffmann bab9df35ce usb-mtp: use O_NOFOLLOW and O_CLOEXEC.
Open files and directories with O_NOFOLLOW to avoid symlinks attacks.
While being at it also add O_CLOEXEC.

usb-mtp only handles regular files and directories and ignores
everything else, so users should not see a difference.

Because qemu ignores symlinks, carrying out a successful symlink attack
requires swapping an existing file or directory below rootdir for a
symlink and winning the race against the inotify notification to qemu.

Fixes: CVE-2018-16872
Cc: Prasad J Pandit <ppandit@redhat.com>
Cc: Bandan Das <bsd@redhat.com>
Reported-by: Michael Hanselmann <public@hansmi.ch>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Michael Hanselmann <public@hansmi.ch>
Message-id: 20181213122511.13853-1-kraxel@redhat.com
2018-12-14 08:52:14 +01:00
..
2018-11-27 12:59:00 +01:00
2018-10-25 20:17:12 +01:00
2018-11-27 15:35:15 +01:00
2018-10-24 06:44:59 -03:00
2018-11-27 15:35:15 +01:00
2018-10-24 06:44:59 -03:00
2018-11-12 11:26:02 +00:00
2018-11-27 15:35:15 +01:00
2018-11-27 15:35:15 +01:00
2018-11-08 14:42:37 +00:00
2016-01-29 15:07:25 +00:00
2018-08-18 18:01:34 +03:00
2018-11-27 15:35:15 +01:00
2018-11-27 15:35:15 +01:00
2018-11-05 09:55:01 +01:00
2018-11-27 15:35:15 +01:00
2018-10-26 17:17:32 +02:00