From: Maksim Davydov <davydov-max@yandex-team.ru>
To: Leon Romanovsky <leon@kernel.org>
Cc: rajur@chelsio.com, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, anish@chelsio.com,
hariprasad@chelsio.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 1/2] net/ethernet/chelsio: fix cxgb4_getpgtccfg wrong memory access
Date: Fri, 5 May 2023 12:32:20 +0300 [thread overview]
Message-ID: <da46f02b-dbf1-5927-5d83-e44febcafe7c@yandex-team.ru> (raw)
In-Reply-To: <e246efa2-7bc1-5413-32d0-c2927ebb001e@yandex-team.ru>
Ping
To summarize:
*pgid can be 0xF, but valid values are 0-7. Whether *bw_per is set or
not set inside if-block, it will have valid value (it was set to zero
before)
On 1/18/23 11:29, Maksim Davydov wrote:
>
> On 1/17/23 12:21, Leon Romanovsky wrote:
>> On Mon, Jan 16, 2023 at 06:20:59PM +0300, Maksim Davydov wrote:
>>> *pgid can be in range 0 to 0xF (bitmask 0xF) but valid values for PGID
>>> are between 0 and 7. Also the size of pgrate is 8. Thus, we are needed
>>> additional check to make sure that this code doesn't have access to
>>> tsa.
>>>
>>> Found by Linux Verification Center (linuxtesting.org) with the SVACE
>>> static analysis tool.
>>>
>>> Fixes: 76bcb31efc06 ("cxgb4 : Add DCBx support codebase and dcbnl_ops")
>>> Signed-off-by: Maksim Davydov <davydov-max@yandex-team.ru>
>>> ---
>>> drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | 5 ++++-
>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
>>> b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
>>> index 7d5204834ee2..3aa65f0f335e 100644
>>> --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
>>> +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c
>>> @@ -471,7 +471,10 @@ static void cxgb4_getpgtccfg(struct net_device
>>> *dev, int tc,
>>> return;
>>> }
>>> - *bw_per = pcmd.u.dcb.pgrate.pgrate[*pgid];
>>> + /* Valid values are: 0-7 */
>> How do you see it?
>>
>> There are lines below that assume something different.
>> 477 /* prio_type is link strict */
>> 478 if (*pgid != 0xF)
>> 479 *prio_type = 0x2;
>>
> But if *pgid == 0xF we get value for *bw_per from pgrate.tsa, it seems
> not correct
>
> Thanks for reviewing,
> Maksim Davydov
>>> + if (*pgid <= 7)
>>> + *bw_per = pcmd.u.dcb.pgrate.pgrate[*pgid];
>> Why do you think that it is valid simply do not set *bw_per?
>>
>> Thanks
--
Best regards,
Maksim Davydov
next prev parent reply other threads:[~2023-05-05 9:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 15:20 [PATCH net 0/2] cxgb4: fix memory vulnerabilities Maksim Davydov
2023-01-16 15:20 ` [PATCH net 1/2] net/ethernet/chelsio: fix cxgb4_getpgtccfg wrong memory access Maksim Davydov
2023-01-17 9:21 ` Leon Romanovsky
2023-01-18 8:29 ` Maksim Davydov
2023-05-05 9:32 ` Maksim Davydov [this message]
2023-01-16 15:21 ` [PATCH net 2/2] net/ethernet/chelsio: t4_handle_fw_rpl fix NULL Maksim Davydov
2023-01-17 11:05 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=da46f02b-dbf1-5927-5d83-e44febcafe7c@yandex-team.ru \
--to=davydov-max@yandex-team.ru \
--cc=anish@chelsio.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hariprasad@chelsio.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rajur@chelsio.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®