Thread (25 messages) 25 messages, 3 authors, 2017-09-20

Re: [PATCH 08/20] lightnvm: pblk: sched. metadata on write thread

From: Rakesh Pandit <hidden>
Date: 2017-09-20 19:25:37
Also in: lkml

On Wed, Sep 20, 2017 at 09:28:34PM +0300, Rakesh Pandit wrote:
Hi Javier,

one small issue I found for error path while going through changes:

On Mon, Jun 26, 2017 at 11:57:17AM +0200, Javier Gonz�lez wrote:
..
quoted
+static int pblk_lines_alloc_metadata(struct pblk *pblk)
+{
[..]
quoted
+		if (!l_mg->sline_meta[i])
+			goto fail_free_smeta;
For this error path the the goto label at end doesn't free up
resources correctly.  It needs a

while (--index >= 0)...

logic with appropriate adjustment.
quoted
+	}
[..]
quoted
+	if (!l_mg->vsc_list)
+		goto fail_free_emeta;
+
+	for (i = 0; i < l_mg->nr_lines; i++)
+		l_mg->vsc_list[i] = cpu_to_le32(EMPTY_ENTRY);
+
+	return 0;
+
+fail_free_emeta:
+	while (--i >= 0) {
+		vfree(l_mg->eline_meta[i]->buf);
This would need l_mg->emeta_alloc_type check to decide whether
allocation was done with kmalloc or vmalloc.
quoted
+		kfree(&l_mg->eline_meta[i]);
+	}
+
+fail_free_smeta:
+	for (i = 0; i < PBLK_DATA_LINES; i++)
+		pblk_mfree(&l_mg->sline_meta[i], l_mg->smeta_alloc_type);
+
+	return -ENOMEM;
+}
+
Thanks,
I failed to see earlier that it has been merged already.  Will post a
patch in a while.

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