Re: [PATCH 5/7] md: use block_device name vsprintf helper

From: Jan Kara
Date: Tue Apr 14 2015 - 05:43:31 EST


On Mon 13-04-15 16:31:38, Dmitry Monakhov wrote:
>
> Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
...
> @@ -2610,7 +2597,6 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
> struct bio *bio;
> struct r10conf *conf = mddev->private;
> struct md_rdev *rdev = r10_bio->devs[slot].rdev;
> - char b[BDEVNAME_SIZE];
> unsigned long do_sync;
> int max_sectors;
>
> @@ -2623,7 +2609,6 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
> * frozen.
> */
> bio = r10_bio->devs[slot].bio;
> - bdevname(bio->bi_bdev, b);
> bio_put(bio);
> r10_bio->devs[slot].bio = NULL;
>
> @@ -2639,9 +2624,9 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
> read_more:
> rdev = read_balance(conf, r10_bio, &max_sectors);
> if (rdev == NULL) {
> - printk(KERN_ALERT "md/raid10:%s: %s: unrecoverable I/O"
> + printk(KERN_ALERT "md/raid10:%s: %pg: unrecoverable I/O"
> " read error for block %llu\n",
> - mdname(mddev), b,
> + mdname(mddev), bio->bi_bdev,
> (unsigned long long)r10_bio->sector);
> raid_end_bio_io(r10_bio);
> return;
So it seems to me that in the above, you'll reference bio->bi_bdev of an
already free bio since the code does bio_put() just after calling
bdevname()...

Honza
--
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/