Commit 67edf21e authored by David Ahern's avatar David Ahern Committed by David S. Miller

scsi: libcxgbi: fib6_ino reference in rt6_info is rcu protected

The fib6_info reference in rt6_info is rcu protected. Add a helper
to extract prefsrc from and update cxgbi_check_route6 to use it.

Fixes: 0153167a ("net/ipv6: Remove rt6i_prefsrc")
Reported-by: default avatarkbuild test robot <lkp@intel.com>
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1fb0d4e8
...@@ -784,7 +784,8 @@ cxgbi_check_route6(struct sockaddr *dst_addr, int ifindex) ...@@ -784,7 +784,8 @@ cxgbi_check_route6(struct sockaddr *dst_addr, int ifindex)
csk->mtu = mtu; csk->mtu = mtu;
csk->dst = dst; csk->dst = dst;
if (!rt->from || ipv6_addr_any(&rt->from->fib6_prefsrc.addr)) { rt6_get_prefsrc(rt, &pref_saddr);
if (ipv6_addr_any(&pref_saddr)) {
struct inet6_dev *idev = ip6_dst_idev((struct dst_entry *)rt); struct inet6_dev *idev = ip6_dst_idev((struct dst_entry *)rt);
err = ipv6_dev_get_saddr(&init_net, idev ? idev->dev : NULL, err = ipv6_dev_get_saddr(&init_net, idev ? idev->dev : NULL,
...@@ -794,8 +795,6 @@ cxgbi_check_route6(struct sockaddr *dst_addr, int ifindex) ...@@ -794,8 +795,6 @@ cxgbi_check_route6(struct sockaddr *dst_addr, int ifindex)
&daddr6->sin6_addr); &daddr6->sin6_addr);
goto rel_rt; goto rel_rt;
} }
} else {
pref_saddr = rt->from->fib6_prefsrc.addr;
} }
csk->csk_family = AF_INET6; csk->csk_family = AF_INET6;
......
...@@ -412,6 +412,25 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt, ...@@ -412,6 +412,25 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt,
struct nl_info *info, struct netlink_ext_ack *extack); struct nl_info *info, struct netlink_ext_ack *extack);
int fib6_del(struct fib6_info *rt, struct nl_info *info); int fib6_del(struct fib6_info *rt, struct nl_info *info);
static inline
void rt6_get_prefsrc(const struct rt6_info *rt, struct in6_addr *addr)
{
const struct fib6_info *from;
rcu_read_lock();
from = rcu_dereference(rt->from);
if (from) {
*addr = from->fib6_prefsrc.addr;
} else {
struct in6_addr in6_zero = {};
*addr = in6_zero;
}
rcu_read_unlock();
}
static inline struct net_device *fib6_info_nh_dev(const struct fib6_info *f6i) static inline struct net_device *fib6_info_nh_dev(const struct fib6_info *f6i)
{ {
return f6i->fib6_nh.nh_dev; return f6i->fib6_nh.nh_dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment