Commit 937108b0 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 83f4997a 8fc75bed
...@@ -1895,6 +1895,11 @@ static int nfs_parse_devname(const char *dev_name, ...@@ -1895,6 +1895,11 @@ static int nfs_parse_devname(const char *dev_name,
size_t len; size_t len;
char *end; char *end;
if (unlikely(!dev_name || !*dev_name)) {
dfprintk(MOUNT, "NFS: device name not specified\n");
return -EINVAL;
}
/* Is the host name protected with square brakcets? */ /* Is the host name protected with square brakcets? */
if (*dev_name == '[') { if (*dev_name == '[') {
end = strchr(++dev_name, ']'); end = strchr(++dev_name, ']');
......
...@@ -621,11 +621,12 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, ...@@ -621,11 +621,12 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
nfs_set_page_writeback(page); nfs_set_page_writeback(page);
WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags)); WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags));
ret = 0; ret = req->wb_context->error;
/* If there is a fatal error that covers this write, just exit */ /* If there is a fatal error that covers this write, just exit */
if (nfs_error_is_fatal_on_server(req->wb_context->error)) if (nfs_error_is_fatal_on_server(ret))
goto out_launder; goto out_launder;
ret = 0;
if (!nfs_pageio_add_request(pgio, req)) { if (!nfs_pageio_add_request(pgio, req)) {
ret = pgio->pg_error; ret = pgio->pg_error;
/* /*
...@@ -635,9 +636,9 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, ...@@ -635,9 +636,9 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
nfs_context_set_write_error(req->wb_context, ret); nfs_context_set_write_error(req->wb_context, ret);
if (nfs_error_is_fatal_on_server(ret)) if (nfs_error_is_fatal_on_server(ret))
goto out_launder; goto out_launder;
} } else
nfs_redirty_request(req);
ret = -EAGAIN; ret = -EAGAIN;
nfs_redirty_request(req);
} else } else
nfs_add_stats(page_file_mapping(page)->host, nfs_add_stats(page_file_mapping(page)->host,
NFSIOS_WRITEPAGES, 1); NFSIOS_WRITEPAGES, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment