Commit ccd608e
committed
NFSD: Add array bounds-checking in nfsd_iter_read()
The *count parameter does not appear to be explicitly restricted
to being smaller than rsize, so it might be possible to overrun
the rq_bvec or rq_pages arrays.
Rather than overrunning these arrays (damage done!) and then WARNING
once, let's harden the loop so that it terminates before the end of
the arrays are reached. This should result in a short read, which is
OK -- clients recover by sending additional READ requests for the
remaining unread bytes.
Reported-by: NeilBrown <neil@brown.name>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>1 parent b5fc406 commit ccd608e
1 file changed
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1115 | 1115 | | |
1116 | 1116 | | |
1117 | 1117 | | |
1118 | | - | |
| 1118 | + | |
| 1119 | + | |
1119 | 1120 | | |
1120 | | - | |
| 1121 | + | |
1121 | 1122 | | |
| 1123 | + | |
1122 | 1124 | | |
| 1125 | + | |
1123 | 1126 | | |
1124 | 1127 | | |
1125 | 1128 | | |
1126 | | - | |
1127 | 1129 | | |
1128 | | - | |
1129 | | - | |
| 1130 | + | |
| 1131 | + | |
1130 | 1132 | | |
1131 | 1133 | | |
1132 | 1134 | | |
| |||
0 commit comments