Commit 9fb7007d authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'char-misc-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc fix from Greg KH:
 "Here is a single fix, for the chrdev core, for 5.5-rc6

  There's been a long-standing race condition triggered by syzbot, and
  occasionally real people, in the chrdev open() path. Will finally took
  the time to track it down and fix it for real before the holidays.

  Here's that one patch, it's been in linux-next for a while with no
  reported issues and it does fix the reported problem"

* tag 'char-misc-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  chardev: Avoid potential use-after-free in 'chrdev_open()'
parents 7da37cd0 68faa679
...@@ -352,7 +352,7 @@ static struct kobject *cdev_get(struct cdev *p) ...@@ -352,7 +352,7 @@ static struct kobject *cdev_get(struct cdev *p)
if (owner && !try_module_get(owner)) if (owner && !try_module_get(owner))
return NULL; return NULL;
kobj = kobject_get(&p->kobj); kobj = kobject_get_unless_zero(&p->kobj);
if (!kobj) if (!kobj)
module_put(owner); module_put(owner);
return kobj; return kobj;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment