Revision e6838a29ecb484c97e4efef9429643b9851fba6e authored by J. Bruce Fields on 21 April 2017, 20:10:18 UTC, committed by J. Bruce Fields on 25 April 2017, 20:34:37 UTC
A client can append random data to the end of an NFSv2 or NFSv3 RPC call
without our complaining; we'll just stop parsing at the end of the
expected data and ignore the rest.

Encoded arguments and replies are stored together in an array of pages,
and if a call is too large it could leave inadequate space for the
reply.  This is normally OK because NFS RPC's typically have either
short arguments and long replies (like READ) or long arguments and short
replies (like WRITE).  But a client that sends an incorrectly long reply
can violate those assumptions.  This was observed to cause crashes.

Also, several operations increment rq_next_page in the decode routine
before checking the argument size, which can leave rq_next_page pointing
well past the end of the page array, causing trouble later in
svc_free_pages.

So, following a suggestion from Neil Brown, add a central check to
enforce our expectation that no NFSv2/v3 call has both a large call and
a large reply.

As followup we may also want to rewrite the encoding routines to check
more carefully that they aren't running off the end of the page array.

We may also consider rejecting calls that have any extra garbage
appended.  That would be safer, and within our rights by spec, but given
the age of our server and the NFS protocol, and the fact that we've
never enforced this before, we may need to balance that against the
possibility of breaking some oddball client.

