netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.10 5/9] net: qede: sanitize 'rc' in qede_add_tc_flower_fltr()
       [not found] <20240507231406.395123-1-sashal@kernel.org>
@ 2024-05-07 23:14 ` Sasha Levin
  2024-05-13  8:18   ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2024-05-07 23:14 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Asbjørn Sloth Tønnesen, Simon Horman, David S . Miller,
	Sasha Levin, manishc, edumazet, kuba, pabeni, netdev

From: Asbjørn Sloth Tønnesen <ast@fiberby.net>

[ Upstream commit e25714466abd9d96901b15efddf82c60a38abd86 ]

Explicitly set 'rc' (return code), before jumping to the
unlock and return path.

By not having any code depend on that 'rc' remains at
it's initial value of -EINVAL, then we can re-use 'rc' for
the return code of function calls in subsequent patches.

Only compile tested.

Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/qlogic/qede/qede_filter.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c
index a2e4dfb5cb44e..ba28381c26bbf 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_filter.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c
@@ -1877,8 +1877,8 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
 			    struct flow_cls_offload *f)
 {
 	struct qede_arfs_fltr_node *n;
-	int min_hlen, rc = -EINVAL;
 	struct qede_arfs_tuple t;
+	int min_hlen, rc;
 
 	__qede_lock(edev);
 
@@ -1888,8 +1888,10 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
 	}
 
 	/* parse flower attribute and prepare filter */
-	if (qede_parse_flow_attr(edev, proto, f->rule, &t))
+	if (qede_parse_flow_attr(edev, proto, f->rule, &t)) {
+		rc = -EINVAL;
 		goto unlock;
+	}
 
 	/* Validate profile mode and number of filters */
 	if ((edev->arfs->filter_count && edev->arfs->mode != t.mode) ||
@@ -1897,12 +1899,15 @@ int qede_add_tc_flower_fltr(struct qede_dev *edev, __be16 proto,
 		DP_NOTICE(edev,
 			  "Filter configuration invalidated, filter mode=0x%x, configured mode=0x%x, filter count=0x%x\n",
 			  t.mode, edev->arfs->mode, edev->arfs->filter_count);
+		rc = -EINVAL;
 		goto unlock;
 	}
 
 	/* parse tc actions and get the vf_id */
-	if (qede_parse_actions(edev, &f->rule->action, f->common.extack))
+	if (qede_parse_actions(edev, &f->rule->action, f->common.extack)) {
+		rc = -EINVAL;
 		goto unlock;
+	}
 
 	if (qede_flow_find_fltr(edev, &t)) {
 		rc = -EEXIST;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH AUTOSEL 5.10 5/9] net: qede: sanitize 'rc' in qede_add_tc_flower_fltr()
  2024-05-07 23:14 ` [PATCH AUTOSEL 5.10 5/9] net: qede: sanitize 'rc' in qede_add_tc_flower_fltr() Sasha Levin
@ 2024-05-13  8:18   ` Pavel Machek
  2024-05-13  9:46     ` Asbjørn Sloth Tønnesen
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2024-05-13  8:18 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Asbjørn Sloth Tønnesen,
	Simon Horman, David S . Miller, manishc, edumazet, kuba, pabeni,
	netdev

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

Hi!

> Explicitly set 'rc' (return code), before jumping to the
> unlock and return path.
> 
> By not having any code depend on that 'rc' remains at
> it's initial value of -EINVAL, then we can re-use 'rc' for
> the return code of function calls in subsequent patches.
> 
> Only compile tested.

Only compile tested, and is a preparation for something we won't do in
stable. Does not fix a bug, please drop.

								Pavel
-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH AUTOSEL 5.10 5/9] net: qede: sanitize 'rc' in qede_add_tc_flower_fltr()
  2024-05-13  8:18   ` Pavel Machek
@ 2024-05-13  9:46     ` Asbjørn Sloth Tønnesen
  2024-05-22 12:57       ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Asbjørn Sloth Tønnesen @ 2024-05-13  9:46 UTC (permalink / raw)
  To: Pavel Machek, Sasha Levin
  Cc: linux-kernel, stable, Simon Horman, David S . Miller, manishc,
	edumazet, kuba, pabeni, netdev

Hi Pavel and Sasha,

On 5/13/24 8:18 AM, Pavel Machek wrote:
>> Explicitly set 'rc' (return code), before jumping to the
>> unlock and return path.
>>
>> By not having any code depend on that 'rc' remains at
>> it's initial value of -EINVAL, then we can re-use 'rc' for
>> the return code of function calls in subsequent patches.
>>
>> Only compile tested.
> 
> Only compile tested, and is a preparation for something we won't do in
> stable. Does not fix a bug, please drop.

Please see the original thread about this series[1], this patch is a requirement for
two of the next patches, which does fix a few bugs with overruled error codes returned
to user space.

I was originally going to ignore these AUTOSEL mails, since the whole series was already
added to the queued more than 24 hours earlier[2]. In the queue Sasha has also added "Stable-dep-of:'.

So the weird thing is that AUTOSEL selected this patch, given that it was already in the queue.

[1] https://lore.kernel.org/netdev/20240426091227.78060-1-ast@fiberby.net/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/log/?h=queue/5.10

-- 
Best regards
Asbjørn Sloth Tønnesen
Network Engineer
Fiberby - AS42541

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH AUTOSEL 5.10 5/9] net: qede: sanitize 'rc' in qede_add_tc_flower_fltr()
  2024-05-13  9:46     ` Asbjørn Sloth Tønnesen
@ 2024-05-22 12:57       ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2024-05-22 12:57 UTC (permalink / raw)
  To: Asbjørn Sloth Tønnesen
  Cc: Pavel Machek, linux-kernel, stable, Simon Horman,
	David S . Miller, manishc, edumazet, kuba, pabeni, netdev

On Mon, May 13, 2024 at 09:46:02AM +0000, Asbjørn Sloth Tønnesen wrote:
>Hi Pavel and Sasha,
>
>On 5/13/24 8:18 AM, Pavel Machek wrote:
>>>Explicitly set 'rc' (return code), before jumping to the
>>>unlock and return path.
>>>
>>>By not having any code depend on that 'rc' remains at
>>>it's initial value of -EINVAL, then we can re-use 'rc' for
>>>the return code of function calls in subsequent patches.
>>>
>>>Only compile tested.
>>
>>Only compile tested, and is a preparation for something we won't do in
>>stable. Does not fix a bug, please drop.
>
>Please see the original thread about this series[1], this patch is a requirement for
>two of the next patches, which does fix a few bugs with overruled error codes returned
>to user space.
>
>I was originally going to ignore these AUTOSEL mails, since the whole series was already
>added to the queued more than 24 hours earlier[2]. In the queue Sasha has also added "Stable-dep-of:'.
>
>So the weird thing is that AUTOSEL selected this patch, given that it was already in the queue.

Two different processes on my end, sorry for the noise!

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-22 13:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20240507231406.395123-1-sashal@kernel.org>
2024-05-07 23:14 ` [PATCH AUTOSEL 5.10 5/9] net: qede: sanitize 'rc' in qede_add_tc_flower_fltr() Sasha Levin
2024-05-13  8:18   ` Pavel Machek
2024-05-13  9:46     ` Asbjørn Sloth Tønnesen
2024-05-22 12:57       ` Sasha Levin

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).