Skip to content

Commit 937108b

Browse files
committed
Merge tag 'nfs-for-5.0-3' of git://git.linux-nfs.org/projects/anna/linux-nfs
Pull NFS client fixes from Anna Schumaker: "This addresses two bugs, one in the error code handling of nfs_page_async_flush() and one to fix a potential NULL pointer dereference in nfs_parse_devname(). Stable bugfix: - Fix up return value on fatal errors in nfs_page_async_flush() Other bugfix: - Fix NULL pointer dereference of dev_name" * tag 'nfs-for-5.0-3' of git://git.linux-nfs.org/projects/anna/linux-nfs: NFS: Fix up return value on fatal errors in nfs_page_async_flush() nfs: Fix NULL pointer dereference of dev_name
2 parents 83f4997 + 8fc75be commit 937108b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

fs/nfs/super.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,6 +1895,11 @@ static int nfs_parse_devname(const char *dev_name,
18951895
size_t len;
18961896
char *end;
18971897

1898+
if (unlikely(!dev_name || !*dev_name)) {
1899+
dfprintk(MOUNT, "NFS: device name not specified\n");
1900+
return -EINVAL;
1901+
}
1902+
18981903
/* Is the host name protected with square brakcets? */
18991904
if (*dev_name == '[') {
19001905
end = strchr(++dev_name, ']');

fs/nfs/write.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,11 +621,12 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
621621
nfs_set_page_writeback(page);
622622
WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags));
623623

624-
ret = 0;
624+
ret = req->wb_context->error;
625625
/* If there is a fatal error that covers this write, just exit */
626-
if (nfs_error_is_fatal_on_server(req->wb_context->error))
626+
if (nfs_error_is_fatal_on_server(ret))
627627
goto out_launder;
628628

629+
ret = 0;
629630
if (!nfs_pageio_add_request(pgio, req)) {
630631
ret = pgio->pg_error;
631632
/*
@@ -635,9 +636,9 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
635636
nfs_context_set_write_error(req->wb_context, ret);
636637
if (nfs_error_is_fatal_on_server(ret))
637638
goto out_launder;
638-
}
639+
} else
640+
ret = -EAGAIN;
639641
nfs_redirty_request(req);
640-
ret = -EAGAIN;
641642
} else
642643
nfs_add_stats(page_file_mapping(page)->host,
643644
NFSIOS_WRITEPAGES, 1);

0 commit comments

Comments
 (0)