Message ID | CAPgLHd_6+xnMKZBzH3KySpFv7hUzzNot7GBYSCAPLDRbC5HjsA@mail.gmail.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Wed, Mar 20, 2013 at 5:14 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote: > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> > > Fix to return a negative error code from the error handling > case instead of 0, as returned elsewhere in this function. > > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> This isn't right because at this point in the function the change has already been made, only the notification allocation failed. Therefore we don't want to return an error since the caller will assume that nothing has changed; instead an error is set on the Netlink socket. -- 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
From: Jesse Gross <jesse@nicira.com> Date: Wed, 20 Mar 2013 08:57:53 -0700 > On Wed, Mar 20, 2013 at 5:14 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote: >> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> >> >> Fix to return a negative error code from the error handling >> case instead of 0, as returned elsewhere in this function. >> >> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> > > This isn't right because at this point in the function the change has > already been made, only the notification allocation failed. Therefore > we don't want to return an error since the caller will assume that > nothing has changed; instead an error is set on the Netlink socket. Then the way to fix this is to allocate the netlink SKB first, before any config changes occur, then pass that SKB into ovs_vport_cmd_build_info. We can still get errors, for -EMSGSIZE situations, but I'd say that'd be an implementation bug that should be logged. If we aren't allocating large enough SKBs for the netlink reply, that's really an internal error. -- 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
On Wed, Mar 20, 2013 at 9:22 AM, David Miller <davem@davemloft.net> wrote: > From: Jesse Gross <jesse@nicira.com> > Date: Wed, 20 Mar 2013 08:57:53 -0700 > >> On Wed, Mar 20, 2013 at 5:14 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote: >>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> >>> >>> Fix to return a negative error code from the error handling >>> case instead of 0, as returned elsewhere in this function. >>> >>> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> >> >> This isn't right because at this point in the function the change has >> already been made, only the notification allocation failed. Therefore >> we don't want to return an error since the caller will assume that >> nothing has changed; instead an error is set on the Netlink socket. > > Then the way to fix this is to allocate the netlink SKB first, before > any config changes occur, then pass that SKB into ovs_vport_cmd_build_info. > > We can still get errors, for -EMSGSIZE situations, but I'd say that'd > be an implementation bug that should be logged. If we aren't allocating > large enough SKBs for the netlink reply, that's really an internal > error. That solves the problem here. I'll take care of it, thanks. -- 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 --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index d61cd99..1ee11c3 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c @@ -1736,6 +1736,7 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) reply = ovs_vport_cmd_build_info(vport, info->snd_portid, info->snd_seq, OVS_VPORT_CMD_NEW); + err = PTR_ERR(reply); if (IS_ERR(reply)) { netlink_set_err(sock_net(skb->sk)->genl_sock, 0, ovs_dp_vport_multicast_group.id, PTR_ERR(reply));