Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] block: switch to pr_warn() in __device_add_disk()
@ 2020-10-11 13:03 Rustam Kovhaev
  2020-10-11 14:53 ` Hannes Reinecke
  0 siblings, 1 reply; 3+ messages in thread
From: Rustam Kovhaev @ 2020-10-11 13:03 UTC (permalink / raw)
  To: axboe, linux-block; +Cc: linux-kernel, Rustam Kovhaev

syzbot triggered a warning while fuzzing with failslab fault injection
enabled
let's convert WARN_ON() to pr_warn()

Reported-and-tested-by: syzbot+f41893bb8c45cd18cf08@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=f41893bb8c45cd18cf08
Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
---
 block/genhd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/genhd.c b/block/genhd.c
index 99c64641c314..be9ce35cf0fe 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -822,7 +822,8 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk,
 		/* Register BDI before referencing it from bdev */
 		dev->devt = devt;
 		ret = bdi_register(bdi, "%u:%u", MAJOR(devt), MINOR(devt));
-		WARN_ON(ret);
+		if (ret)
+			pr_warn("%s: failed to register backing dev info\n", disk->disk_name);
 		bdi_set_owner(bdi, dev);
 		blk_register_region(disk_devt(disk), disk->minors, NULL,
 				    exact_match, exact_lock, disk);
-- 
2.28.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: switch to pr_warn() in __device_add_disk()
  2020-10-11 13:03 [PATCH] block: switch to pr_warn() in __device_add_disk() Rustam Kovhaev
@ 2020-10-11 14:53 ` Hannes Reinecke
  2020-10-11 15:32   ` Rustam Kovhaev
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Reinecke @ 2020-10-11 14:53 UTC (permalink / raw)
  To: Rustam Kovhaev, axboe, linux-block; +Cc: linux-kernel

On 10/11/20 3:03 PM, Rustam Kovhaev wrote:
> syzbot triggered a warning while fuzzing with failslab fault injection
> enabled
> let's convert WARN_ON() to pr_warn()
> 
> Reported-and-tested-by: syzbot+f41893bb8c45cd18cf08@syzkaller.appspotmail.com
> Link: https://syzkaller.appspot.com/bug?extid=f41893bb8c45cd18cf08
> Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
> ---
>   block/genhd.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index 99c64641c314..be9ce35cf0fe 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -822,7 +822,8 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk,
>   		/* Register BDI before referencing it from bdev */
>   		dev->devt = devt;
>   		ret = bdi_register(bdi, "%u:%u", MAJOR(devt), MINOR(devt));
> -		WARN_ON(ret);
> +		if (ret)
> +			pr_warn("%s: failed to register backing dev info\n", disk->disk_name);
>   		bdi_set_owner(bdi, dev);
>   		blk_register_region(disk_devt(disk), disk->minors, NULL,
>   				    exact_match, exact_lock, disk);
> 
Please, don't. Where is the point in continuing here?
I'd rather have it fixed up properly, either by having a return value to 
__device_add_disk() or by allowing the caller to check (eg by checking 
GENHD_FL_UP) if the call succeeded.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: switch to pr_warn() in __device_add_disk()
  2020-10-11 14:53 ` Hannes Reinecke
@ 2020-10-11 15:32   ` Rustam Kovhaev
  0 siblings, 0 replies; 3+ messages in thread
From: Rustam Kovhaev @ 2020-10-11 15:32 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: axboe, linux-block, linux-kernel

On Sun, Oct 11, 2020 at 04:53:22PM +0200, Hannes Reinecke wrote:
> On 10/11/20 3:03 PM, Rustam Kovhaev wrote:
> > syzbot triggered a warning while fuzzing with failslab fault injection
> > enabled
> > let's convert WARN_ON() to pr_warn()
> > 
> > Reported-and-tested-by: syzbot+f41893bb8c45cd18cf08@syzkaller.appspotmail.com
> > Link: https://syzkaller.appspot.com/bug?extid=f41893bb8c45cd18cf08
> > Signed-off-by: Rustam Kovhaev <rkovhaev@gmail.com>
> > ---
> >   block/genhd.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/block/genhd.c b/block/genhd.c
> > index 99c64641c314..be9ce35cf0fe 100644
> > --- a/block/genhd.c
> > +++ b/block/genhd.c
> > @@ -822,7 +822,8 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk,
> >   		/* Register BDI before referencing it from bdev */
> >   		dev->devt = devt;
> >   		ret = bdi_register(bdi, "%u:%u", MAJOR(devt), MINOR(devt));
> > -		WARN_ON(ret);
> > +		if (ret)
> > +			pr_warn("%s: failed to register backing dev info\n", disk->disk_name);
> >   		bdi_set_owner(bdi, dev);
> >   		blk_register_region(disk_devt(disk), disk->minors, NULL,
> >   				    exact_match, exact_lock, disk);
> > 
> Please, don't. Where is the point in continuing here?
> I'd rather have it fixed up properly, either by having a return value to
> __device_add_disk() or by allowing the caller to check (eg by checking
> GENHD_FL_UP) if the call succeeded.
thank you for the review, it makes sense.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-11 13:03 [PATCH] block: switch to pr_warn() in __device_add_disk() Rustam Kovhaev
2020-10-11 14:53 ` Hannes Reinecke
2020-10-11 15:32   ` Rustam Kovhaev

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org
	public-inbox-index linux-block

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git