mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] afs: Cleanup on error in afs_proc_addr_prefs_write()
@ 2024-10-11 19:42 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2024-10-11 19:42 UTC (permalink / raw)
  To: David Howells; +Cc: Marc Dionne, linux-afs, linux-kernel, kernel-janitors

Call kfree(preflist) and drop the inode lock before returning the error
code.

Fixes: f94f70d39cc2 ("afs: Provide a way to configure address priorities")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 fs/afs/addr_prefs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/afs/addr_prefs.c b/fs/afs/addr_prefs.c
index a189ff8a5034..c0384201b8fe 100644
--- a/fs/afs/addr_prefs.c
+++ b/fs/afs/addr_prefs.c
@@ -413,8 +413,10 @@ int afs_proc_addr_prefs_write(struct file *file, char *buf, size_t size)
 
 	do {
 		argc = afs_split_string(&buf, argv, ARRAY_SIZE(argv));
-		if (argc < 0)
-			return argc;
+		if (argc < 0) {
+			ret = argc;
+			goto done;
+		}
 		if (argc < 2)
 			goto inval;
 
-- 
2.45.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-11 19:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-11 19:42 [PATCH] afs: Cleanup on error in afs_proc_addr_prefs_write() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®