@@ -45,10 +45,10 @@ static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen)
45
45
size_t ret = 0 ;
46
46
47
47
dmabuf = dentry -> d_fsdata ;
48
- dma_resv_lock ( dmabuf -> resv , NULL );
48
+ spin_lock ( & dmabuf -> name_lock );
49
49
if (dmabuf -> name )
50
50
ret = strlcpy (name , dmabuf -> name , DMA_BUF_NAME_LEN );
51
- dma_resv_unlock ( dmabuf -> resv );
51
+ spin_unlock ( & dmabuf -> name_lock );
52
52
53
53
return dynamic_dname (dentry , buffer , buflen , "/%s:%s" ,
54
54
dentry -> d_name .name , ret > 0 ? name : "" );
@@ -338,8 +338,10 @@ static long dma_buf_set_name(struct dma_buf *dmabuf, const char __user *buf)
338
338
kfree (name );
339
339
goto out_unlock ;
340
340
}
341
+ spin_lock (& dmabuf -> name_lock );
341
342
kfree (dmabuf -> name );
342
343
dmabuf -> name = name ;
344
+ spin_unlock (& dmabuf -> name_lock );
343
345
344
346
out_unlock :
345
347
dma_resv_unlock (dmabuf -> resv );
@@ -402,10 +404,10 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file)
402
404
/* Don't count the temporary reference taken inside procfs seq_show */
403
405
seq_printf (m , "count:\t%ld\n" , file_count (dmabuf -> file ) - 1 );
404
406
seq_printf (m , "exp_name:\t%s\n" , dmabuf -> exp_name );
405
- dma_resv_lock ( dmabuf -> resv , NULL );
407
+ spin_lock ( & dmabuf -> name_lock );
406
408
if (dmabuf -> name )
407
409
seq_printf (m , "name:\t%s\n" , dmabuf -> name );
408
- dma_resv_unlock ( dmabuf -> resv );
410
+ spin_unlock ( & dmabuf -> name_lock );
409
411
}
410
412
411
413
static const struct file_operations dma_buf_fops = {
@@ -542,6 +544,7 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
542
544
dmabuf -> size = exp_info -> size ;
543
545
dmabuf -> exp_name = exp_info -> exp_name ;
544
546
dmabuf -> owner = exp_info -> owner ;
547
+ spin_lock_init (& dmabuf -> name_lock );
545
548
init_waitqueue_head (& dmabuf -> poll );
546
549
dmabuf -> cb_excl .poll = dmabuf -> cb_shared .poll = & dmabuf -> poll ;
547
550
dmabuf -> cb_excl .active = dmabuf -> cb_shared .active = 0 ;
0 commit comments