-
Notifications
You must be signed in to change notification settings - Fork 54.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed goto and used return. #688
base: master
Are you sure you want to change the base?
Conversation
Results are same. But, more convenient.
Hi @shaswata56! Thanks for your contribution to the Linux kernel! Linux kernel development happens on mailing lists, rather than on GitHub - this GitHub repository is a read-only mirror that isn't used for accepting contributions. So that your change can become part of Linux, please email it to us as a patch. Sending patches isn't quite as simple as sending a pull request, but fortunately it is a well documented process. Here's what to do:
How do I format my contribution?The Linux kernel community is notoriously picky about how contributions are formatted and sent. Fortunately, they have documented their expectations. Firstly, all contributions need to be formatted as patches. A patch is a plain text document showing the change you want to make to the code, and documenting why it is a good idea. You can create patches with Secondly, patches need 'commit messages', which is the human-friendly documentation explaining what the change is and why it's necessary. Thirdly, changes have some technical requirements. There is a Linux kernel coding style, and there are licensing requirements you need to comply with. Both of these are documented in the Submitting Patches documentation that is part of the kernel. Note that you will almost certainly have to modify your existing git commits to satisfy these requirements. Don't worry: there are many guides on the internet for doing this. Who do I send my contribution to?The Linux kernel is composed of a number of subsystems. These subsystems are maintained by different people, and have different mailing lists where they discuss proposed changes. If you don't already know what subsystem your change belongs to, the
Make sure that your list of recipients includes a mailing list. If you can't find a more specific mailing list, then LKML - the Linux Kernel Mailing List - is the place to send your patches. It's not usually necessary to subscribe to the mailing list before you send the patches, but if you're interested in kernel development, subscribing to a subsystem mailing list is a good idea. (At this point, you probably don't need to subscribe to LKML - it is a very high traffic list with about a thousand messages per day, which is often not useful for beginners.) How do I send my contribution?Use For more information about using How do I get help if I'm stuck?Firstly, don't get discouraged! There are an enormous number of resources on the internet, and many kernel developers who would like to see you succeed. Many issues - especially about how to use certain tools - can be resolved by using your favourite internet search engine. If you can't find an answer, there are a few places you can turn:
If you get really, really stuck, you could try the owners of this bot, @daxtens and @ajdlinux. Please be aware that we do have full-time jobs, so we are almost certainly the slowest way to get answers! I sent my patch - now what?You wait. You can check that your email has been received by checking the mailing list archives for the mailing list you sent your patch to. Messages may not be received instantly, so be patient. Kernel developers are generally very busy people, so it may take a few weeks before your patch is looked at. Then, you keep waiting. Three things may happen:
Further information
Happy hacking! This message was posted by a bot - if you have any questions or suggestions, please talk to my owners, @ajdlinux and @daxtens, or raise an issue at https://github.com/ajdlinux/KernelPRBot. |
Hi, this is a perfectly fine commit. Please consider following the instruction on how to make contributions.
It is relatively easy to follow : https://kernelnewbies.org/FirstKernelPatch |
Thank you. I'll try to send the patch asap.. |
Commit da58f90 ("netdevsim: Add devlink-trap support") added delayed work to netdevsim that periodically iterates over the registered netdevsim ports and reports various packet traps via devlink. While the delayed work takes the 'port_list_lock' mutex to protect against concurrent addition / deletion of ports, during devlink reload ports are added / deleted without this lock, which can result in a use-after-free [1]. Fix this by making sure that the ports list is always modified under the lock. [1] [ 62.159614] ================================================================== [ 62.161744] BUG: KASAN: use-after-free in nsim_dev_trap_report_work+0xa5e/0xad0 [ 62.164125] Read of size 8 at addr ffff8881f2631d98 by task kworker/0:1/12 [ 62.166208] [ 62.166706] CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.4.0-rc3-custom-01423-gd86784fe9b03-dirty torvalds#688 [ 62.169588] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-2.fc30 04/01/2014 [ 62.171150] Workqueue: events nsim_dev_trap_report_work [ 62.171938] Call Trace: [ 62.172399] dump_stack+0xa9/0x10e [ 62.173017] print_address_description.constprop.0+0x21/0x2c0 [ 62.174037] __kasan_report.cold+0x75/0x9c [ 62.174783] ? nsim_dev_trap_report_work+0xa5e/0xad0 [ 62.175673] kasan_report+0xe/0x20 [ 62.176298] nsim_dev_trap_report_work+0xa5e/0xad0 [ 62.177159] ? rcu_read_lock_sched_held+0xaf/0xe0 [ 62.178005] ? trace_event_raw_event_rcu_quiescent_state_report+0x370/0x370 [ 62.179239] process_one_work+0x9b3/0x1680 [ 62.179983] ? pwq_dec_nr_in_flight+0x330/0x330 [ 62.180807] worker_thread+0x9e/0xf00 [ 62.181483] ? __kthread_parkme+0x60/0x1b0 [ 62.182217] ? __kthread_parkme+0xf9/0x1b0 [ 62.182961] ? process_one_work+0x1680/0x1680 [ 62.183940] kthread+0x351/0x420 [ 62.184541] ? __kthread_queue_delayed_work+0x230/0x230 [ 62.185473] ret_from_fork+0x3a/0x50 [ 62.186101] [ 62.186296] Allocated by task 256: [ 62.186795] save_stack+0x1b/0x80 [ 62.187335] __kasan_kmalloc.constprop.0+0xc2/0xd0 [ 62.187929] __nsim_dev_port_add+0xa6/0x5a0 [ 62.188510] nsim_dev_port_add_all+0x45/0x100 [ 62.189090] nsim_dev_reload_up+0x42e/0x590 [ 62.189865] devlink_reload+0x232/0x370 [ 62.190694] devlink_nl_cmd_reload+0x539/0x630 [ 62.191564] genl_rcv_msg+0x5ce/0xd60 [ 62.192229] netlink_rcv_skb+0x13e/0x3a0 [ 62.192940] genl_rcv+0x29/0x40 [ 62.193523] netlink_unicast+0x47a/0x680 [ 62.194239] netlink_sendmsg+0x74e/0xc90 [ 62.194974] __sys_sendto+0x393/0x3e0 [ 62.195692] __x64_sys_sendto+0xe2/0x1b0 [ 62.196444] do_syscall_64+0xa4/0x4f0 [ 62.197116] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 62.198022] [ 62.198317] Freed by task 261: [ 62.198880] save_stack+0x1b/0x80 [ 62.199495] __kasan_slab_free+0x12c/0x170 [ 62.200237] kfree+0xdb/0x3c0 [ 62.200790] nsim_dev_reload_destroy+0xad/0x1a0 [ 62.201616] nsim_dev_reload_down+0x79/0xf0 [ 62.202380] devlink_reload+0x7d/0x370 [ 62.203089] devlink_nl_cmd_reload+0x539/0x630 [ 62.203962] genl_rcv_msg+0x5ce/0xd60 [ 62.204693] netlink_rcv_skb+0x13e/0x3a0 [ 62.205433] genl_rcv+0x29/0x40 [ 62.206031] netlink_unicast+0x47a/0x680 [ 62.206760] netlink_sendmsg+0x74e/0xc90 [ 62.207532] __sys_sendto+0x393/0x3e0 [ 62.208487] __x64_sys_sendto+0xe2/0x1b0 [ 62.209160] do_syscall_64+0xa4/0x4f0 [ 62.209731] entry_SYSCALL_64_after_hwframe+0x49/0xbe [ 62.210498] [ 62.210740] The buggy address belongs to the object at ffff8881f2631c00 [ 62.210740] which belongs to the cache kmalloc-512 of size 512 [ 62.212632] The buggy address is located 408 bytes inside of [ 62.212632] 512-byte region [ffff8881f2631c00, ffff8881f2631e00) [ 62.214671] The buggy address belongs to the page: [ 62.215527] page:ffffea0007c98c00 refcount:1 mapcount:0 mapping:ffff8881f5c02000 index:0x0 compound_mapcount: 0 [ 62.217303] flags: 0x200000000010200(slab|head) [ 62.218255] raw: 0200000000010200 dead000000000100 dead000000000122 ffff8881f5c02000 [ 62.219773] raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 [ 62.221204] page dumped because: kasan: bad access detected [ 62.222372] [ 62.222670] Memory state around the buggy address: [ 62.223536] ffff8881f2631c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 62.224709] ffff8881f2631d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 62.225843] >ffff8881f2631d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 62.226971] ^ [ 62.227616] ffff8881f2631e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 62.228758] ffff8881f2631e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 62.229883] ================================================================== Fixes: da58f90 ("netdevsim: Add devlink-trap support") Signed-off-by: Ido Schimmel <[email protected]> Reported-by: [email protected]
Convert S_<FOO> permissions to the more readable octal. Link: https://lore.kernel.org/lkml/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com/ Done using: $ git ls-files -- drivers/gpu/drm/*.[ch] | xargs ./scripts/checkpatch.pl -f --fix-inplace --types=SYMBOLIC_PERMS No difference in generated .o files allyesconfig x86-64 The files below were not compiled for x86-64: drivers/gpu/drm/msm/adreno/a5xx_debugfs.c drivers/gpu/drm/msm/msm_debugfs.c drivers/gpu/drm/msm/msm_perf.c drivers/gpu/drm/msm/msm_rd.c drivers/gpu/drm/sti/sti_drv.c checkpatch does report several places where permissions perhaps could be downgraded. None of these locations are modified by this patch. WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#165: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1146: + debugfs_create_file("ras_ctrl", 0666, con->dir, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#165: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1146: + debugfs_create_file("ras_ctrl", 0666, con->dir, adev, &amdgpu_ras_debugfs_ctrl_ops); WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#168: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1148: + debugfs_create_file("ras_eeprom_reset", 0666, con->dir, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#168: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1148: + debugfs_create_file("ras_eeprom_reset", 0666, con->dir, adev, &amdgpu_ras_debugfs_eeprom_ops); WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#177: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1159: + debugfs_create_bool("auto_reboot", 0666, con->dir, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#177: FILE: drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1159: + debugfs_create_bool("auto_reboot", 0666, con->dir, &con->reboot); WARNING:EXPORTED_WORLD_WRITABLE: Exporting world writable files is usually an error. Consider more restrictive permissions. torvalds#688: FILE: drivers/gpu/drm/msm/adreno/a5xx_debugfs.c:157: + debugfs_create_file("reset", 0222, minor->debugfs_root, dev, ERROR:EXPORTED_WORLD_WRITABLE: Exporting writable files is usually an error. Consider more restrictive permissions. torvalds#688: FILE: drivers/gpu/drm/msm/adreno/a5xx_debugfs.c:157: + debugfs_create_file("reset", 0222, minor->debugfs_root, dev, &reset_fops); Signed-off-by: Joe Perches <[email protected]>
kbuild: canonicalization of target path not needed anymore
Results are same. But, more convenient.