RE: [PATCH] Crash in tun
From: David Laight <hidden>
Date: 2012-07-23 09:44:10
Also in:
linux-sctp
BTW, speaking of struct file treatment related to sockets -
there's this piece of code in iscsi:
/*
* The SCTP stack needs struct socket->file.
*/
if ((np->np_network_transport == ISCSI_SCTP_TCP) ||
(np->np_network_transport == ISCSI_SCTP_UDP)) {
if (!new_sock->file) {
new_sock->file = kzalloc(
sizeof(struct file),
GFP_KERNEL);
For one thing, as far as I can see it'not true - sctp does *not*
depend on socket->file being non-NULL; it does, in one place,
check socket->file->f_flags for O_NONBLOCK, but there it treats
NULL socket->file as "flag no set".The SCTP code certainly has unconditionally looked at file->f_flags, we had to allocate a 'struct file' for our in-kernel socket code. We set sock->file = NULL before the sock_release() call so hopefully don't suffer the 'side effects'. David