Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1422707

[PATCH 3.12 01/56] NFS: Don't attempt to decode missing directory entries

From Jiri Slaby <jslaby@suse.cz>
Newsgroups linux.kernel
Subject [PATCH 3.12 01/56] NFS: Don't attempt to decode missing directory entries
Date 2016-06-15 09:40 +0200
Message-ID <rKdAC-80i-21@gated-at.bofh.it> (permalink)
References <rKdAC-80i-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Benjamin Coddington <bcodding@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit ce85cfbed6fe3dbc01bd1976b23ac3e97878cde6 upstream.

If a READDIR reply comes back without any page data, avoid a NULL pointer
dereference in xdr_copy_to_scratch().

BUG: unable to handle kernel NULL pointer dereference at 0000000000000001
IP: [<ffffffff813a378d>] memcpy+0xd/0x110
...
Call Trace:
	? xdr_inline_decode+0x7a/0xb0 [sunrpc]
	nfs3_decode_dirent+0x73/0x320 [nfsv3]
	nfs_readdir_page_filler+0xd5/0x4e0 [nfs]
	? nfs3_rpc_wrapper.constprop.9+0x42/0xc0 [nfsv3]
	nfs_readdir_xdr_to_array+0x1fa/0x330 [nfs]
	? mem_cgroup_commit_charge+0xac/0x160
	? nfs_readdir_xdr_to_array+0x330/0x330 [nfs]
	nfs_readdir_filler+0x22/0x90 [nfs]
	do_read_cache_page+0x7e/0x1a0
	read_cache_page+0x1c/0x20
	nfs_readdir+0x18e/0x660 [nfs]
	? nfs3_xdr_dec_getattr3res+0x80/0x80 [nfsv3]
	iterate_dir+0x97/0x130
	SyS_getdents+0x94/0x120
	? fillonedir+0xd0/0xd0
	system_call_fastpath+0x12/0x17

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Neil Brown <nfbrown@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/dir.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 140280623348..cf6ede69a2e2 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -510,6 +510,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
 	if (scratch == NULL)
 		return -ENOMEM;
 
+	if (buflen == 0)
+		goto out_nopages;
+
 	xdr_init_decode_pages(&stream, &buf, xdr_pages, buflen);
 	xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
 
@@ -531,6 +534,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
 			break;
 	} while (!entry->eof);
 
+out_nopages:
 	if (count == 0 || (status == -EBADCOOKIE && entry->eof != 0)) {
 		array = nfs_readdir_get_array(page);
 		if (!IS_ERR(array)) {
-- 
2.9.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby <jslaby@suse.cz> - 2016-06-15 09:40 +0200
  [PATCH 3.12 01/56] NFS: Don't attempt to decode missing directory entries Jiri Slaby <jslaby@suse.cz> - 2016-06-15 09:40 +0200
  [PATCH 3.12 05/56] HID: microsoft: Add Surface Power Cover Jiri Slaby <jslaby@suse.cz> - 2016-06-15 09:50 +0200
    [PATCH 3.12 24/56] USB: serial: quatech2: fix use-after-free in probe error path Jiri Slaby <jslaby@suse.cz> - 2016-06-15 09:50 +0200
    [PATCH 3.12 20/56] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings Jiri Slaby <jslaby@suse.cz> - 2016-06-15 09:50 +0200
    [PATCH 3.12 08/56] HID: Add new Microsoft Type Cover 3 product ID Jiri Slaby <jslaby@suse.cz> - 2016-06-15 09:50 +0200
    [PATCH 3.12 22/56] [media] usbvision: revert commit 588afcc1 Jiri Slaby <jslaby@suse.cz> - 2016-06-15 09:50 +0200
    [PATCH 3.12 25/56] USB: serial: io_edgeport: fix memory leaks in attach error path Jiri Slaby <jslaby@suse.cz> - 2016-06-15 09:50 +0200
    [PATCH 3.12 17/56] ring-buffer: Use long for nr_pages to avoid overflow failures Jiri Slaby <jslaby@suse.cz> - 2016-06-15 09:50 +0200
  Re: [PATCH 3.12 00/56] 3.12.61-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2016-06-15 17:40 +0200
    Re: [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby <jslaby@suse.cz> - 2016-06-20 10:10 +0200
  Re: [PATCH 3.12 00/56] 3.12.61-stable review Guenter Roeck <linux@roeck-us.net> - 2016-06-15 20:50 +0200

csiph-web