Commit 81d6f7c
Danilo Krummrich
s390/ap: use generic driver_override infrastructure
When the AP masks are updated via apmask_store() or aqmask_store(),
ap_bus_revise_bindings() is called after ap_attr_mutex has been
released.
This calls __ap_revise_reserved(), which accesses the driver_override
field without holding any lock, racing against a concurrent
driver_override_store() that may free the old string, resulting in a
potential UAF.
Fix this by using the driver-core driver_override infrastructure, which
protects all accesses with an internal spinlock.
Note that unlike most other buses, the AP bus does not check
driver_override in its match() callback; the override is checked in
ap_device_probe() and __ap_revise_reserved() instead.
Also note that we do not enable the driver_override feature of struct
bus_type, as AP - in contrast to most other buses - passes "" to
sysfs_emit() when the driver_override pointer is NULL. Thus, printing
"\n" instead of "(null)\n".
Additionally, AP has a custom counter that is modified in the
corresponding custom driver_override_store().
Fixes: d38a87d ("s390/ap: Support driver_override for AP queue devices")
Tested-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Link: https://patch.msgid.link/20260324005919.2408620-11-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>1 parent ac4d8bb commit 81d6f7c
3 files changed
Lines changed: 23 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
859 | 859 | | |
860 | 860 | | |
861 | 861 | | |
862 | | - | |
| 862 | + | |
863 | 863 | | |
864 | 864 | | |
865 | 865 | | |
866 | 866 | | |
867 | | - | |
868 | 867 | | |
869 | 868 | | |
870 | 869 | | |
871 | 870 | | |
872 | | - | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | | - | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
881 | 880 | | |
882 | 881 | | |
883 | 882 | | |
| |||
928 | 927 | | |
929 | 928 | | |
930 | 929 | | |
931 | | - | |
| 930 | + | |
932 | 931 | | |
933 | 932 | | |
934 | 933 | | |
| |||
977 | 976 | | |
978 | 977 | | |
979 | 978 | | |
980 | | - | |
| 979 | + | |
981 | 980 | | |
982 | 981 | | |
983 | 982 | | |
| |||
991 | 990 | | |
992 | 991 | | |
993 | 992 | | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
998 | 998 | | |
999 | 999 | | |
1000 | 1000 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
170 | 169 | | |
171 | 170 | | |
172 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
| 737 | + | |
| 738 | + | |
749 | 739 | | |
750 | 740 | | |
751 | 741 | | |
752 | 742 | | |
753 | 743 | | |
754 | 744 | | |
755 | | - | |
756 | | - | |
757 | 745 | | |
758 | 746 | | |
759 | 747 | | |
| |||
764 | 752 | | |
765 | 753 | | |
766 | 754 | | |
767 | | - | |
768 | | - | |
| 755 | + | |
| 756 | + | |
769 | 757 | | |
770 | 758 | | |
771 | | - | |
| 759 | + | |
772 | 760 | | |
773 | | - | |
| 761 | + | |
774 | 762 | | |
775 | 763 | | |
776 | 764 | | |
| |||
0 commit comments