public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* a kernel address leak via copy_to_user in drivers/tty/rocket.c
@ 2019-03-30  7:05 Fuqian Huang
  2019-03-30  7:14 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Fuqian Huang @ 2019-03-30  7:05 UTC (permalink / raw)
  To: gregkh, jslaby, linux-kernel

Hi, recently I found that there is a kernel address leaks to user
space via copy_to_user in
drivers/tty/rocket.c:1287 (linux-5.0.5)
static int rp_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned
long arg) {
  ...
  case RCKP_GET_STRUCT:
      if (copy_to_user(argp, info, sizeof(struct r_port))
  ...
}
The `info` is a struct r_port. and the field `r_port.port.ops` is an
constant pointer,
and it points to a constant object `rocket_port_ops` during the initialization.
(function init_r_port) (drivers/tty/rocket.c:633)

patch suggestion:
set the pointer field to null before the copy to user call.

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

end of thread, other threads:[~2019-03-30  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-30  7:05 a kernel address leak via copy_to_user in drivers/tty/rocket.c Fuqian Huang
2019-03-30  7:14 ` Greg KH
2019-03-30  8:02   ` Fuqian Huang
2019-03-30  8:11     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox