Skip to content

Commit 03d54ef

Browse files
committed
Merge tag 'drm-misc-fixes-2020-07-15' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
* aspeed: setup fbdev console after registering device; avoids warning and stacktrace in dmesg log * dmabuf: protect dmabuf->name with a spinlock; avoids sleeping in atomic context Signed-off-by: Dave Airlie <[email protected]> From: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20200715171756.GA18606@linux-uq9g
2 parents 8257a0d + 6348dd2 commit 03d54ef

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

drivers/dma-buf/dma-buf.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen)
4545
size_t ret = 0;
4646

4747
dmabuf = dentry->d_fsdata;
48-
dma_resv_lock(dmabuf->resv, NULL);
48+
spin_lock(&dmabuf->name_lock);
4949
if (dmabuf->name)
5050
ret = strlcpy(name, dmabuf->name, DMA_BUF_NAME_LEN);
51-
dma_resv_unlock(dmabuf->resv);
51+
spin_unlock(&dmabuf->name_lock);
5252

5353
return dynamic_dname(dentry, buffer, buflen, "/%s:%s",
5454
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)
338338
kfree(name);
339339
goto out_unlock;
340340
}
341+
spin_lock(&dmabuf->name_lock);
341342
kfree(dmabuf->name);
342343
dmabuf->name = name;
344+
spin_unlock(&dmabuf->name_lock);
343345

344346
out_unlock:
345347
dma_resv_unlock(dmabuf->resv);
@@ -402,10 +404,10 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file)
402404
/* Don't count the temporary reference taken inside procfs seq_show */
403405
seq_printf(m, "count:\t%ld\n", file_count(dmabuf->file) - 1);
404406
seq_printf(m, "exp_name:\t%s\n", dmabuf->exp_name);
405-
dma_resv_lock(dmabuf->resv, NULL);
407+
spin_lock(&dmabuf->name_lock);
406408
if (dmabuf->name)
407409
seq_printf(m, "name:\t%s\n", dmabuf->name);
408-
dma_resv_unlock(dmabuf->resv);
410+
spin_unlock(&dmabuf->name_lock);
409411
}
410412

411413
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)
542544
dmabuf->size = exp_info->size;
543545
dmabuf->exp_name = exp_info->exp_name;
544546
dmabuf->owner = exp_info->owner;
547+
spin_lock_init(&dmabuf->name_lock);
545548
init_waitqueue_head(&dmabuf->poll);
546549
dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = &dmabuf->poll;
547550
dmabuf->cb_excl.active = dmabuf->cb_shared.active = 0;

drivers/gpu/drm/aspeed/aspeed_gfx_drv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,6 @@ static int aspeed_gfx_load(struct drm_device *drm)
173173

174174
drm_mode_config_reset(drm);
175175

176-
drm_fbdev_generic_setup(drm, 32);
177-
178176
return 0;
179177
}
180178

@@ -225,6 +223,7 @@ static int aspeed_gfx_probe(struct platform_device *pdev)
225223
if (ret)
226224
goto err_unload;
227225

226+
drm_fbdev_generic_setup(&priv->drm, 32);
228227
return 0;
229228

230229
err_unload:

include/linux/dma-buf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ struct dma_buf {
311311
void *vmap_ptr;
312312
const char *exp_name;
313313
const char *name;
314+
spinlock_t name_lock; /* spinlock to protect name access */
314315
struct module *owner;
315316
struct list_head list_node;
316317
void *priv;

0 commit comments

Comments
 (0)