Skip to content
  1. Dec 05, 2019
    • Justin Tee's avatar
      block: fix memleak of bio integrity data · ece841ab
      Justin Tee authored
      
      
      7c20f116 ("bio-integrity: stop abusing bi_end_io") moves
      bio_integrity_free from bio_uninit() to bio_integrity_verify_fn()
      and bio_endio(). This way looks wrong because bio may be freed
      without calling bio_endio(), for example, blk_rq_unprep_clone() is
      called from dm_mq_queue_rq() when the underlying queue of dm-mpath
      is busy.
      
      So memory leak of bio integrity data is caused by commit 7c20f116.
      
      Fixes this issue by re-adding bio_integrity_free() to bio_uninit().
      
      Fixes: 7c20f116 ("bio-integrity: stop abusing bi_end_io")
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by Justin Tee <justin.tee@broadcom.com>
      
      Add commit log, and simplify/fix the original patch wroten by Justin.
      
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      ece841ab
    • Hou Tao's avatar
      bfq-iosched: Ensure bio->bi_blkg is valid before using it · 08802ed6
      Hou Tao authored
      
      
      bio->bi_blkg will be NULL when the issue of the request
      has bypassed the block layer as shown in the following oops:
      
       Internal error: Oops: 96000005 [#1] SMP
       CPU: 17 PID: 2996 Comm: scsi_id Not tainted 5.4.0 #4
       Call trace:
        percpu_counter_add_batch+0x38/0x4c8
        bfqg_stats_update_legacy_io+0x9c/0x280
        bfq_insert_requests+0xbac/0x2190
        blk_mq_sched_insert_request+0x288/0x670
        blk_execute_rq_nowait+0x140/0x178
        blk_execute_rq+0x8c/0x140
        sg_io+0x604/0x9c0
        scsi_cmd_ioctl+0xe38/0x10a8
        scsi_cmd_blk_ioctl+0xac/0xe8
        sd_ioctl+0xe4/0x238
        blkdev_ioctl+0x590/0x20e0
        block_ioctl+0x60/0x98
        do_vfs_ioctl+0xe0/0x1b58
        ksys_ioctl+0x80/0xd8
        __arm64_sys_ioctl+0x40/0x78
        el0_svc_handler+0xc4/0x270
      
      so ensure its validity before using it.
      
      Fixes: fd41e603 ("bfq-iosched: stop using blkg->stat_bytes and ->stat_ios")
      Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      08802ed6
  2. Dec 03, 2019
  3. Nov 21, 2019
  4. Nov 20, 2019
  5. Nov 18, 2019
  6. Nov 14, 2019
  7. Nov 13, 2019
  8. Nov 12, 2019
    • Junichi Nomura's avatar
      block: check bi_size overflow before merge · e3a5d8e3
      Junichi Nomura authored
      
      
      __bio_try_merge_page() may merge a page to bio without bio_full() check
      and cause bi_size overflow.
      
      The overflow typically ends up with sd_init_command() warning on zero
      segment request with call trace like this:
      
          ------------[ cut here ]------------
          WARNING: CPU: 2 PID: 1986 at drivers/scsi/scsi_lib.c:1025 scsi_init_io+0x156/0x180
          CPU: 2 PID: 1986 Comm: kworker/2:1H Kdump: loaded Not tainted 5.4.0-rc7 #1
          Workqueue: kblockd blk_mq_run_work_fn
          RIP: 0010:scsi_init_io+0x156/0x180
          RSP: 0018:ffffa11487663bf0 EFLAGS: 00010246
          RAX: 00000000002be0a0 RBX: ffff8e6e9ff30118 RCX: 0000000000000000
          RDX: 00000000ffffffe1 RSI: 0000000000000000 RDI: ffff8e6e9ff30118
          RBP: ffffa11487663c18 R08: ffffa11487663d28 R09: ffff8e6e9ff30150
          R10: 0000000000000001 R11: 0000000000000000 R12: ffff8e6e9ff30000
          R13: 0000000000000001 R14: ffff8e74a1cf1800 R15: ffff8e6e9ff30000
          FS:  0000000000000000(0000) GS:ffff8e6ea7680000(0000) knlGS:0000000000000000
          CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
          CR2: 00007fff18cf0fe8 CR3: 0000000659f0a001 CR4: 00000000001606e0
          Call Trace:
           sd_init_command+0x326/0xb40 [sd_mod]
           scsi_queue_rq+0x502/0xaa0
           ? blk_mq_get_driver_tag+0xe7/0x120
           blk_mq_dispatch_rq_list+0x256/0x5a0
           ? elv_rb_del+0x24/0x30
           ? deadline_remove_request+0x7b/0xc0
           blk_mq_do_dispatch_sched+0xa3/0x140
           blk_mq_sched_dispatch_requests+0xfb/0x170
           __blk_mq_run_hw_queue+0x81/0x130
           blk_mq_run_work_fn+0x1b/0x20
           process_one_work+0x179/0x390
           worker_thread+0x4f/0x3e0
           kthread+0x105/0x140
           ? max_active_store+0x80/0x80
           ? kthread_bind+0x20/0x20
           ret_from_fork+0x35/0x40
          ---[ end trace f9036abf5af4a4d3 ]---
          blk_update_request: I/O error, dev sdd, sector 2875552 op 0x1:(WRITE) flags 0x0 phys_seg 0 prio class 0
          XFS (sdd1): writeback error on sector 2875552
      
      __bio_try_merge_page() should check the overflow before actually doing
      merge.
      
      Fixes: 07173c3e ("block: enable multipage bvecs")
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
      Signed-off-by: default avatarJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      e3a5d8e3
  9. Nov 08, 2019
  10. Nov 07, 2019
Loading