Skip to contentSkip to conversation

nfs/blocklayout: fput() needed for ENODEV error flow

PATCH In review [email protected] 4 participants 4 messages Jun 19, 2024 – Jun 20, 2024

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 nfs/blocklayout: fput() needed for ENODEV error flow

From: Chuck Lever <[email protected]>

A recently-added error flow needs to fput() the block device just like the other error flows in this area; otherwise the device is leaked.

Fixes d76c769c8db4 ("pnfs/blocklayout: Don't add zero-length pnfs_block_dev")
---
 fs/nfs/blocklayout/dev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/nfs/blocklayout/dev.c +4 -2
index 93ef7f864980..519c310c745d 100644
@@ -351,8 +351,10 @@ bl_parse_scsi(struct nfs_server *server, struct pnfs_block_dev *d,
 	d->map = bl_map_simple;
 	d->pr_key = v->scsi.pr_key;
 
-	if (d->len == 0)
-		return -ENODEV;
+	if (d->len == 0) {
+		error = -ENODEV;
+		goto out_blkdev_put;
+	}
 
 	pr_info("pNFS: using block device %s (reservation key 0x%llx)\n",
 		file_bdev(d->bdev_file)->bd_disk->disk_name, d->pr_key);
Signature · 1 line
2.45.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Wed, Jun 19, 2024 at 09:52:56AM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>

A recently-added error flow needs to fput() the block device just like the other error flows in this area; otherwise the device is leaked.

Fixes d76c769c8db4 ("pnfs/blocklayout: Don't add zero-length pnfs_block_dev")

Looks good:

Reviewed-by on v1 1/1
#3 lore raw
In reply to [email protected]
Quoted 8 lines · On 19 Jun 2024, at 9:52, [email protected] wrote:

From: Chuck Lever <[email protected]>

A recently-added error flow needs to fput() the block device just like the other error flows in this area; otherwise the device is leaked.

Fixes d76c769c8db4 ("pnfs/blocklayout: Don't add zero-length pnfs_block_dev")

Mea Culpa,

Ben