[PATCH] nfs: Don't deref potentially NULL pointer returned by strsep

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

 



In fs/nfs/nfsroot.c:root_nfs_parse_options() we call strsep(), which
may return NULL, but we do not test the return value before
dereferencing the pointer.

Signed-off-by: Jesper Juhl <jj@xxxxxxxxxxxxx>
---
 fs/nfs/nfsroot.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

  Compile tested only.

diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index c4744e1..b6ac860 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -191,6 +191,8 @@ static int __init root_nfs_parse_options(char *incoming, char *exppath,
 	 * Set the NFS remote path
 	 */
 	p = strsep(&incoming, ",");
+	if (!p)
+		return -1;
 	if (*p != '\0' && strcmp(p, "default") != 0)
 		if (root_nfs_copy(exppath, p, exppathlen))
 			return -1;
-- 
1.7.6


-- 
Jesper Juhl <jj@xxxxxxxxxxxxx>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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