Reported-by: Tuomas Haanpää <thaan@synopsys.com>
Reported-by: Ari Kauppi <ari@synopsys.com>
Cc: stable@vger.kernel.org
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent 5a7ad11
History
File Mode Size
ab8500 -rw-r--r-- 592 bytes
abituguru -rw-r--r-- 3.6 KB
abituguru-datasheet -rw-r--r-- 12.0 KB
abituguru3 -rw-r--r-- 2.4 KB
abx500 -rw-r--r-- 979 bytes
acpi_power_meter -rw-r--r-- 2.1 KB
ad7314 -rw-r--r-- 667 bytes
adc128d818 -rw-r--r-- 2.0 KB
adm1021 -rw-r--r-- 4.5 KB
adm1025 -rw-r--r-- 2.3 KB
adm1026 -rw-r--r-- 4.5 KB
adm1031 -rw-r--r-- 1.2 KB
adm1275 -rw-r--r-- 3.9 KB
adm9240 -rw-r--r-- 6.6 KB
ads1015 -rw-r--r-- 2.0 KB
ads7828 -rw-r--r-- 2.1 KB
adt7410 -rw-r--r-- 3.1 KB
adt7411 -rw-r--r-- 1.3 KB
adt7462 -rw-r--r-- 2.5 KB
adt7470 -rw-r--r-- 2.9 KB
adt7475 -rw-r--r-- 4.2 KB
amc6821 -rw-r--r-- 3.2 KB
asb100 -rw-r--r-- 2.0 KB
asc7621 -rw-r--r-- 8.9 KB
coretemp -rw-r--r-- 5.4 KB
da9052 -rw-r--r-- 2.3 KB
da9055 -rw-r--r-- 1.6 KB
dme1737 -rw-r--r-- 12.3 KB
ds1621 -rw-r--r-- 6.4 KB
ds620 -rw-r--r-- 1.3 KB
emc1403 -rw-r--r-- 2.4 KB
emc2103 -rw-r--r-- 1.2 KB
emc6w201 -rw-r--r-- 1.3 KB
f71805f -rw-r--r-- 6.5 KB
f71882fg -rw-r--r-- 5.4 KB
fam15h_power -rw-r--r-- 3.5 KB
ftsteutates -rw-r--r-- 947 bytes
g760a -rw-r--r-- 1.3 KB
g762 -rw-r--r-- 3.0 KB
gl518sm -rw-r--r-- 3.1 KB
hih6130 -rw-r--r-- 973 bytes
hwmon-kernel-api.txt -rw-r--r-- 12.0 KB
ibmaem -rw-r--r-- 1.4 KB
ibmpowernv -rw-r--r-- 1.3 KB
ina209 -rw-r--r-- 3.5 KB
ina2xx -rw-r--r-- 2.3 KB
ina3221 -rw-r--r-- 1.4 KB
it87 -rw-r--r-- 11.4 KB
jc42 -rw-r--r-- 4.1 KB
k10temp -rw-r--r-- 3.7 KB
k8temp -rw-r--r-- 2.0 KB
lineage-pem -rw-r--r-- 2.3 KB
lm25066 -rw-r--r-- 3.5 KB
lm63 -rw-r--r-- 3.3 KB
lm70 -rw-r--r-- 1.8 KB
lm73 -rw-r--r-- 2.7 KB
lm75 -rw-r--r-- 3.9 KB
lm77 -rw-r--r-- 1.6 KB
lm78 -rw-r--r-- 3.2 KB
lm80 -rw-r--r-- 2.8 KB
lm83 -rw-r--r-- 3.6 KB
lm85 -rw-r--r-- 10.4 KB
lm87 -rw-r--r-- 3.1 KB
lm90 -rw-r--r-- 10.7 KB
lm92 -rw-r--r-- 1.2 KB
lm93 -rw-r--r-- 12.7 KB
lm95234 -rw-r--r-- 1.7 KB
lm95245 -rw-r--r-- 1.7 KB
ltc2945 -rw-r--r-- 2.8 KB
ltc2978 -rw-r--r-- 7.3 KB
ltc2990 -rw-r--r-- 1.3 KB
ltc3815 -rw-r--r-- 1.5 KB
ltc4151 -rw-r--r-- 1.1 KB
ltc4215 -rw-r--r-- 1.2 KB
ltc4245 -rw-r--r-- 3.2 KB
ltc4260 -rw-r--r-- 1.6 KB
ltc4261 -rw-r--r-- 2.1 KB
max16064 -rw-r--r-- 2.3 KB
max16065 -rw-r--r-- 3.5 KB
max1619 -rw-r--r-- 886 bytes
max1668 -rw-r--r-- 2.3 KB
max197 -rw-r--r-- 1.9 KB
max20751 -rw-r--r-- 2.0 KB
max31722 -rw-r--r-- 857 bytes
max31790 -rw-r--r-- 1.2 KB
max34440 -rw-r--r-- 4.9 KB
max6639 -rw-r--r-- 2.2 KB
max6642 -rw-r--r-- 600 bytes
max6650 -rw-r--r-- 2.1 KB
max6697 -rw-r--r-- 2.1 KB
max8688 -rw-r--r-- 2.6 KB
mc13783-adc -rw-r--r-- 3.0 KB
mcp3021 -rw-r--r-- 992 bytes
menf21bmc -rw-r--r-- 1.2 KB
nct6683 -rw-r--r-- 2.0 KB
nct6775 -rw-r--r-- 8.0 KB
nct7802 -rw-r--r-- 805 bytes
nct7904 -rw-r--r-- 1.5 KB
nsa320 -rw-r--r-- 2.0 KB
ntc_thermistor -rw-r--r-- 2.6 KB
pc87360 -rw-r--r-- 7.5 KB
pc87427 -rw-r--r-- 1.9 KB
pcf8591 -rw-r--r-- 3.2 KB
pmbus -rw-r--r-- 7.1 KB
pmbus-core -rw-r--r-- 12.0 KB
powr1220 -rw-r--r-- 1.3 KB
pwm-fan -rw-r--r-- 597 bytes
sch5627 -rw-r--r-- 988 bytes
sch5636 -rw-r--r-- 1.3 KB
scpi-hwmon -rw-r--r-- 926 bytes
sht15 -rw-r--r-- 2.2 KB
sht21 -rw-r--r-- 1.6 KB
sht3x -rw-r--r-- 3.4 KB
shtc1 -rw-r--r-- 1.4 KB
sis5595 -rw-r--r-- 4.3 KB
smm665 -rw-r--r-- 5.5 KB
smsc47b397 -rw-r--r-- 4.5 KB
smsc47m1 -rw-r--r-- 2.5 KB
smsc47m192 -rw-r--r-- 3.9 KB
submitting-patches -rw-r--r-- 6.5 KB
sysfs-interface -rw-r--r-- 21.5 KB
tc654 -rw-r--r-- 1.0 KB
tc74 -rw-r--r-- 392 bytes
thmc50 -rw-r--r-- 2.6 KB
tmp102 -rw-r--r-- 929 bytes
tmp103 -rw-r--r-- 799 bytes
tmp108 -rw-r--r-- 1.3 KB
tmp401 -rw-r--r-- 2.3 KB
tmp421 -rw-r--r-- 1.5 KB
tps40422 -rw-r--r-- 2.0 KB
twl4030-madc-hwmon -rw-r--r-- 1.1 KB
ucd9000 -rw-r--r-- 4.9 KB
ucd9200 -rw-r--r-- 4.3 KB
userspace-tools -rw-r--r-- 1.5 KB
vexpress -rw-r--r-- 1.5 KB
via686a -rw-r--r-- 3.4 KB
vt1211 -rw-r--r-- 8.4 KB
w83627ehf -rw-r--r-- 8.0 KB
w83627hf -rw-r--r-- 4.1 KB
w83781d -rw-r--r-- 16.3 KB
w83791d -rw-r--r-- 6.7 KB
w83792d -rw-r--r-- 6.1 KB
w83793 -rw-r--r-- 4.1 KB
w83795 -rw-r--r-- 4.1 KB
w83l785ts -rw-r--r-- 1.5 KB
w83l786ng -rw-r--r-- 1.6 KB
wm831x -rw-r--r-- 1.1 KB
wm8350 -rw-r--r-- 765 bytes
xgene-hwmon -rw-r--r-- 755 bytes
zl6100 -rw-r--r-- 5.3 KB

back to top