[v2] drivers/net: fix dereference after null check coverity
Checks
Commit Message
This patch tries to fix the coverity issues of dereference after null
check.
The addresses of receive queue start segment for ice, avf, i40e,
fm10k and ixgb were not checked before use. Add check to avoid
coverity issues.
Coverity issue: 343452
Coverity issue: 343407
Fixes: c68a52b8 ("net/ice: support vector SSE in Rx")
Coverity issue: 343447
Fixes: 319c421f ("net/avf: enable SSE Rx Tx")
Coverity issue: 343422
Coverity issue: 343403
Fixes: ca74903b ("net/i40e: extract non-x86 specific code from vector driver")
Coverity issue: 343416
Fixes: fe65e1e1 ("fm10k: add vector scatter Rx")
Coverity issue: 13245
Fixes: 8a44c15a ("net/ixgbe: extract non-x86 specific code from vector driver")
Cc: stable@dpdk.org
Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
v2 changes:
* update commit log with fixes information.
drivers/net/fm10k/fm10k_rxtx_vec.c | 3 +++
drivers/net/i40e/i40e_rxtx_vec_common.h | 3 +++
drivers/net/iavf/iavf_rxtx_vec_common.h | 3 +++
drivers/net/ice/ice_rxtx_vec_common.h | 3 +++
drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 3 +++
5 files changed, 15 insertions(+)
Comments
On 7/15/2019 1:15 PM, Xiao Zhang wrote:
> This patch tries to fix the coverity issues of dereference after null
> check.
> The addresses of receive queue start segment for ice, avf, i40e,
> fm10k and ixgb were not checked before use. Add check to avoid
> coverity issues.
>
> Coverity issue: 343452
> Coverity issue: 343407
> Fixes: c68a52b8 ("net/ice: support vector SSE in Rx")
> Coverity issue: 343447
> Fixes: 319c421f ("net/avf: enable SSE Rx Tx")
> Coverity issue: 343422
> Coverity issue: 343403
> Fixes: ca74903b ("net/i40e: extract non-x86 specific code from vector driver")
> Coverity issue: 343416
> Fixes: fe65e1e1 ("fm10k: add vector scatter Rx")
> Coverity issue: 13245
> Fixes: 8a44c15a ("net/ixgbe: extract non-x86 specific code from vector driver")
> Cc: stable@dpdk.org
>
> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
In patchwork status of this patch is "Superseded" but I can't find the patch
that supersedes this patch, is the current status correct?
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, July 16, 2019 7:55 PM
> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Lu,
> Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming <qiming.yang@intel.com>;
> stable@dpdk.org
> Subject: Re: [dpdk-stable] [v2] drivers/net: fix dereference after null check
> coverity
>
> On 7/15/2019 1:15 PM, Xiao Zhang wrote:
> > This patch tries to fix the coverity issues of dereference after null
> > check.
> > The addresses of receive queue start segment for ice, avf, i40e, fm10k
> > and ixgb were not checked before use. Add check to avoid coverity
> > issues.
> >
> > Coverity issue: 343452
> > Coverity issue: 343407
> > Fixes: c68a52b8 ("net/ice: support vector SSE in Rx") Coverity issue:
> > 343447
> > Fixes: 319c421f ("net/avf: enable SSE Rx Tx") Coverity issue: 343422
> > Coverity issue: 343403
> > Fixes: ca74903b ("net/i40e: extract non-x86 specific code from vector
> > driver") Coverity issue: 343416
> > Fixes: fe65e1e1 ("fm10k: add vector scatter Rx") Coverity issue: 13245
> > Fixes: 8a44c15a ("net/ixgbe: extract non-x86 specific code from vector
> > driver")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
>
> In patchwork status of this patch is "Superseded" but I can't find the patch
> that supersedes this patch, is the current status correct?
Sorry, the status of the patch should be "Rejected", I have updated the status.
On 7/16/2019 1:19 PM, Zhang, Xiao wrote:
>
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Tuesday, July 16, 2019 7:55 PM
>> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
>> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
>> <xiao.w.wang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Lu,
>> Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming <qiming.yang@intel.com>;
>> stable@dpdk.org
>> Subject: Re: [dpdk-stable] [v2] drivers/net: fix dereference after null check
>> coverity
>>
>> On 7/15/2019 1:15 PM, Xiao Zhang wrote:
>>> This patch tries to fix the coverity issues of dereference after null
>>> check.
>>> The addresses of receive queue start segment for ice, avf, i40e, fm10k
>>> and ixgb were not checked before use. Add check to avoid coverity
>>> issues.
>>>
>>> Coverity issue: 343452
>>> Coverity issue: 343407
>>> Fixes: c68a52b8 ("net/ice: support vector SSE in Rx") Coverity issue:
>>> 343447
>>> Fixes: 319c421f ("net/avf: enable SSE Rx Tx") Coverity issue: 343422
>>> Coverity issue: 343403
>>> Fixes: ca74903b ("net/i40e: extract non-x86 specific code from vector
>>> driver") Coverity issue: 343416
>>> Fixes: fe65e1e1 ("fm10k: add vector scatter Rx") Coverity issue: 13245
>>> Fixes: 8a44c15a ("net/ixgbe: extract non-x86 specific code from vector
>>> driver")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
>>
>> In patchwork status of this patch is "Superseded" but I can't find the patch
>> that supersedes this patch, is the current status correct?
>
> Sorry, the status of the patch should be "Rejected", I have updated the status.
>
Thanks for updating, why it is rejected? (self-rejected ?)
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, July 16, 2019 10:26 PM
> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Lu,
> Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming <qiming.yang@intel.com>;
> stable@dpdk.org
> Subject: Re: [dpdk-stable] [v2] drivers/net: fix dereference after null check
> coverity
>
> On 7/16/2019 1:19 PM, Zhang, Xiao wrote:
> >
> >> -----Original Message-----
> >> From: Yigit, Ferruh
> >> Sent: Tuesday, July 16, 2019 7:55 PM
> >> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> >> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
> >> <xiao.w.wang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Lu,
> >> Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>;
> >> stable@dpdk.org
> >> Subject: Re: [dpdk-stable] [v2] drivers/net: fix dereference after
> >> null check coverity
> >>
> >> On 7/15/2019 1:15 PM, Xiao Zhang wrote:
> >>> This patch tries to fix the coverity issues of dereference after
> >>> null check.
> >>> The addresses of receive queue start segment for ice, avf, i40e,
> >>> fm10k and ixgb were not checked before use. Add check to avoid
> >>> coverity issues.
> >>>
> >>> Coverity issue: 343452
> >>> Coverity issue: 343407
> >>> Fixes: c68a52b8 ("net/ice: support vector SSE in Rx") Coverity issue:
> >>> 343447
> >>> Fixes: 319c421f ("net/avf: enable SSE Rx Tx") Coverity issue: 343422
> >>> Coverity issue: 343403
> >>> Fixes: ca74903b ("net/i40e: extract non-x86 specific code from
> >>> vector
> >>> driver") Coverity issue: 343416
> >>> Fixes: fe65e1e1 ("fm10k: add vector scatter Rx") Coverity issue:
> >>> 13245
> >>> Fixes: 8a44c15a ("net/ixgbe: extract non-x86 specific code from
> >>> vector
> >>> driver")
> >>> Cc: stable@dpdk.org
> >>>
> >>> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> >>
> >> In patchwork status of this patch is "Superseded" but I can't find
> >> the patch that supersedes this patch, is the current status correct?
> >
> > Sorry, the status of the patch should be "Rejected", I have updated the
> status.
> >
>
> Thanks for updating, why it is rejected? (self-rejected ?)
Yes, since this issues are for different devices, I was suggested better to split the patch base on the device or issue ID.
On 7/16/2019 3:35 PM, Zhang, Xiao wrote:
>
>> -----Original Message-----
>> From: Yigit, Ferruh
>> Sent: Tuesday, July 16, 2019 10:26 PM
>> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
>> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
>> <xiao.w.wang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Lu,
>> Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming <qiming.yang@intel.com>;
>> stable@dpdk.org
>> Subject: Re: [dpdk-stable] [v2] drivers/net: fix dereference after null check
>> coverity
>>
>> On 7/16/2019 1:19 PM, Zhang, Xiao wrote:
>>>
>>>> -----Original Message-----
>>>> From: Yigit, Ferruh
>>>> Sent: Tuesday, July 16, 2019 7:55 PM
>>>> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
>>>> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
>>>> <xiao.w.wang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Lu,
>>>> Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
>> <qiming.yang@intel.com>;
>>>> stable@dpdk.org
>>>> Subject: Re: [dpdk-stable] [v2] drivers/net: fix dereference after
>>>> null check coverity
>>>>
>>>> On 7/15/2019 1:15 PM, Xiao Zhang wrote:
>>>>> This patch tries to fix the coverity issues of dereference after
>>>>> null check.
>>>>> The addresses of receive queue start segment for ice, avf, i40e,
>>>>> fm10k and ixgb were not checked before use. Add check to avoid
>>>>> coverity issues.
>>>>>
>>>>> Coverity issue: 343452
>>>>> Coverity issue: 343407
>>>>> Fixes: c68a52b8 ("net/ice: support vector SSE in Rx") Coverity issue:
>>>>> 343447
>>>>> Fixes: 319c421f ("net/avf: enable SSE Rx Tx") Coverity issue: 343422
>>>>> Coverity issue: 343403
>>>>> Fixes: ca74903b ("net/i40e: extract non-x86 specific code from
>>>>> vector
>>>>> driver") Coverity issue: 343416
>>>>> Fixes: fe65e1e1 ("fm10k: add vector scatter Rx") Coverity issue:
>>>>> 13245
>>>>> Fixes: 8a44c15a ("net/ixgbe: extract non-x86 specific code from
>>>>> vector
>>>>> driver")
>>>>> Cc: stable@dpdk.org
>>>>>
>>>>> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
>>>>
>>>> In patchwork status of this patch is "Superseded" but I can't find
>>>> the patch that supersedes this patch, is the current status correct?
>>>
>>> Sorry, the status of the patch should be "Rejected", I have updated the
>> status.
>>>
>>
>> Thanks for updating, why it is rejected? (self-rejected ?)
>
> Yes, since this issues are for different devices, I was suggested better to split the patch base on the device or issue ID.
>
So there will be a new version, if so can you please update the patch status as
"Change requested"?
And I think it is better to make these suggestions publicly, at least put the a
quick summary about the decision, so that other interested parties can be aware
of it and/or comment on it.
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, July 16, 2019 10:45 PM
> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; Yang, Qiming <qiming.yang@intel.com>;
> stable@dpdk.org
> Subject: Re: [dpdk-stable] [v2] drivers/net: fix dereference after null check
> coverity
>
> On 7/16/2019 3:35 PM, Zhang, Xiao wrote:
> >
> >> -----Original Message-----
> >> From: Yigit, Ferruh
> >> Sent: Tuesday, July 16, 2019 10:26 PM
> >> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> >> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
> >> <xiao.w.wang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Lu,
> >> Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming <qiming.yang@intel.com>;
> >> stable@dpdk.org
> >> Subject: Re: [dpdk-stable] [v2] drivers/net: fix dereference after
> >> null check coverity
> >>
> >> On 7/16/2019 1:19 PM, Zhang, Xiao wrote:
> >>>
> >>>> -----Original Message-----
> >>>> From: Yigit, Ferruh
> >>>> Sent: Tuesday, July 16, 2019 7:55 PM
> >>>> To: Zhang, Xiao <xiao.zhang@intel.com>; dev@dpdk.org
> >>>> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
> >>>> <xiao.w.wang@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Lu,
> >>>> Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> >> <qiming.yang@intel.com>;
> >>>> stable@dpdk.org
> >>>> Subject: Re: [dpdk-stable] [v2] drivers/net: fix dereference after
> >>>> null check coverity
> >>>>
> >>>> On 7/15/2019 1:15 PM, Xiao Zhang wrote:
> >>>>> This patch tries to fix the coverity issues of dereference after
> >>>>> null check.
> >>>>> The addresses of receive queue start segment for ice, avf, i40e,
> >>>>> fm10k and ixgb were not checked before use. Add check to avoid
> >>>>> coverity issues.
> >>>>>
> >>>>> Coverity issue: 343452
> >>>>> Coverity issue: 343407
> >>>>> Fixes: c68a52b8 ("net/ice: support vector SSE in Rx") Coverity issue:
> >>>>> 343447
> >>>>> Fixes: 319c421f ("net/avf: enable SSE Rx Tx") Coverity issue:
> >>>>> 343422 Coverity issue: 343403
> >>>>> Fixes: ca74903b ("net/i40e: extract non-x86 specific code from
> >>>>> vector
> >>>>> driver") Coverity issue: 343416
> >>>>> Fixes: fe65e1e1 ("fm10k: add vector scatter Rx") Coverity issue:
> >>>>> 13245
> >>>>> Fixes: 8a44c15a ("net/ixgbe: extract non-x86 specific code from
> >>>>> vector
> >>>>> driver")
> >>>>> Cc: stable@dpdk.org
> >>>>>
> >>>>> Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
> >>>>
> >>>> In patchwork status of this patch is "Superseded" but I can't find
> >>>> the patch that supersedes this patch, is the current status correct?
> >>>
> >>> Sorry, the status of the patch should be "Rejected", I have updated
> >>> the
> >> status.
> >>>
> >>
> >> Thanks for updating, why it is rejected? (self-rejected ?)
> >
> > Yes, since this issues are for different devices, I was suggested better to split
> the patch base on the device or issue ID.
> >
>
> So there will be a new version, if so can you please update the patch status as
> "Change requested"?
>
> And I think it is better to make these suggestions publicly, at least put the a quick
> summary about the decision, so that other interested parties can be aware of it
> and/or comment on it.
OK, I will update the status and follow your suggestion in the future. Thanks.
@@ -602,6 +602,9 @@ fm10k_reassemble_packets(struct fm10k_rx_queue *rxq,
struct rte_mbuf *end = rxq->pkt_last_seg;
unsigned pkt_idx, buf_idx;
+ if (!start)
+ return 0;
+
for (buf_idx = 0, pkt_idx = 0; buf_idx < nb_bufs; buf_idx++) {
if (end != NULL) {
/* processing a split packet */
@@ -20,6 +20,9 @@ reassemble_packets(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_bufs,
struct rte_mbuf *end = rxq->pkt_last_seg;
unsigned pkt_idx, buf_idx;
+ if (!start)
+ return 0;
+
for (buf_idx = 0, pkt_idx = 0; buf_idx < nb_bufs; buf_idx++) {
if (end != NULL) {
/* processing a split packet */
@@ -20,6 +20,9 @@ reassemble_packets(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_bufs,
struct rte_mbuf *end = rxq->pkt_last_seg;
unsigned int pkt_idx, buf_idx;
+ if (!start)
+ return 0;
+
for (buf_idx = 0, pkt_idx = 0; buf_idx < nb_bufs; buf_idx++) {
if (end) {
/* processing a split packet */
@@ -16,6 +16,9 @@ ice_rx_reassemble_packets(struct ice_rx_queue *rxq, struct rte_mbuf **rx_bufs,
struct rte_mbuf *end = rxq->pkt_last_seg;
unsigned int pkt_idx, buf_idx;
+ if (!start)
+ return 0;
+
for (buf_idx = 0, pkt_idx = 0; buf_idx < nb_bufs; buf_idx++) {
if (end) {
/* processing a split packet */
@@ -19,6 +19,9 @@ reassemble_packets(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_bufs,
struct rte_mbuf *end = rxq->pkt_last_seg;
unsigned int pkt_idx, buf_idx;
+ if (!start)
+ return 0;
+
for (buf_idx = 0, pkt_idx = 0; buf_idx < nb_bufs; buf_idx++) {
if (end != NULL) {
/* processing a split packet */