summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorJinyoung Choi <j-young.choi@samsung.com>2023-07-25 14:18:39 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-03 08:48:53 +0200
commita9a99a1ca1b8fba9398f475716937c74c994e12e (patch)
treed52d3e6856453e02a9edd133140e77cceb5fcbb5 /block
parent5e0cde523f226ec7a78a4d930c9300e1de5b9d04 (diff)
downloadlinux-a9a99a1ca1b8fba9398f475716937c74c994e12e.tar.gz
linux-a9a99a1ca1b8fba9398f475716937c74c994e12e.tar.bz2
linux-a9a99a1ca1b8fba9398f475716937c74c994e12e.zip
block: cleanup bio_integrity_prep
[ Upstream commit 51d74ec9b62f5813767a60226acaf943e26e7d7a ] If a problem occurs in the process of creating an integrity payload, the status of bio is always BLK_STS_RESOURCE. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jinyoung Choi <j-young.choi@samsung.com> Reviewed-by: "Martin K. Petersen" <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20230725051839epcms2p8e4d20ad6c51326ad032e8406f59d0aaa@epcms2p8 Signed-off-by: Jens Axboe <axboe@kernel.dk> Stable-dep-of: 899ee2c3829c ("block: initialize integrity buffer to zero before writing it to media") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block')
-rw-r--r--block/bio-integrity.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 8f0af7ac8573..045553a164e0 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -199,7 +199,6 @@ bool bio_integrity_prep(struct bio *bio)
unsigned long start, end;
unsigned int len, nr_pages;
unsigned int bytes, offset, i;
- blk_status_t status;
if (!bi)
return true;
@@ -227,7 +226,6 @@ bool bio_integrity_prep(struct bio *bio)
/* Allocate kernel buffer for protection data */
len = bio_integrity_bytes(bi, bio_sectors(bio));
buf = kmalloc(len, GFP_NOIO);
- status = BLK_STS_RESOURCE;
if (unlikely(buf == NULL)) {
printk(KERN_ERR "could not allocate integrity buffer\n");
goto err_end_io;
@@ -242,7 +240,6 @@ bool bio_integrity_prep(struct bio *bio)
if (IS_ERR(bip)) {
printk(KERN_ERR "could not allocate data integrity bioset\n");
kfree(buf);
- status = BLK_STS_RESOURCE;
goto err_end_io;
}
@@ -270,7 +267,6 @@ bool bio_integrity_prep(struct bio *bio)
if (ret == 0) {
printk(KERN_ERR "could not attach integrity payload\n");
- status = BLK_STS_RESOURCE;
goto err_end_io;
}
@@ -292,7 +288,7 @@ bool bio_integrity_prep(struct bio *bio)
return true;
err_end_io:
- bio->bi_status = status;
+ bio->bi_status = BLK_STS_RESOURCE;
bio_endio(bio);
return false;