All of lore.kernel.org
 help / color / mirror / Atom feed
* NULL dereference in tty_open()
@ 2011-10-04 20:05 Dan Carpenter
  2011-10-05 14:22 ` NULL dereference in tty_open() [and other bugs there] Jiri Slaby
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Carpenter @ 2011-10-04 20:05 UTC (permalink / raw)
  To: linux-kernel

There is a NULL dereference here.  It was artificially triggered so
not a huge priority.

drivers/tty/tty_io.c
  1893          retval = tty_add_file(tty, filp);
  1894          if (retval) {
  1895                  tty_unlock();
  1896                  tty_release(inode, filp);
  1897                  return retval;
  1898          }

tty_add_file() is supposed to setup filp->private_data but the
allocation fails.  In tty_release() we call file_tty(filp),
__tty_fasync() and tty_del_file() which dereference
filp->private_data and Oops.

I looked at ptmx_open() to see how the error handling was done there.
That function only calls tty_release() if tty_add_file() succeeds,
so maybe we could just call devpts_kill_index() here and remove the
tty_release()?  I don't know the code well enough to say.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-10-16 19:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-04 20:05 NULL dereference in tty_open() Dan Carpenter
2011-10-05 14:22 ` NULL dereference in tty_open() [and other bugs there] Jiri Slaby
2011-10-12  9:32   ` [PATCH 1/4] TTY: drop driver reference in tty_open fail path Jiri Slaby
2011-10-12  9:32     ` [PATCH 2/4] TTY: make tty_add_file non-failing Jiri Slaby
2011-10-12  9:32     ` [PATCH 3/4] TTY: pty, release tty in all ptmx_open fail paths Jiri Slaby
2011-10-12 13:23       ` Arnd Bergmann
2011-10-12  9:32     ` [PATCH 4/4] TTY: call tty_driver_lookup_tty unconditionally Jiri Slaby
2011-10-12 20:59       ` Jiri Slaby
2011-10-16 19:20         ` Sukadev Bhattiprolu
2011-10-16 19:37           ` Jiri Slaby
2011-10-16 18:28     ` [PATCH 1/4] TTY: drop driver reference in tty_open fail path Sukadev Bhattiprolu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.