Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'driver-core-5.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
"Here are some driver core fixes for 5.0-rc6.

Well, not so much "driver core" as "debugfs". There's a lot of
outstanding debugfs cleanup patches coming in through different
subsystem trees, and in that process the debugfs core was found that
it really should return errors when something bad happens, to prevent
random files from showing up in the root of debugfs afterward. So
debugfs was fixed up to handle this properly, and then two fixes for
the relay and blk-mq code was needed as it was making invalid
assumptions about debugfs return values.

There's also a cacheinfo fix in here that resolves a tiny issue.

All of these have been in linux-next for over a week with no reported
problems"

* tag 'driver-core-5.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
blk-mq: protect debugfs_create_files() from failures
relay: check return of create_buf_file() properly
debugfs: debugfs_lookup() should return NULL if not found
debugfs: return error values, not NULL
debugfs: fix debugfs_rename parameter checking
cacheinfo: Keep the old value if of_property_read_u32 fails

+32 -17
+3
block/blk-mq-debugfs.c
··· 839 839 static bool debugfs_create_files(struct dentry *parent, void *data, 840 840 const struct blk_mq_debugfs_attr *attr) 841 841 { 842 + if (IS_ERR_OR_NULL(parent)) 843 + return false; 844 + 842 845 d_inode(parent)->i_private = data; 843 846 844 847 for (; attr->name; attr++) {
+2 -4
drivers/base/cacheinfo.c
··· 79 79 ct_idx = get_cacheinfo_idx(this_leaf->type); 80 80 propname = cache_type_info[ct_idx].size_prop; 81 81 82 - if (of_property_read_u32(np, propname, &this_leaf->size)) 83 - this_leaf->size = 0; 82 + of_property_read_u32(np, propname, &this_leaf->size); 84 83 } 85 84 86 85 /* not cache_line_size() because that's a macro in include/linux/cache.h */ ··· 113 114 ct_idx = get_cacheinfo_idx(this_leaf->type); 114 115 propname = cache_type_info[ct_idx].nr_sets_prop; 115 116 116 - if (of_property_read_u32(np, propname, &this_leaf->number_of_sets)) 117 - this_leaf->number_of_sets = 0; 117 + of_property_read_u32(np, propname, &this_leaf->number_of_sets); 118 118 } 119 119 120 120 static void cache_associativity(struct cacheinfo *this_leaf)
+24 -12
fs/debugfs/inode.c
··· 324 324 inode_unlock(d_inode(dentry->d_parent)); 325 325 dput(dentry); 326 326 simple_release_fs(&debugfs_mount, &debugfs_mount_count); 327 - return NULL; 327 + return ERR_PTR(-ENOMEM); 328 328 } 329 329 330 330 static struct dentry *end_creating(struct dentry *dentry) ··· 347 347 dentry = start_creating(name, parent); 348 348 349 349 if (IS_ERR(dentry)) 350 - return NULL; 350 + return dentry; 351 351 352 352 inode = debugfs_get_inode(dentry->d_sb); 353 353 if (unlikely(!inode)) ··· 386 386 * This function will return a pointer to a dentry if it succeeds. This 387 387 * pointer must be passed to the debugfs_remove() function when the file is 388 388 * to be removed (no automatic cleanup happens if your module is unloaded, 389 - * you are responsible here.) If an error occurs, %NULL will be returned. 389 + * you are responsible here.) If an error occurs, %ERR_PTR(-ERROR) will be 390 + * returned. 390 391 * 391 392 * If debugfs is not enabled in the kernel, the value -%ENODEV will be 392 393 * returned. ··· 465 464 * This function will return a pointer to a dentry if it succeeds. This 466 465 * pointer must be passed to the debugfs_remove() function when the file is 467 466 * to be removed (no automatic cleanup happens if your module is unloaded, 468 - * you are responsible here.) If an error occurs, %NULL will be returned. 467 + * you are responsible here.) If an error occurs, %ERR_PTR(-ERROR) will be 468 + * returned. 469 469 * 470 470 * If debugfs is not enabled in the kernel, the value -%ENODEV will be 471 471 * returned. ··· 497 495 * This function will return a pointer to a dentry if it succeeds. This 498 496 * pointer must be passed to the debugfs_remove() function when the file is 499 497 * to be removed (no automatic cleanup happens if your module is unloaded, 500 - * you are responsible here.) If an error occurs, %NULL will be returned. 498 + * you are responsible here.) If an error occurs, %ERR_PTR(-ERROR) will be 499 + * returned. 501 500 * 502 501 * If debugfs is not enabled in the kernel, the value -%ENODEV will be 503 502 * returned. ··· 509 506 struct inode *inode; 510 507 511 508 if (IS_ERR(dentry)) 512 - return NULL; 509 + return dentry; 513 510 514 511 inode = debugfs_get_inode(dentry->d_sb); 515 512 if (unlikely(!inode)) ··· 548 545 struct inode *inode; 549 546 550 547 if (IS_ERR(dentry)) 551 - return NULL; 548 + return dentry; 552 549 553 550 inode = debugfs_get_inode(dentry->d_sb); 554 551 if (unlikely(!inode)) ··· 584 581 * This function will return a pointer to a dentry if it succeeds. This 585 582 * pointer must be passed to the debugfs_remove() function when the symbolic 586 583 * link is to be removed (no automatic cleanup happens if your module is 587 - * unloaded, you are responsible here.) If an error occurs, %NULL will be 588 - * returned. 584 + * unloaded, you are responsible here.) If an error occurs, %ERR_PTR(-ERROR) 585 + * will be returned. 589 586 * 590 587 * If debugfs is not enabled in the kernel, the value -%ENODEV will be 591 588 * returned. ··· 597 594 struct inode *inode; 598 595 char *link = kstrdup(target, GFP_KERNEL); 599 596 if (!link) 600 - return NULL; 597 + return ERR_PTR(-ENOMEM); 601 598 602 599 dentry = start_creating(name, parent); 603 600 if (IS_ERR(dentry)) { 604 601 kfree(link); 605 - return NULL; 602 + return dentry; 606 603 } 607 604 608 605 inode = debugfs_get_inode(dentry->d_sb); ··· 790 787 struct dentry *dentry = NULL, *trap; 791 788 struct name_snapshot old_name; 792 789 790 + if (IS_ERR(old_dir)) 791 + return old_dir; 792 + if (IS_ERR(new_dir)) 793 + return new_dir; 794 + if (IS_ERR_OR_NULL(old_dentry)) 795 + return old_dentry; 796 + 793 797 trap = lock_rename(new_dir, old_dir); 794 798 /* Source or destination directories don't exist? */ 795 799 if (d_really_is_negative(old_dir) || d_really_is_negative(new_dir)) ··· 830 820 if (dentry && !IS_ERR(dentry)) 831 821 dput(dentry); 832 822 unlock_rename(new_dir, old_dir); 833 - return NULL; 823 + if (IS_ERR(dentry)) 824 + return dentry; 825 + return ERR_PTR(-EINVAL); 834 826 } 835 827 EXPORT_SYMBOL_GPL(debugfs_rename); 836 828
+3 -1
kernel/relay.c
··· 428 428 dentry = chan->cb->create_buf_file(tmpname, chan->parent, 429 429 S_IRUSR, buf, 430 430 &chan->is_global); 431 + if (IS_ERR(dentry)) 432 + dentry = NULL; 431 433 432 434 kfree(tmpname); 433 435 ··· 463 461 dentry = chan->cb->create_buf_file(NULL, NULL, 464 462 S_IRUSR, buf, 465 463 &chan->is_global); 466 - if (WARN_ON(dentry)) 464 + if (IS_ERR_OR_NULL(dentry)) 467 465 goto free_buf; 468 466 } 469 467