Commit 37de955
driver core: fix race between creating/querying glue dir and its cleanup
commit cebf8fd16900fdfd58c0028617944f808f97fe50 upstream.
The global mutex of 'gdp_mutex' is used to serialize creating/querying
glue dir and its cleanup. Turns out it isn't a perfect way because
part(kobj_kset_leave()) of the actual cleanup action() is done inside
the release handler of the glue dir kobject. That means gdp_mutex has
to be held before releasing the last reference count of the glue dir
kobject.
This patch moves glue dir's cleanup after kobject_del() in device_del()
for avoiding the race.
Cc: Yijing Wang <wangyijing@huawei.com>
Reported-by: Chandra Sekhar Lingutla <clingutla@codeaurora.org>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent f85a337 commit 37de955
1 file changed
Lines changed: 29 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
839 | 858 | | |
840 | 859 | | |
841 | 860 | | |
842 | | - | |
843 | | - | |
| 861 | + | |
844 | 862 | | |
845 | 863 | | |
846 | 864 | | |
847 | 865 | | |
848 | 866 | | |
849 | 867 | | |
850 | 868 | | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | 869 | | |
857 | 870 | | |
858 | 871 | | |
| |||
1028 | 1041 | | |
1029 | 1042 | | |
1030 | 1043 | | |
| 1044 | + | |
1031 | 1045 | | |
1032 | 1046 | | |
1033 | 1047 | | |
| |||
1072 | 1086 | | |
1073 | 1087 | | |
1074 | 1088 | | |
1075 | | - | |
| 1089 | + | |
| 1090 | + | |
1076 | 1091 | | |
| 1092 | + | |
1077 | 1093 | | |
1078 | 1094 | | |
1079 | 1095 | | |
| |||
1154 | 1170 | | |
1155 | 1171 | | |
1156 | 1172 | | |
| 1173 | + | |
1157 | 1174 | | |
1158 | 1175 | | |
1159 | | - | |
| 1176 | + | |
1160 | 1177 | | |
1161 | 1178 | | |
1162 | 1179 | | |
| |||
1232 | 1249 | | |
1233 | 1250 | | |
1234 | 1251 | | |
| 1252 | + | |
1235 | 1253 | | |
1236 | 1254 | | |
1237 | 1255 | | |
| |||
1276 | 1294 | | |
1277 | 1295 | | |
1278 | 1296 | | |
1279 | | - | |
| 1297 | + | |
1280 | 1298 | | |
| 1299 | + | |
1281 | 1300 | | |
1282 | 1301 | | |
1283 | 1302 | | |
| |||
0 commit comments