RE: [PATCH v2 30/45] IB/nes: Fix a race condition in nes_inetaddr_event()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From: Bart Van Assche [mailto:bart.vanassche@xxxxxxx]
>Sent: Wednesday, October 11, 2017 12:49 PM
>To: Doug Ledford <dledford@xxxxxxxxxx>
>Cc: linux-rdma@xxxxxxxxxxxxxxx; Bart Van Assche <bart.vanassche@xxxxxxx>;
>Latif, Faisal <faisal.latif@xxxxxxxxx>
>Subject: [PATCH v2 30/45] IB/nes: Fix a race condition in nes_inetaddr_event()
>
>This patch has been compile-tested only.
>
>Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxx>
>Cc: Faisal Latif <faisal.latif@xxxxxxxxx>
>---
> drivers/infiniband/hw/nes/nes.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
>index ff58dfa071b8..42b68aa999fc 100644
>--- a/drivers/infiniband/hw/nes/nes.c
>+++ b/drivers/infiniband/hw/nes/nes.c
>@@ -178,11 +178,16 @@ static int nes_inetaddr_event(struct notifier_block
>*notifier,
> 					/* fall through */
> 				case NETDEV_CHANGEADDR:
> 					/* Add the address to the IP table */
>-					if (upper_dev)
>-						nesvnic->local_ipaddr =
>-							((struct in_device
>*)upper_dev->ip_ptr)->ifa_list->ifa_address;
>-					else
>+					if (upper_dev) {
>+						struct in_device *in;
>+
>+						rcu_read_lock();
>+						in =
>__in_dev_get_rcu(upper_dev);
>+						nesvnic->local_ipaddr = in-
>>ifa_list->ifa_address;
>+						rcu_read_unlock();
>+					} else {
> 						nesvnic->local_ipaddr = ifa-
>>ifa_address;
>+					}
>
> 					nes_write_indexed(nesdev,
>
>	NES_IDX_DST_IP_ADDR+(0x10*PCI_FUNC(nesdev->pcidev->devfn)),
>--
>2.14.2
Acked-by: Faisal Latif <fasial.latif@xxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux