diff mbox series

block: ratelimit handle_bad_sector() message

Message ID 20201008002344.6759-1-penguin-kernel@I-love.SAKURA.ne.jp (mailing list archive)
State New, archived
Headers show
Series block: ratelimit handle_bad_sector() message | expand

Commit Message

Tetsuo Handa Oct. 8, 2020, 12:23 a.m. UTC
syzbot is reporting unkillable task [1], for the caller is failing to
handle a corrupted filesystem image which attempts to access beyond
the end of the device. While we need to fix the caller, flooding the
console with handle_bad_sector() message is unlikely useful.

[1] https://syzkaller.appspot.com/bug?id=f1f49fb971d7a3e01bd8ab8cff2ff4572ccf3092

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 block/blk-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Christoph Hellwig Oct. 8, 2020, 6:40 a.m. UTC | #1
On Thu, Oct 08, 2020 at 09:23:44AM +0900, Tetsuo Handa wrote:
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -803,8 +803,8 @@ static void handle_bad_sector(struct bio *bio, sector_t maxsector)
>  {
>  	char b[BDEVNAME_SIZE];
>  
> -	printk(KERN_INFO "attempt to access beyond end of device\n");
> -	printk(KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n",
> +	printk_ratelimited(KERN_INFO "attempt to access beyond end of device\n");
> +	printk_ratelimited(KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n",
>  			bio_devname(bio, b), bio->bi_opf,
>  			(unsigned long long)bio_end_sector(bio),
>  			(long long)maxsector);

Please use pr_info_ratelimited, and also remove the casts now that
sector_t is guranteed to be an unsigned long long.
diff mbox series

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index 10c08ac50697..8b67b6e941db 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -803,8 +803,8 @@  static void handle_bad_sector(struct bio *bio, sector_t maxsector)
 {
 	char b[BDEVNAME_SIZE];
 
-	printk(KERN_INFO "attempt to access beyond end of device\n");
-	printk(KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n",
+	printk_ratelimited(KERN_INFO "attempt to access beyond end of device\n");
+	printk_ratelimited(KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n",
 			bio_devname(bio, b), bio->bi_opf,
 			(unsigned long long)bio_end_sector(bio),
 			(long long)maxsector);