Thread (2 messages) 2 messages, 2 authors, 2013-07-30

Re: [PATCH] Avoid double close()

From: NeilBrown <hidden>
Date: 2013-07-30 22:52:56

On Tue, 30 Jul 2013 18:30:03 +0200 Jes.Sorensen@redhat.com wrote:
quoted hunk ↗ jump to hunk
From: Jes Sorensen <redacted>

Coverity discovered a possible double close(fd2) in Grow.c. Avoided by
invalidating fd2 after the first close.

Signed-off-by: Jes Sorensen <redacted>
---
 Grow.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/Grow.c b/Grow.c
index c1ae6e8..ff4ed5d 100644
--- a/Grow.c
+++ b/Grow.c
@@ -4685,6 +4685,8 @@ int Grow_continue_command(char *devname, int fd,
 				continue;
 			err = st->ss->load_super(st, fd2, NULL);
 			close(fd2);
+			/* invalidate fd2 to avoid possible double close() */
+			fd2 = -1;
 			if (err)
 				continue;
 			break;
Applied, thanks.

NeilBrown

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help