File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -342,7 +342,9 @@ static void idxd_cleanup_internals(struct idxd_device *idxd)
342
342
static int idxd_init_evl (struct idxd_device * idxd )
343
343
{
344
344
struct device * dev = & idxd -> pdev -> dev ;
345
+ unsigned int evl_cache_size ;
345
346
struct idxd_evl * evl ;
347
+ const char * idxd_name ;
346
348
347
349
if (idxd -> hw .gen_cap .evl_support == 0 )
348
350
return 0 ;
@@ -354,9 +356,16 @@ static int idxd_init_evl(struct idxd_device *idxd)
354
356
spin_lock_init (& evl -> lock );
355
357
evl -> size = IDXD_EVL_SIZE_MIN ;
356
358
357
- idxd -> evl_cache = kmem_cache_create (dev_name (idxd_confdev (idxd )),
358
- sizeof (struct idxd_evl_fault ) + evl_ent_size (idxd ),
359
- 0 , 0 , NULL );
359
+ idxd_name = dev_name (idxd_confdev (idxd ));
360
+ evl_cache_size = sizeof (struct idxd_evl_fault ) + evl_ent_size (idxd );
361
+ /*
362
+ * Since completion record in evl_cache will be copied to user
363
+ * when handling completion record page fault, need to create
364
+ * the cache suitable for user copy.
365
+ */
366
+ idxd -> evl_cache = kmem_cache_create_usercopy (idxd_name , evl_cache_size ,
367
+ 0 , 0 , 0 , evl_cache_size ,
368
+ NULL );
360
369
if (!idxd -> evl_cache ) {
361
370
kfree (evl );
362
371
return - ENOMEM ;
You can’t perform that action at this time.
0 commit comments