Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1402027
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.14 02/17] get_rock_ridge_filename(): handle malformed NM entries |
| Date | 2016-05-17 04:10 +0200 |
| Message-ID | <rzCCm-6LQ-15@gated-at.bofh.it> (permalink) |
| References | <rzBPX-6dy-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <viro@zeniv.linux.org.uk>
commit 99d825822eade8d827a1817357cbf3f889a552d6 upstream.
Payloads of NM entries are not supposed to contain NUL. When we run
into such, only the part prior to the first NUL goes into the
concatenation (i.e. the directory entry name being encoded by a bunch
of NM entries). We do stop when the amount collected so far + the
claimed amount in the current NM entry exceed 254. So far, so good,
but what we return as the total length is the sum of *claimed*
sizes, not the actual amount collected. And that can grow pretty
large - not unlimited, since you'd need to put CE entries in
between to be able to get more than the maximum that could be
contained in one isofs directory entry / continuation chunk and
we are stop once we'd encountered 32 CEs, but you can get about 8Kb
easily. And that's what will be passed to readdir callback as the
name length. 8Kb __copy_to_user() from a buffer allocated by
__get_free_page()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/isofs/rock.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
--- a/fs/isofs/rock.c
+++ b/fs/isofs/rock.c
@@ -203,6 +203,8 @@ int get_rock_ridge_filename(struct iso_d
int retnamlen = 0;
int truncate = 0;
int ret = 0;
+ char *p;
+ int len;
if (!ISOFS_SB(inode->i_sb)->s_rock)
return 0;
@@ -267,12 +269,17 @@ repeat:
rr->u.NM.flags);
break;
}
- if ((strlen(retname) + rr->len - 5) >= 254) {
+ len = rr->len - 5;
+ if (retnamlen + len >= 254) {
truncate = 1;
break;
}
- strncat(retname, rr->u.NM.name, rr->len - 5);
- retnamlen += rr->len - 5;
+ p = memchr(rr->u.NM.name, '\0', len);
+ if (unlikely(p))
+ len = p - rr->u.NM.name;
+ memcpy(retname + retnamlen, rr->u.NM.name, len);
+ retnamlen += len;
+ retname[retnamlen] = '\0';
break;
case SIG('R', 'E'):
kfree(rs.buffer);
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3.14 00/17] 3.14.70-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:20 +0200
[PATCH 3.14 05/17] drm/radeon: fix PLL sharing on DCE6.1 (v2) Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:20 +0200
[PATCH 3.14 08/17] decnet: Do not build routes to devices without decnet private data. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:20 +0200
[PATCH 3.14 14/17] VSOCK: do not disconnect socket when peer has shutdown SEND only Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 03:20 +0200
[PATCH 3.14 16/17] net: fix a kernel infoleak in x25 module Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 04:10 +0200
[PATCH 3.14 03/17] Input: max8997-haptic - fix NULL pointer dereference Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 04:10 +0200
[PATCH 3.14 09/17] route: do not cache fib route info on local routes with oif Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 04:10 +0200
[PATCH 3.14 01/17] crypto: hash - Fix page length clamping in hash walk Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 04:10 +0200
[PATCH 3.14 04/17] asmlinkage, pnp: Make variables used from assembler code visible Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 04:10 +0200
[PATCH 3.14 15/17] net: bridge: fix old ioctl unlocked net device walk Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 04:10 +0200
[PATCH 3.14 17/17] arm64: Make arch_randomize_brk avoid stack area Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 04:10 +0200
Re: [PATCH 3.14 17/17] arm64: Make arch_randomize_brk avoid stack area "Jon Medhurst (Tixy)" <tixy@linaro.org> - 2016-05-17 12:00 +0200
Re: [PATCH 3.14 17/17] arm64: Make arch_randomize_brk avoid stack area Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 22:40 +0200
[PATCH 3.14 02/17] get_rock_ridge_filename(): handle malformed NM entries Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 04:10 +0200
[PATCH 3.14 11/17] atl2: Disable unimplemented scatter/gather feature Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 04:10 +0200
Re: [PATCH 3.14 00/17] 3.14.70-stable review Guenter Roeck <linux@roeck-us.net> - 2016-05-17 06:10 +0200
Re: [PATCH 3.14 00/17] 3.14.70-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 22:40 +0200
Re: [PATCH 3.14 00/17] 3.14.70-stable review Guenter Roeck <linux@roeck-us.net> - 2016-05-17 19:30 +0200
Re: [PATCH 3.14 00/17] 3.14.70-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 22:40 +0200
Re: [PATCH 3.14 00/17] 3.14.70-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2016-05-17 19:30 +0200
Re: [PATCH 3.14 00/17] 3.14.70-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-17 22:40 +0200
Re: [PATCH 3.14 00/17] 3.14.70-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-19 06:00 +0200
csiph-web