* [PATCH net-next] tipc: Cleanup tipc_nl_bearer_add() error paths
@ 2024-02-13 13:40 Shigeru Yoshida
2024-02-15 1:06 ` Tung Quang Nguyen
2024-02-15 12:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Shigeru Yoshida @ 2024-02-13 13:40 UTC (permalink / raw)
To: jmaloy, ying.xue, davem, edumazet, kuba, pabeni
Cc: netdev, tipc-discussion, linux-kernel, Shigeru Yoshida
Consolidate the error paths of tipc_nl_bearer_add() under the common label
if the function holds rtnl_lock.
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
---
net/tipc/bearer.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 878415c43527..5a526ebafeb4 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -1079,30 +1079,27 @@ int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info)
rtnl_lock();
b = tipc_bearer_find(net, name);
if (!b) {
- rtnl_unlock();
NL_SET_ERR_MSG(info->extack, "Bearer not found");
- return -EINVAL;
+ err = -EINVAL;
+ goto out;
}
#ifdef CONFIG_TIPC_MEDIA_UDP
if (attrs[TIPC_NLA_BEARER_UDP_OPTS]) {
if (b->media->type_id != TIPC_MEDIA_TYPE_UDP) {
- rtnl_unlock();
NL_SET_ERR_MSG(info->extack, "UDP option is unsupported");
- return -EINVAL;
+ err = -EINVAL;
+ goto out;
}
err = tipc_udp_nl_bearer_add(b,
attrs[TIPC_NLA_BEARER_UDP_OPTS]);
- if (err) {
- rtnl_unlock();
- return err;
- }
}
#endif
+out:
rtnl_unlock();
- return 0;
+ return err;
}
int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH net-next] tipc: Cleanup tipc_nl_bearer_add() error paths
2024-02-13 13:40 [PATCH net-next] tipc: Cleanup tipc_nl_bearer_add() error paths Shigeru Yoshida
@ 2024-02-15 1:06 ` Tung Quang Nguyen
2024-02-15 12:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Tung Quang Nguyen @ 2024-02-15 1:06 UTC (permalink / raw)
To: Shigeru Yoshida, jmaloy, ying.xue, davem, edumazet, kuba, pabeni
Cc: netdev, tipc-discussion, linux-kernel
> net/tipc/bearer.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
>diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 878415c43527..5a526ebafeb4 100644
>--- a/net/tipc/bearer.c
>+++ b/net/tipc/bearer.c
>@@ -1079,30 +1079,27 @@ int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info)
> rtnl_lock();
> b = tipc_bearer_find(net, name);
> if (!b) {
>- rtnl_unlock();
> NL_SET_ERR_MSG(info->extack, "Bearer not found");
>- return -EINVAL;
>+ err = -EINVAL;
>+ goto out;
> }
>
> #ifdef CONFIG_TIPC_MEDIA_UDP
> if (attrs[TIPC_NLA_BEARER_UDP_OPTS]) {
> if (b->media->type_id != TIPC_MEDIA_TYPE_UDP) {
>- rtnl_unlock();
> NL_SET_ERR_MSG(info->extack, "UDP option is unsupported");
>- return -EINVAL;
>+ err = -EINVAL;
>+ goto out;
> }
>
> err = tipc_udp_nl_bearer_add(b,
> attrs[TIPC_NLA_BEARER_UDP_OPTS]);
>- if (err) {
>- rtnl_unlock();
>- return err;
>- }
> }
> #endif
>+out:
> rtnl_unlock();
>
>- return 0;
>+ return err;
> }
>
> int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)
>--
>2.43.0
>
Reviewed-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tipc: Cleanup tipc_nl_bearer_add() error paths
2024-02-13 13:40 [PATCH net-next] tipc: Cleanup tipc_nl_bearer_add() error paths Shigeru Yoshida
2024-02-15 1:06 ` Tung Quang Nguyen
@ 2024-02-15 12:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-15 12:30 UTC (permalink / raw)
To: Shigeru Yoshida
Cc: jmaloy, ying.xue, davem, edumazet, kuba, pabeni, netdev,
tipc-discussion, linux-kernel
Hello:
This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 13 Feb 2024 22:40:58 +0900 you wrote:
> Consolidate the error paths of tipc_nl_bearer_add() under the common label
> if the function holds rtnl_lock.
>
> Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
> ---
> net/tipc/bearer.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
Here is the summary with links:
- [net-next] tipc: Cleanup tipc_nl_bearer_add() error paths
https://git.kernel.org/netdev/net-next/c/984328c7657d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-15 12:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 13:40 [PATCH net-next] tipc: Cleanup tipc_nl_bearer_add() error paths Shigeru Yoshida
2024-02-15 1:06 ` Tung Quang Nguyen
2024-02-15 12:30 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.