Commit cd7bcfa
committed
xen/usb: don't use gnttab_end_foreign_access() in xenhcd_gnttab_done()
The usage of gnttab_end_foreign_access() in xenhcd_gnttab_done() is
not safe against a malicious backend, as the backend could keep the
I/O page mapped and modify it even after the granted memory page is
being used for completely other purposes in the local system.
So replace that use case with gnttab_try_end_foreign_access() and
disable the PV host adapter in case the backend didn't stop using the
granted page.
In xenhcd_urb_request_done() immediately return in case of setting
the device state to "error" instead of looking into further backend
responses.
Reported-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
V2:
- use gnttab_try_end_foreign_access()1 parent 1dbd11c commit cd7bcfa
1 file changed
Lines changed: 18 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
719 | | - | |
| 719 | + | |
720 | 720 | | |
| 721 | + | |
721 | 722 | | |
722 | 723 | | |
723 | 724 | | |
| |||
726 | 727 | | |
727 | 728 | | |
728 | 729 | | |
729 | | - | |
730 | | - | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
731 | 734 | | |
732 | 735 | | |
733 | 736 | | |
| |||
841 | 844 | | |
842 | 845 | | |
843 | 846 | | |
844 | | - | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
845 | 850 | | |
846 | 851 | | |
847 | 852 | | |
| |||
942 | 947 | | |
943 | 948 | | |
944 | 949 | | |
945 | | - | |
946 | | - | |
| 950 | + | |
947 | 951 | | |
948 | 952 | | |
949 | 953 | | |
| |||
952 | 956 | | |
953 | 957 | | |
954 | 958 | | |
955 | | - | |
| 959 | + | |
956 | 960 | | |
957 | 961 | | |
958 | 962 | | |
959 | | - | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
960 | 966 | | |
961 | 967 | | |
962 | 968 | | |
| |||
978 | 984 | | |
979 | 985 | | |
980 | 986 | | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
981 | 991 | | |
982 | 992 | | |
983 | 993 | | |
| |||
0 commit comments