Commit 9937fa6
PCI: hv: Add validation for untrusted Hyper-V values
For additional robustness in the face of Hyper-V errors or malicious
behavior, validate all values that originate from packets that Hyper-V
has sent to the guest in the host-to-guest ring buffer. Ensure that
invalid values cannot cause data being copied out of the bounds of the
source buffer in hv_pci_onchannelcallback().
While at it, remove a redundant validation in hv_pci_generic_compl():
hv_pci_onchannelcallback() already ensures that all processed incoming
packets are "at least as large as [in fact larger than] a response".
Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Link: https://lore.kernel.org/r/20220511223207.3386-2-parri.andrea@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>1 parent a2bad84 commit 9937fa6
1 file changed
Lines changed: 24 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
981 | 981 | | |
982 | 982 | | |
983 | 983 | | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
| 984 | + | |
989 | 985 | | |
990 | 986 | | |
991 | 987 | | |
| |||
1606 | 1602 | | |
1607 | 1603 | | |
1608 | 1604 | | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
1609 | 1609 | | |
1610 | 1610 | | |
| 1611 | + | |
1611 | 1612 | | |
1612 | 1613 | | |
1613 | 1614 | | |
| |||
2291 | 2292 | | |
2292 | 2293 | | |
2293 | 2294 | | |
| 2295 | + | |
2294 | 2296 | | |
2295 | 2297 | | |
2296 | | - | |
| 2298 | + | |
| 2299 | + | |
2297 | 2300 | | |
2298 | 2301 | | |
2299 | | - | |
| 2302 | + | |
2300 | 2303 | | |
2301 | 2304 | | |
2302 | 2305 | | |
| |||
2848 | 2851 | | |
2849 | 2852 | | |
2850 | 2853 | | |
2851 | | - | |
| 2854 | + | |
| 2855 | + | |
2852 | 2856 | | |
2853 | 2857 | | |
2854 | 2858 | | |
| |||
2862 | 2866 | | |
2863 | 2867 | | |
2864 | 2868 | | |
2865 | | - | |
| 2869 | + | |
| 2870 | + | |
2866 | 2871 | | |
2867 | 2872 | | |
2868 | 2873 | | |
| |||
2876 | 2881 | | |
2877 | 2882 | | |
2878 | 2883 | | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
2879 | 2889 | | |
2880 | 2890 | | |
2881 | 2891 | | |
| |||
2887 | 2897 | | |
2888 | 2898 | | |
2889 | 2899 | | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
2890 | 2905 | | |
2891 | 2906 | | |
2892 | 2907 | | |
| |||
0 commit comments