• Andrew Morton's avatar
    [PATCH] ramfs o_sync oops fix · 97e012bb
    Andrew Morton authored
    Writing to ramfs files with O_SYNC dereferences null in mpage_writepages(),
    due to null a_ops->writepage.  The call path is
    
    	generic_file_aio_write_nolock
    	->generic_osync_inode
    	  ->write_inode_now
    	    ->__writeback_single_inode
    	      ->__sync_single_inode
    	        ->do_writepages
    	          ->mpage_writepages
    
    The best fix for this is to visit all ram-backed filesystems and give them a
    no-op a_ops.writepages.  But baling out if the file is memory-backed is a
    sufficient coverall and is how we handle this in __filemap_fdatawrite().
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    97e012bb
fs-writeback.c 18.6 KB