linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "yukuai (C)" <yukuai3@huawei.com>
To: Pavel Skripkin <paskripkin@gmail.com>, <josef@toxicpanda.com>,
	<axboe@kernel.dk>
Cc: <linux-block@vger.kernel.org>, <nbd@other.debian.org>,
	<linux-kernel@vger.kernel.org>, <yi.zhang@huawei.com>,
	<luomeng12@huawei.com>, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 0/2] nbd: fix sanity check for first_minor
Date: Thu, 21 Oct 2021 21:37:26 +0800	[thread overview]
Message-ID: <92d9f001-f77b-8263-53a6-aab83daccef9@huawei.com> (raw)
In-Reply-To: <17182476-e5bf-f493-9d9b-fedb2d9c8e1a@huawei.com>

On 2021/10/21 21:13, yukuai (C) wrote:
> On 2021/10/21 20:35, Pavel Skripkin wrote:
>> On 10/21/21 15:29, Yu Kuai wrote:
>>> Yu Kuai (2):
>>>    nbd: fix max value for 'first_minor'
>>>    nbd: fix possible overflow for 'first_minor' in nbd_dev_add()
>>>
>>>   drivers/block/nbd.c | 6 +++---
>>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>
>> Hi, Yu!
>>
>> Thank you for the fix, but this wrong check should be just removed, 
>> since root case of wrong sysfs file creation was fixed, as Christoph 
>> said [1]

Hi, Christoph

By the way, if we remove the checking, there will be two kernel warnings
when the problem happens. Maybe keeping the checking is better?

[   19.860640] sysfs: cannot create duplicate filename '/dev/block/43:0'
[   19.861659] CPU: 1 PID: 872 Comm: modprobe Not tainted 
5.15.0-rc6-next-20211020-00001-g2f1
[   19.863175] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), 
BIOS ?-20190727_0738364
[   19.865183] Call Trace:
[   19.866512]  <TASK>
[   19.866863]  ? dump_stack_lvl+0x73/0x9f
[   19.867941]  ? dump_stack+0x13/0x1b
[   19.868475]  ? sysfs_warn_dup.cold+0x27/0x45
[   19.869075]  ? sysfs_do_create_link_sd.isra.0+0x131/0x150
[   19.869818]  ? sysfs_create_link+0x29/0x60
[   19.870459]  ? device_add+0xbd6/0xf60
[   19.871032]  ? _printk+0x5f/0x7d
[   19.871518]  ? device_add_disk+0x153/0x5d0
[   19.872160]  ? nbd_dev_add+0x30e/0x470 [nbd]
[   19.872828]  ? 0xffffffffc0060000
[   19.873332]  ? nbd_init+0x1dc/0x1000 [nbd]
[   19.873924]  ? do_one_initcall+0x71/0x3a0
[   19.874534]  ? gcov_event+0x70/0x690
[   19.875058]  ? do_init_module+0xa6/0x350
[   19.875587]  ? load_module+0x2587/0x2720
[   19.876130]  ? kernel_read+0x31/0xb0
[   19.876638]  ? kernel_read_file+0x15a/0x360
[   19.877271]  ? __do_sys_finit_module+0xe5/0x190
[   19.877951]  ? __do_sys_finit_module+0xe5/0x190
[   19.878563]  ? __x64_sys_finit_module+0x1e/0x30
[   19.879182]  ? do_syscall_64+0x35/0x80
[   19.879700]  ? entry_SYSCALL_64_after_hwframe+0x44/0xae
[   19.880413]  </TASK>
[   19.880806] ------------[ cut here ]------------
[   19.881502] WARNING: CPU: 1 PID: 872 at block/genhd.c:543 
device_add_disk+0x2af/0x5d0
[   19.882695] Modules linked in: nbd(+)
[   19.883290] CPU: 1 PID: 872 Comm: modprobe Not tainted 
5.15.0-rc6-next-20211020-00001-g2f1
[   19.884823] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), 
BIOS ?-20190727_0738364
[   19.886866] RIP: 0010:device_add_disk+0x2af/0x5d0
[   19.887606] Code: 6e f2 f2 0b 01 49 8b 76 48 48 8b 3d db 03 f3 0b e8 
f6 ec a9 ff 48 83 050
[   19.890456] RSP: 0018:ffffc90000e47c70 EFLAGS: 00010202
[   19.891293] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 
00000000000ae001
[   19.892274] RDX: 00000000000ac001 RSI: ffffffff91b5906b RDI: 
0000000000000000
[   19.893318] RBP: ffff8881034ad600 R08: 0000000000000000 R09: 
ffffffff915e2e69
[   19.894425] R10: 0000000000000014 R11: 0000000000000001 R12: 
00000000ffffffef
[   19.895544] R13: 0000000000000000 R14: ffff88817d720600 R15: 
ffff88817d720648
[   19.896652] FS:  00007fc08c7a7040(0000) GS:ffff88882f640000(0000) 
knlGS:0000000000000000
[   19.897902] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   19.898768] CR2: 00007fc08bcf0395 CR3: 000000017c467000 CR4: 
00000000000006e0
[   19.899754] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 
0000000000000000
[   19.900856] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 
0000000000000400
[   19.901989] Call Trace:
[   19.902387]  <TASK>
[   19.902732]  nbd_dev_add+0x30e/0x470 [nbd]
[   19.903395]  ? 0xffffffffc0060000
[   19.903917]  nbd_init+0x1dc/0x1000 [nbd]
[   19.904536]  do_one_initcall+0x71/0x3a0
[   19.905166]  ? gcov_event+0x70/0x690
[   19.905745]  do_init_module+0xa6/0x350
[   19.906351]  load_module+0x2587/0x2720
[   19.906932]  ? kernel_read+0x31/0xb0
[   19.907509]  ? kernel_read_file+0x15a/0x360
[   19.908195]  ? __do_sys_finit_module+0xe5/0x190
[   19.908894]  __do_sys_finit_module+0xe5/0x190
[   19.909591]  __x64_sys_finit_module+0x1e/0x30
[   19.910289]  do_syscall_64+0x35/0x80
[   19.910855]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[   19.911652] RIP: 0033:0x7fc08bc7a4e9
[   19.912231] Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 
48 89 f8 48 89 f7 488
[   19.915026] RSP: 002b:00007fff0ddf6fd8 EFLAGS: 00000246 ORIG_RAX: 
0000000000000139
[   19.916080] RAX: ffffffffffffffda RBX: 00005596400853e0 RCX: 
00007fc08bc7a4e9
[   19.917180] RDX: 0000000000000000 RSI: 000055963fe1bc26 RDI: 
0000000000000003
[   19.918302] RBP: 000055963fe1bc26 R08: 0000000000000000 R09: 
0000000000000000
[   19.919412] R10: 0000000000000003 R11: 0000000000000246 R12: 
0000000000000000
[   19.920524] R13: 00005596400854f0 R14: 0000000000040000 R15: 
00005596400853e0
[   19.921629]  </TASK>
[   19.922005] ---[ end trace e09ecf130812479d ]---

