* [PATCH] infiniband: cxgb4: cm: Check skb value
@ 2023-09-04 11:59 Artem Chernyshev
2023-09-04 20:07 ` Krzysztof Kozlowski
0 siblings, 1 reply; 5+ messages in thread
From: Artem Chernyshev @ 2023-09-04 11:59 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Artem Chernyshev, Potnuri Bharat Teja, Jason Gunthorpe,
linux-rdma, linux-kernel, lvc-project
get_skb() can't allocate skb in case of OOM.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
---
drivers/infiniband/hw/cxgb4/cm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index ced615b5ea09..775da62b38ec 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -1965,6 +1965,10 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
int win;
skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
+ if (!skb) {
+ pr_err("%s - cannot alloc skb!\n", __func__);
+ return -ENOMEM;
+ }
req = __skb_put_zero(skb, sizeof(*req));
req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR));
req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
--
2.37.3
z
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] infiniband: cxgb4: cm: Check skb value
2023-09-04 11:59 [PATCH] infiniband: cxgb4: cm: Check skb value Artem Chernyshev
@ 2023-09-04 20:07 ` Krzysztof Kozlowski
2023-09-05 12:37 ` Artem Chernyshev
2023-09-05 12:40 ` [PATCH v2] " Artem Chernyshev
0 siblings, 2 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2023-09-04 20:07 UTC (permalink / raw)
To: Artem Chernyshev, Leon Romanovsky
Cc: Potnuri Bharat Teja, Jason Gunthorpe, linux-rdma, linux-kernel,
lvc-project
On 04/09/2023 13:59, Artem Chernyshev wrote:
> get_skb() can't allocate skb in case of OOM.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
> ---
> drivers/infiniband/hw/cxgb4/cm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
> index ced615b5ea09..775da62b38ec 100644
> --- a/drivers/infiniband/hw/cxgb4/cm.c
> +++ b/drivers/infiniband/hw/cxgb4/cm.c
> @@ -1965,6 +1965,10 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
> int win;
>
> skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
> + if (!skb) {
> + pr_err("%s - cannot alloc skb!\n", __func__);
I don't think we print memory allocation failures.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] infiniband: cxgb4: cm: Check skb value
2023-09-04 20:07 ` Krzysztof Kozlowski
@ 2023-09-05 12:37 ` Artem Chernyshev
2023-09-05 12:40 ` [PATCH v2] " Artem Chernyshev
1 sibling, 0 replies; 5+ messages in thread
From: Artem Chernyshev @ 2023-09-05 12:37 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Leon Romanovsky, Potnuri Bharat Teja, Jason Gunthorpe, linux-rdma,
linux-kernel, lvc-project
On Mon, Sep 04, 2023 at 10:07:26PM +0200, Krzysztof Kozlowski wrote:
> On 04/09/2023 13:59, Artem Chernyshev wrote:
> > get_skb() can't allocate skb in case of OOM.
> >
> > Found by Linux Verification Center (linuxtesting.org) with SVACE.
> >
> > Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
> > ---
> > drivers/infiniband/hw/cxgb4/cm.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
> > index ced615b5ea09..775da62b38ec 100644
> > --- a/drivers/infiniband/hw/cxgb4/cm.c
> > +++ b/drivers/infiniband/hw/cxgb4/cm.c
> > @@ -1965,6 +1965,10 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
> > int win;
> >
> > skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
> > + if (!skb) {
> > + pr_err("%s - cannot alloc skb!\n", __func__);
>
> I don't think we print memory allocation failures.
>
> Best regards,
> Krzysztof
>
Sure, will fix that in v2
Thanks,
Artem
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2] infiniband: cxgb4: cm: Check skb value
2023-09-04 20:07 ` Krzysztof Kozlowski
2023-09-05 12:37 ` Artem Chernyshev
@ 2023-09-05 12:40 ` Artem Chernyshev
2023-09-11 11:56 ` Leon Romanovsky
1 sibling, 1 reply; 5+ messages in thread
From: Artem Chernyshev @ 2023-09-05 12:40 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Artem Chernyshev, Leon Romanovsky, Potnuri Bharat Teja,
Jason Gunthorpe, linux-rdma, linux-kernel, lvc-project
get_skb() can't allocate skb in case of OOM.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru>
---
V2 -> remove pr_err
drivers/infiniband/hw/cxgb4/cm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index ced615b5ea09..54145b33a523 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -1965,6 +1965,8 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
int win;
skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
+ if (!skb)
+ return -ENOMEM;
req = __skb_put_zero(skb, sizeof(*req));
req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR));
req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
--
2.37.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] infiniband: cxgb4: cm: Check skb value
2023-09-05 12:40 ` [PATCH v2] " Artem Chernyshev
@ 2023-09-11 11:56 ` Leon Romanovsky
0 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2023-09-11 11:56 UTC (permalink / raw)
To: Krzysztof Kozlowski, Artem Chernyshev
Cc: Potnuri Bharat Teja, Jason Gunthorpe, linux-rdma, linux-kernel,
lvc-project
On Tue, 05 Sep 2023 15:40:48 +0300, Artem Chernyshev wrote:
> get_skb() can't allocate skb in case of OOM.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
>
Applied, thanks!
[1/1] infiniband: cxgb4: cm: Check skb value
https://git.kernel.org/rdma/rdma/c/8fb8a82086f5bd
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-11 22:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-04 11:59 [PATCH] infiniband: cxgb4: cm: Check skb value Artem Chernyshev
2023-09-04 20:07 ` Krzysztof Kozlowski
2023-09-05 12:37 ` Artem Chernyshev
2023-09-05 12:40 ` [PATCH v2] " Artem Chernyshev
2023-09-11 11:56 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox