linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/backing-dev.c: fix an error handling path in 'cgwb_create()'
@ 2017-09-11 19:43 Christophe JAILLET
  2017-09-11 19:52 ` Jens Axboe
  2017-09-11 20:15 ` Jan Kara
  0 siblings, 2 replies; 6+ messages in thread
From: Christophe JAILLET @ 2017-09-11 19:43 UTC (permalink / raw)
  To: axboe, jack, tj, geliangtang, akpm
  Cc: linux-mm, linux-kernel, kernel-janitors, Christophe JAILLET

If the 'kmalloc' fails, we must go through the existing error handling
path.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 mm/backing-dev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index f028a9a472fd..e19606bb41a0 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -569,8 +569,10 @@ static int cgwb_create(struct backing_dev_info *bdi,
 
 	/* need to create a new one */
 	wb = kmalloc(sizeof(*wb), gfp);
-	if (!wb)
-		return -ENOMEM;
+	if (!wb) {
+		ret = -ENOMEM;
+		goto out_put;
+	}
 
 	ret = wb_init(wb, bdi, blkcg_css->id, gfp);
 	if (ret)
-- 
2.11.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-09-11 20:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-11 19:43 [PATCH] mm/backing-dev.c: fix an error handling path in 'cgwb_create()' Christophe JAILLET
2017-09-11 19:52 ` Jens Axboe
2017-09-11 20:04   ` Christophe JAILLET
2017-09-11 20:07     ` Jens Axboe
2017-09-11 20:15 ` Jan Kara
2017-09-11 20:17   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).