diff mbox

[net-next] lec: Use rtnl lock/unlock when updating MTU

Message ID 201408141319.s7EDJl9l031767@thirdoffive.cmf.nrl.navy.mil
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

chas williams - CONTRACTOR Aug. 14, 2014, 1:19 p.m. UTC
The LECS response contains the MTU that should be used.  Correctly
synchronize with other layers when updating.

Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
---
 net/atm/lec.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Miller Aug. 14, 2014, 9:37 p.m. UTC | #1
From: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Date: Thu, 14 Aug 2014 09:19:47 -0400

> The LECS response contains the MTU that should be used.  Correctly
> synchronize with other layers when updating.
> 
> Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>

I don't think you can sleep from this function, which rtnl_lock() may
require.  Look elsewhere in this routine, it's doing GFP_ATOMIC
allocations even.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
chas williams - CONTRACTOR Aug. 15, 2014, 12:56 a.m. UTC | #2
In message <20140814.143706.1833450188258591738.davem@redhat.com>,David Miller writes:
>From: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
>Date: Thu, 14 Aug 2014 09:19:47 -0400
>
>> The LECS response contains the MTU that should be used.  Correctly
>> synchronize with other layers when updating.
>> 
>> Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
>
>I don't think you can sleep from this function, which rtnl_lock() may
>require.  Look elsewhere in this routine, it's doing GFP_ATOMIC
>allocations even.

Its been a while but...

This is the send routine for a virtual atm device that is the control
interface bewteen the user space client and the kernel.  The user space
client creates an atm socket and uses an ioctl to connect that atm socket
to the this virtual device.  So the call path is something like:

sendmsg() -> vcc_sendmsg() -> virtual atm device.send()

Generally speaking, you can't sleep in the send routine of an atm device
since there are other potential users besides sockets.

The GFP_ATOMIC usage is probably a lack of understanding.  The other
IRQ level locks are necessary for coordination.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Aug. 21, 2014, 11:31 p.m. UTC | #3
From: "Chas Williams (CONTRACTOR)" <chas@cmf.nrl.navy.mil>
Date: Thu, 14 Aug 2014 20:56:27 -0400

> In message <20140814.143706.1833450188258591738.davem@redhat.com>,David Miller writes:
>>From: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
>>Date: Thu, 14 Aug 2014 09:19:47 -0400
>>
>>> The LECS response contains the MTU that should be used.  Correctly
>>> synchronize with other layers when updating.
>>> 
>>> Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
>>
>>I don't think you can sleep from this function, which rtnl_lock() may
>>require.  Look elsewhere in this routine, it's doing GFP_ATOMIC
>>allocations even.
> 
> Its been a while but...
> 
> This is the send routine for a virtual atm device that is the control
> interface bewteen the user space client and the kernel.  The user space
> client creates an atm socket and uses an ioctl to connect that atm socket
> to the this virtual device.  So the call path is something like:
> 
> sendmsg() -> vcc_sendmsg() -> virtual atm device.send()
> 
> Generally speaking, you can't sleep in the send routine of an atm device
> since there are other potential users besides sockets.
> 
> The GFP_ATOMIC usage is probably a lack of understanding.  The other
> IRQ level locks are necessary for coordination.

Ok, that makes sense, thanks for explaining the context in which this is
invoked.

Patch applied, thanks again.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 4c5b8ba..6e13369 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -410,9 +410,11 @@  static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
 		priv->lane2_ops = NULL;
 		if (priv->lane_version > 1)
 			priv->lane2_ops = &lane2_ops;
+		rtnl_lock();
 		if (dev_set_mtu(dev, mesg->content.config.mtu))
 			pr_info("%s: change_mtu to %d failed\n",
 				dev->name, mesg->content.config.mtu);
+		rtnl_unlock();
 		priv->is_proxy = mesg->content.config.is_proxy;
 		break;
 	case l_flush_tran_id: