Skip to content

Commit 237a6a2

Browse files
lxindavem330
authored andcommitted
sctp: remove the unessessary hold for idev in sctp_v6_err
Same as in tcp_v6_err() and __udp6_lib_err(), there's no need to hold idev in sctp_v6_err(), so just call __in6_dev_get() instead. Signed-off-by: Xin Long <[email protected]> Acked-by: Marcelo Ricardo Leitner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7307e4f commit 237a6a2

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

net/sctp/ipv6.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ static struct notifier_block sctp_inet6addr_notifier = {
126126
static int sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
127127
u8 type, u8 code, int offset, __be32 info)
128128
{
129-
struct inet6_dev *idev;
130129
struct sock *sk;
131130
struct sctp_association *asoc;
132131
struct sctp_transport *transport;
@@ -135,8 +134,6 @@ static int sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
135134
int err, ret = 0;
136135
struct net *net = dev_net(skb->dev);
137136

138-
idev = in6_dev_get(skb->dev);
139-
140137
/* Fix up skb to look at the embedded net header. */
141138
saveip = skb->network_header;
142139
savesctp = skb->transport_header;
@@ -147,9 +144,8 @@ static int sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
147144
skb->network_header = saveip;
148145
skb->transport_header = savesctp;
149146
if (!sk) {
150-
__ICMP6_INC_STATS(net, idev, ICMP6_MIB_INERRORS);
151-
ret = -ENOENT;
152-
goto out;
147+
__ICMP6_INC_STATS(net, __in6_dev_get(skb->dev), ICMP6_MIB_INERRORS);
148+
return -ENOENT;
153149
}
154150

155151
/* Warning: The sock lock is held. Remember to call
@@ -185,10 +181,6 @@ static int sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
185181

186182
out_unlock:
187183
sctp_err_finish(sk, transport);
188-
out:
189-
if (likely(idev != NULL))
190-
in6_dev_put(idev);
191-
192184
return ret;
193185
}
194186

0 commit comments

Comments
 (0)