mm: validate inode in mapping_set_error()

The swap address_space doesn't have host. Thus, it makes kernel crash once
swap write meets error. Fix it.

Fixes: 735e4ae5ba28 ("vfs: track per-sb writeback errors and report them to syncfs")
Signed-off-by: Minchan Kim <>
Signed-off-by: Andrew Morton <>
Acked-by: Jeff Layton <>
Cc: Jan Kara <>
Cc: Andres Freund <>
Cc: Matthew Wilcox <>
Cc: Al Viro <>
Cc: Christoph Hellwig <>
Cc: Dave Chinner <>
Cc: David Howells <>
Cc: <>
Signed-off-by: Linus Torvalds <>
1 file changed