@@ -924,8 +924,8 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
924
924
{
925
925
struct qaic_attach_slice_entry * slice_ent ;
926
926
struct qaic_attach_slice * args = data ;
927
+ int rcu_id , usr_rcu_id , qdev_rcu_id ;
927
928
struct dma_bridge_chan * dbc ;
928
- int usr_rcu_id , qdev_rcu_id ;
929
929
struct drm_gem_object * obj ;
930
930
struct qaic_device * qdev ;
931
931
unsigned long arg_size ;
@@ -969,12 +969,6 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
969
969
goto unlock_dev_srcu ;
970
970
}
971
971
972
- dbc = & qdev -> dbc [args -> hdr .dbc_id ];
973
- if (dbc -> usr != usr ) {
974
- ret = - EINVAL ;
975
- goto unlock_dev_srcu ;
976
- }
977
-
978
972
user_data = u64_to_user_ptr (args -> data );
979
973
980
974
slice_ent = kzalloc (arg_size , GFP_KERNEL );
@@ -1006,9 +1000,16 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
1006
1000
goto put_bo ;
1007
1001
}
1008
1002
1003
+ dbc = & qdev -> dbc [args -> hdr .dbc_id ];
1004
+ rcu_id = srcu_read_lock (& dbc -> ch_lock );
1005
+ if (dbc -> usr != usr ) {
1006
+ ret = - EINVAL ;
1007
+ goto unlock_ch_srcu ;
1008
+ }
1009
+
1009
1010
ret = qaic_prepare_bo (qdev , bo , & args -> hdr );
1010
1011
if (ret )
1011
- goto put_bo ;
1012
+ goto unlock_ch_srcu ;
1012
1013
1013
1014
ret = qaic_attach_slicing_bo (qdev , bo , & args -> hdr , slice_ent );
1014
1015
if (ret )
@@ -1018,6 +1019,7 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
1018
1019
dma_sync_sgtable_for_cpu (& qdev -> pdev -> dev , bo -> sgt , args -> hdr .dir );
1019
1020
1020
1021
bo -> dbc = dbc ;
1022
+ srcu_read_unlock (& dbc -> ch_lock , rcu_id );
1021
1023
drm_gem_object_put (obj );
1022
1024
srcu_read_unlock (& qdev -> dev_lock , qdev_rcu_id );
1023
1025
srcu_read_unlock (& usr -> qddev_lock , usr_rcu_id );
@@ -1026,6 +1028,8 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
1026
1028
1027
1029
unprepare_bo :
1028
1030
qaic_unprepare_bo (qdev , bo );
1031
+ unlock_ch_srcu :
1032
+ srcu_read_unlock (& dbc -> ch_lock , rcu_id );
1029
1033
put_bo :
1030
1034
drm_gem_object_put (obj );
1031
1035
free_slice_ent :
0 commit comments