* [PATCH] Btrfs: fix memory leak in btrfs_ioctl_start_sync()
@ 2011-04-04 1:09 Tsutomu Itoh
2011-04-04 1:52 ` Tsutomu Itoh
0 siblings, 1 reply; 2+ messages in thread
From: Tsutomu Itoh @ 2011-04-04 1:09 UTC (permalink / raw)
To: Linux Btrfs; +Cc: Chris Mason
Free btrfs_trans_handle if btrfs_commit_transaction_async() fails.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
---
fs/btrfs/ioctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff -urNp linux-2.6.39-rc1/fs/btrfs/ioctl.c linux-2.6.39-rc1.new/fs/btrfs/ioctl.c
--- linux-2.6.39-rc1/fs/btrfs/ioctl.c 2011-03-30 04:09:47.000000000 +0900
+++ linux-2.6.39-rc1.new/fs/btrfs/ioctl.c 2011-04-04 09:52:17.000000000 +0900
@@ -2436,8 +2436,10 @@ static noinline long btrfs_ioctl_start_s
return PTR_ERR(trans);
transid = trans->transid;
ret = btrfs_commit_transaction_async(trans, root, 0);
- if (ret)
+ if (ret) {
+ kmem_cache_free(btrfs_trans_handle_cachep, trans);
return ret;
+ }
if (argp)
if (copy_to_user(argp, &transid, sizeof(transid)))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Btrfs: fix memory leak in btrfs_ioctl_start_sync()
2011-04-04 1:09 [PATCH] Btrfs: fix memory leak in btrfs_ioctl_start_sync() Tsutomu Itoh
@ 2011-04-04 1:52 ` Tsutomu Itoh
0 siblings, 0 replies; 2+ messages in thread
From: Tsutomu Itoh @ 2011-04-04 1:52 UTC (permalink / raw)
To: Linux Btrfs; +Cc: Chris Mason
Sorry. Ignore previous patch.
New patch is as follows.
Thanks,
Tsutomu
(2011/04/04 10:09), Tsutomu Itoh wrote:
> Free btrfs_trans_handle if btrfs_commit_transaction_async() fails.
>
> Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
> ---
> fs/btrfs/ioctl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff -urNp linux-2.6.39-rc1/fs/btrfs/ioctl.c linux-2.6.39-rc1.new/fs/btrfs/ioctl.c
> --- linux-2.6.39-rc1/fs/btrfs/ioctl.c 2011-03-30 04:09:47.000000000 +0900
> +++ linux-2.6.39-rc1.new/fs/btrfs/ioctl.c 2011-04-04 09:52:17.000000000 +0900
> @@ -2436,8 +2436,10 @@ static noinline long btrfs_ioctl_start_s
> return PTR_ERR(trans);
> transid = trans->transid;
> ret = btrfs_commit_transaction_async(trans, root, 0);
> - if (ret)
> + if (ret) {
> + kmem_cache_free(btrfs_trans_handle_cachep, trans);
> return ret;
> + }
>
> if (argp)
> if (copy_to_user(argp, &transid, sizeof(transid)))
>
Call btrfs_end_transaction() if btrfs_commit_transaction_async() fails.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
---
fs/btrfs/ioctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff -urNp linux-2.6.39-rc1/fs/btrfs/ioctl.c linux-2.6.39-rc1.new/fs/btrfs/ioctl.c
--- linux-2.6.39-rc1/fs/btrfs/ioctl.c 2011-03-30 04:09:47.000000000 +0900
+++ linux-2.6.39-rc1.new/fs/btrfs/ioctl.c 2011-04-04 10:46:45.000000000 +0900
@@ -2436,8 +2436,10 @@ static noinline long btrfs_ioctl_start_s
return PTR_ERR(trans);
transid = trans->transid;
ret = btrfs_commit_transaction_async(trans, root, 0);
- if (ret)
+ if (ret) {
+ btrfs_end_transaction(trans, root);
return ret;
+ }
if (argp)
if (copy_to_user(argp, &transid, sizeof(transid)))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-04 1:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-04 1:09 [PATCH] Btrfs: fix memory leak in btrfs_ioctl_start_sync() Tsutomu Itoh
2011-04-04 1:52 ` Tsutomu Itoh
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).