RDS: Return -EINVAL if rds_rdma_pages returns an error

rds_cmsg_rdma_args would still return success even if rds_rdma_pages
returned an error (or overflowed).

Signed-off-by: Andy Grover <andy.grover@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Andy Grover 2010-10-28 15:40:56 +00:00 committed by David S. Miller
parent 1b1f693d7a
commit a09f69c49b
1 changed files with 3 additions and 1 deletions

View File

@ -554,8 +554,10 @@ int rds_cmsg_rdma_args(struct rds_sock *rs, struct rds_message *rm,
} }
nr_pages = rds_rdma_pages(args); nr_pages = rds_rdma_pages(args);
if (nr_pages < 0) if (nr_pages < 0) {
ret = -EINVAL;
goto out; goto out;
}
pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL); pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL);
if (!pages) { if (!pages) {