[bug report] NFS: Use of mapping_set_error() results in spurious errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Trond Myklebust,

Commit 6c984083ec24 ("NFS: Use of mapping_set_error() results in
spurious errors") from Feb 15, 2022 (linux-next), leads to the
following Smatch static checker warning:

	fs/nfs/write.c:318 nfs_mapping_set_error()
	error: we previously assumed 'mapping->host' could be null (see line 315)

fs/nfs/write.c
    310 static void nfs_mapping_set_error(struct folio *folio, int error)
    311 {
    312         struct address_space *mapping = folio_file_mapping(folio);
    313 
    314         filemap_set_wb_err(mapping, error);
    315         if (mapping->host)
                    ^^^^^^^^^^^^^
The patch adds a check

    316                 errseq_set(&mapping->host->i_sb->s_wb_err,
    317                            error == -ENOSPC ? -ENOSPC : -EIO);
--> 318         nfs_set_pageerror(mapping);
                                  ^^^^^^^
But the next line dereferences mapping->host without checking.

    319 }

regards,
dan carpenter




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux