mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
rds: Fix rds message leak in rds_message_map_pages
The sgs allocation error path leaks the allocated message. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Andy Grover <andy.grover@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
0cffef48eb
commit
aa58163a76
@ -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->m_inc.i_hdr.h_len = cpu_to_be32(total_len);
|
||||||
rm->data.op_nents = ceil(total_len, PAGE_SIZE);
|
rm->data.op_nents = ceil(total_len, PAGE_SIZE);
|
||||||
rm->data.op_sg = rds_message_alloc_sgs(rm, num_sgs);
|
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);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < rm->data.op_nents; ++i) {
|
for (i = 0; i < rm->data.op_nents; ++i) {
|
||||||
sg_set_page(&rm->data.op_sg[i],
|
sg_set_page(&rm->data.op_sg[i],
|
||||||
|
Loading…
Reference in New Issue
Block a user