[PATCH] afs: Fix the memory leak in afs_mkdir
Markus Elfring
Markus.Elfring at web.de
Tue Jun 23 12:26:15 EDT 2020
…
> +++ b/fs/afs/dir.c
> @@ -1599,17 +1599,17 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
…
> scb = kcalloc(2, sizeof(struct afs_status_cb), GFP_KERNEL);
> if (!scb)
> goto error_scb;
I suggest to adjust also this jump target so that a call of the function “kfree”
with a null pointer can be avoided.
…
> @@ -1645,10 +1645,10 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
…
> error_key:
> key_put(key);
> +error_scb:
> + kfree(scb);
> error:
> d_drop(dentry);
…
Can an other label than “error” be nicer here?
Regards,
Markus
More information about the linux-afs
mailing list