From: Pavel Emelyanov <xemul@parallels•com>
To: Andy Grover <andy.grover@oracle•com>, David Miller <davem@davemloft•net>
Cc: rds-devel@oss•oracle.com, Linux Netdev List <netdev@vger•kernel.org>
Subject: [PATCH] rds: Fix rds message leak in rds_message_map_pages
Date: Mon, 08 Nov 2010 19:20:50 +0300 [thread overview]
Message-ID: <4CD82362.9070402@parallels.com> (raw)
The sgs allocation error path leaks the allocated message.
Signed-off-by: Pavel Emelyanov <xemul@openvz•org>
---
diff --git a/net/rds/message.c b/net/rds/message.c
index 848cff4..1fd3d29 100644
--- a/net/rds/message.c
+++ b/net/rds/message.c
@@ -249,8 +249,10 @@ struct rds_message *rds_message_map_pages(unsigned long *page_addrs, unsigned in
rm->m_inc.i_hdr.h_len = cpu_to_be32(total_len);
rm->data.op_nents = ceil(total_len, PAGE_SIZE);
rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs);
- if (!rm->data.op_sg)
+ if (!rm->data.op_sg) {
+ rds_message_put(rm);
return ERR_PTR(-ENOMEM);
+ }
for (i = 0; i < rm->data.op_nents; ++i) {
sg_set_page(&rm->data.op_sg[i],
next reply other threads:[~2010-11-08 16:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-08 16:20 Pavel Emelyanov [this message]
2010-11-08 19:40 ` [PATCH] rds: Fix rds message leak in rds_message_map_pages Andy Grover
2010-11-08 20:20 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CD82362.9070402@parallels.com \
--to=xemul@parallels$(echo .)com \
--cc=andy.grover@oracle$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
--cc=rds-devel@oss$(echo .)oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox