[PATCH 4.9 02/31] chardev: Avoid potential use-after-free in chrdev_open()