summaryrefslogtreecommitdiffstats
path: root/net/rds
diff options
context:
space:
mode:
authorCong Wang <cwang@twopensource.com>2014-10-14 12:35:08 -0700
committerDavid S. Miller <davem@davemloft.net>2014-10-14 17:00:19 -0400
commitdee49f203a7feef5d00c416b7dc7e34a7caba8e1 (patch)
treef3ba47780b9bc7362479f3caae851fe527543f35 /net/rds
parent22c0b963d7400971f4c5a1a67b083e3742996640 (diff)
downloadop-kernel-dev-dee49f203a7feef5d00c416b7dc7e34a7caba8e1.zip
op-kernel-dev-dee49f203a7feef5d00c416b7dc7e34a7caba8e1.tar.gz
rds: avoid calling sock_kfree_s() on allocation failure
It is okay to free a NULL pointer but not okay to mischarge the socket optmem accounting. Compile test only. Reported-by: rucsoftsec@gmail.com Cc: Chien Yen <chien.yen@oracle.com> Cc: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Cong Wang <cwang@twopensource.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds')
-rw-r--r--net/rds/rdma.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/rds/rdma.c b/net/rds/rdma.c
index 4e37c1c..40084d8 100644
--- a/net/rds/rdma.c
+++ b/net/rds/rdma.c
@@ -564,12 +564,12 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
if (rs->rs_bound_addr == 0) {
ret = -ENOTCONN; /* XXX not a great errno */
- goto out;
+ goto out_ret;
}
if (args->nr_local > UIO_MAXIOV) {
ret = -EMSGSIZE;
- goto out;
+ goto out_ret;
}
/* Check whether to allocate the iovec area */
@@ -578,7 +578,7 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
iovs = sock_kmalloc(rds_rs_to_sk(rs), iov_size, GFP_KERNEL);
if (!iovs) {
ret = -ENOMEM;
- goto out;
+ goto out_ret;
}
}
@@ -696,6 +696,7 @@ out:
if (iovs != iovstack)
sock_kfree_s(rds_rs_to_sk(rs), iovs, iov_size);
kfree(pages);
+out_ret:
if (ret)
rds_rdma_free_op(op);
else
OpenPOWER on IntegriCloud