Thanks,
Kuai
> 
> Hi, Pavel
> 
> Thanks for your response, with the root cause fixed, patch 1 is not
> needed anymore. However, the overflow case in patch 2 is still
> possible.
> 
> Does anyone plan to remove the checking?
> 
> Thanks,
> Kuai
>>
>>
>>
>>
>> [1] https://lore.kernel.org/lkml/20211011073556.GA10735@lst.de/
>>
>>
>>
>> With regards,
>> Pavel Skripkin
>> .
>>

  reply	other threads:[~2021-10-21 13:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 12:29 [PATCH 0/2] nbd: fix sanity check for first_minor Yu Kuai
2021-10-21 12:29 ` [PATCH 1/2] nbd: fix max value for 'first_minor' Yu Kuai
2021-10-21 12:29 ` [PATCH 2/2] nbd: fix possible overflow for 'first_minor' in nbd_dev_add() Yu Kuai
2021-10-21 12:35 ` [PATCH 0/2] nbd: fix sanity check for first_minor Pavel Skripkin
2021-10-21 13:13   ` yukuai (C)
2021-10-21 13:37     ` yukuai (C) [this message]
2021-10-25 13:41       ` yukuai (C)
2021-11-01  8:06         ` yukuai (C)
2021-10-21 16:47     ` Pavel Skripkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=92d9f001-f77b-8263-53a6-aab83daccef9@huawei.com \
    --to=yukuai3@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luomeng12@huawei.com \
    --cc=nbd@other.debian.org \
    --cc=paskripkin@gmail.com \
    --cc=yi.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).