lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 7 Aug 2014 12:25:44 +0400
From:	Cyrill Gorcunov <>
To:	LKML <>, Jiri Slaby <>,
	Greg Kroah-Hartman <>
Cc:	Pavel Emelyanov <>
Subject: Question on release_one_tty

Hi guys, could you please explain me the sequence

static void release_one_tty(struct work_struct *work)
	struct tty_struct *tty =
		container_of(work, struct tty_struct, hangup_work);
	struct tty_driver *driver = tty->driver;

	if (tty->ops->cleanup)

	tty->magic = 0;
-->	tty_driver_kref_put(driver);
-->	module_put(driver->owner);

why tty_driver_kref_put is called before module_put? As far as I understand
tty_driver_kref_put may call the destruct_tty_driver which eventually does

static void destruct_tty_driver(struct kref *kref)
	struct tty_driver *driver = container_of(kref, struct tty_driver, kref);
-->	kfree(driver);

so that the module_put(driver->owner) would access freed memory. Should not we
call the reverse module_put and then tty_driver_kref_put, or I miss something

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists