Skip to content

Commit

Permalink
rds: Fix rds message leak in rds_message_map_pages
Browse files Browse the repository at this point in the history
The sgs allocation error path leaks the allocated message.

Signed-off-by: Pavel Emelyanov <[email protected]>
Acked-by: Andy Grover <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
xemul authored and davem330 committed Nov 8, 2010
1 parent 0cffef4 commit aa58163
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/rds/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit aa58163

Please sign in to comment.