https://github.com/torvalds/linux
Revision 4faa3c8150c1d4f7b38d962eda7851083e218e3f authored by Fabio Checconi on 10 April 2008, 06:28:01 UTC, committed by Jens Axboe on 10 April 2008, 06:28:01 UTC
When switching scheduler from cfq, cfq_exit_queue() does not clear
ioc->ioc_data, leaving a dangling pointer that can deceive the following
lookups when the iosched is switched back to cfq.  The pattern that can
trigger that is the following:

    - elevator switch from cfq to something else;
    - module unloading, with elv_unregister() that calls cfq_free_io_context()
      on ioc freeing the cic (via the .trim op);
    - module gets reloaded and the elevator switches back to cfq;
    - reallocation of a cic at the same address as before (with a valid key).

To fix it just assign NULL to ioc_data in __cfq_exit_single_io_context(),
that is called from the regular exit path and from the elevator switching
code.  The only path that frees a cic and is not covered is the error handling
one, but cic's freed in this way are never cached in ioc_data.

Signed-off-by: Fabio Checconi <fabio@gandalf.sssup.it>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
1 parent 8191ecd
Raw File
Tip revision: 4faa3c8150c1d4f7b38d962eda7851083e218e3f authored by Fabio Checconi on 10 April 2008, 06:28:01 UTC
cfq-iosched: do not leak ioc_data across iosched switches
Tip revision: 4faa3c8
.gitignore
#
# NOTE! Don't add files that are generated in specific
# subdirectories here. Add them in the ".gitignore" file
# in that subdirectory instead.
#
# Normal rules
#
.*
*.o
*.o.*
*.a
*.s
*.ko
*.so
*.so.dbg
*.mod.c
*.i
*.lst
*.symtypes
*.order

#
# Top-level generic files
#
tags
TAGS
vmlinux*
!vmlinux.lds.S
System.map
Module.symvers
!.gitignore

#
# Generated include files
#
include/asm
include/asm-*/asm-offsets.h
include/config
include/linux/autoconf.h
include/linux/compile.h
include/linux/version.h
include/linux/utsrelease.h

# stgit generated dirs
patches-*

# quilt's files
patches
series

# cscope files
cscope.*

*.orig
*.rej
*~
\#*#
back to top