Jesper Juhl c9b3febc5b Fix a use after free bug in kernel->userspace relay file support
Coverity spotted what looks like a real possible case of using a variable
after it has been freed.  The problem is in
kernel/relay.c::relay_open_buf()

If the code hits "goto free_buf;" it ends up in this code :

  free_buf:
    	relay_destroy_buf(buf);	<--- calls kfree() on 'buf'.
  free_name:
   	kfree(tmpname);
  end:
  	return buf;		<-- use after free of 'buf'.

I read through the callers and they all handle a NULL return from this
function as an error (and hitting the 'free_buf' label only happens on
failure to chan->cb->create_buf_file(), so that looks like a clear error to
me).

The patch simply sets 'buf' to NULL after the call to
relay_destroy_buf(buf); - as far as I can see that should take care of the
problem.

The patch also corrects a reference to a documentation file while
I was at it.

Note from Mathieu: the documentation reference change should have been
done in a separate patch, but I guess no one will really care.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: "David J. Wilder" <wilder@us.ibm.com>
Tested-by: "David J. Wilder" <wilder@us.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Tom Zanussi <zanussi@us.ibm.com>
Cc: Karim Yaghmour <karim@opersys.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-31 15:39:42 -07:00
..
2007-07-16 09:05:47 -07:00
2007-07-16 12:05:49 +03:00
2007-07-18 08:47:40 -07:00
2007-07-31 15:39:40 -07:00
2006-12-07 08:39:36 -08:00
2007-07-16 09:05:50 -07:00
2007-07-26 11:33:06 -07:00
2007-07-20 12:01:34 -07:00
2006-12-04 02:00:22 -05:00
2007-07-31 15:39:40 -07:00
2007-07-16 09:05:47 -07:00
2007-07-19 10:04:49 -07:00
2007-05-21 09:18:19 -07:00
2007-07-16 09:05:49 -07:00
2007-07-16 09:05:49 -07:00
2007-07-16 09:05:49 -07:00
2007-07-09 18:51:58 +02:00
2007-07-31 15:39:38 -07:00
2007-07-16 09:05:50 -07:00
2007-07-22 11:03:37 -07:00
2007-07-29 16:53:59 -07:00
2007-05-09 08:57:56 +02:00
2007-07-17 10:23:03 -07:00