* [PATCH v2] RDMA/rxe: check for error
@ 2020-04-25 23:35 Sudip Mukherjee
2020-04-27 2:34 ` Yanjun Zhu
2020-05-04 17:22 ` Jason Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2020-04-25 23:35 UTC (permalink / raw)
To: Zhu Yanjun, Doug Ledford, Jason Gunthorpe
Cc: linux-kernel, linux-rdma, Sudip Mukherjee
The commit 'ff23dfa13457' modified rxe_create_mmap_info() to return
error code and also NULL but missed fixing codes which called
rxe_create_mmap_info(). Modify rxe_create_mmap_info() to only return
errorcode and fix error checking after rxe_create_mmap_info() was
called.
Fixes: ff23dfa13457 ("IB: Pass only ib_udata in function prototypes")
Cc: stable@vger.kernel.org [5.4+]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
drivers/infiniband/sw/rxe/rxe_mmap.c | 2 +-
drivers/infiniband/sw/rxe/rxe_queue.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_mmap.c b/drivers/infiniband/sw/rxe/rxe_mmap.c
index 48f48122ddcb..6a413d73b95d 100644
--- a/drivers/infiniband/sw/rxe/rxe_mmap.c
+++ b/drivers/infiniband/sw/rxe/rxe_mmap.c
@@ -151,7 +151,7 @@ struct rxe_mmap_info *rxe_create_mmap_info(struct rxe_dev *rxe, u32 size,
ip = kmalloc(sizeof(*ip), GFP_KERNEL);
if (!ip)
- return NULL;
+ return ERR_PTR(-ENOMEM);
size = PAGE_ALIGN(size);
diff --git a/drivers/infiniband/sw/rxe/rxe_queue.c b/drivers/infiniband/sw/rxe/rxe_queue.c
index ff92704de32f..fef2ab5112de 100644
--- a/drivers/infiniband/sw/rxe/rxe_queue.c
+++ b/drivers/infiniband/sw/rxe/rxe_queue.c
@@ -45,8 +45,10 @@ int do_mmap_info(struct rxe_dev *rxe, struct mminfo __user *outbuf,
if (outbuf) {
ip = rxe_create_mmap_info(rxe, buf_size, udata, buf);
- if (!ip)
+ if (IS_ERR(ip)) {
+ err = PTR_ERR(ip);
goto err1;
+ }
err = copy_to_user(outbuf, &ip->info, sizeof(ip->info));
if (err)
@@ -64,7 +66,7 @@ int do_mmap_info(struct rxe_dev *rxe, struct mminfo __user *outbuf,
err2:
kfree(ip);
err1:
- return -EINVAL;
+ return err;
}
inline void rxe_queue_reset(struct rxe_queue *q)
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH v2] RDMA/rxe: check for error
2020-04-25 23:35 [PATCH v2] RDMA/rxe: check for error Sudip Mukherjee
@ 2020-04-27 2:34 ` Yanjun Zhu
2020-05-04 17:22 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Yanjun Zhu @ 2020-04-27 2:34 UTC (permalink / raw)
To: Sudip Mukherjee, Doug Ledford, Jason Gunthorpe; +Cc: linux-kernel, linux-rdma
In the commit log,
ff23dfa13457 ("IB: Pass only ib_udata in function prototypes") is better than commit 'ff23dfa13457'?
-----Original Message-----
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Sent: Sunday, April 26, 2020 7:36 AM
To: Yanjun Zhu <yanjunz@mellanox.com>; Doug Ledford <dledford@redhat.com>; Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-kernel@vger.kernel.org; linux-rdma@vger.kernel.org; Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Subject: [PATCH v2] RDMA/rxe: check for error
The commit 'ff23dfa13457' modified rxe_create_mmap_info() to return error code and also NULL but missed fixing codes which called rxe_create_mmap_info(). Modify rxe_create_mmap_info() to only return errorcode and fix error checking after rxe_create_mmap_info() was called.
Fixes: ff23dfa13457 ("IB: Pass only ib_udata in function prototypes")
Cc: stable@vger.kernel.org [5.4+]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
drivers/infiniband/sw/rxe/rxe_mmap.c | 2 +- drivers/infiniband/sw/rxe/rxe_queue.c | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_mmap.c b/drivers/infiniband/sw/rxe/rxe_mmap.c
index 48f48122ddcb..6a413d73b95d 100644
--- a/drivers/infiniband/sw/rxe/rxe_mmap.c
+++ b/drivers/infiniband/sw/rxe/rxe_mmap.c
@@ -151,7 +151,7 @@ struct rxe_mmap_info *rxe_create_mmap_info(struct rxe_dev *rxe, u32 size,
ip = kmalloc(sizeof(*ip), GFP_KERNEL);
if (!ip)
- return NULL;
+ return ERR_PTR(-ENOMEM);
size = PAGE_ALIGN(size);
diff --git a/drivers/infiniband/sw/rxe/rxe_queue.c b/drivers/infiniband/sw/rxe/rxe_queue.c
index ff92704de32f..fef2ab5112de 100644
--- a/drivers/infiniband/sw/rxe/rxe_queue.c
+++ b/drivers/infiniband/sw/rxe/rxe_queue.c
@@ -45,8 +45,10 @@ int do_mmap_info(struct rxe_dev *rxe, struct mminfo __user *outbuf,
if (outbuf) {
ip = rxe_create_mmap_info(rxe, buf_size, udata, buf);
- if (!ip)
+ if (IS_ERR(ip)) {
+ err = PTR_ERR(ip);
goto err1;
+ }
err = copy_to_user(outbuf, &ip->info, sizeof(ip->info));
if (err)
@@ -64,7 +66,7 @@ int do_mmap_info(struct rxe_dev *rxe, struct mminfo __user *outbuf,
err2:
kfree(ip);
err1:
- return -EINVAL;
+ return err;
}
inline void rxe_queue_reset(struct rxe_queue *q)
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] RDMA/rxe: check for error
2020-04-25 23:35 [PATCH v2] RDMA/rxe: check for error Sudip Mukherjee
2020-04-27 2:34 ` Yanjun Zhu
@ 2020-05-04 17:22 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-05-04 17:22 UTC (permalink / raw)
To: Sudip Mukherjee; +Cc: Zhu Yanjun, Doug Ledford, linux-kernel, linux-rdma
On Sun, Apr 26, 2020 at 12:35:45AM +0100, Sudip Mukherjee wrote:
> The commit 'ff23dfa13457' modified rxe_create_mmap_info() to return
> error code and also NULL but missed fixing codes which called
> rxe_create_mmap_info(). Modify rxe_create_mmap_info() to only return
> errorcode and fix error checking after rxe_create_mmap_info() was
> called.
>
> Fixes: ff23dfa13457 ("IB: Pass only ib_udata in function prototypes")
> Cc: stable@vger.kernel.org [5.4+]
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
> drivers/infiniband/sw/rxe/rxe_mmap.c | 2 +-
> drivers/infiniband/sw/rxe/rxe_queue.c | 6 ++++--
> 2 files changed, 5 insertions(+), 3 deletions(-)
Applied to for-rc, thanks
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-04 17:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-25 23:35 [PATCH v2] RDMA/rxe: check for error Sudip Mukherjee
2020-04-27 2:34 ` Yanjun Zhu
2020-05-04 17:22 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).