netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] tipc: remove the unnecessary msg->req check from tipc_nl_compat_bearer_set
@ 2019-06-24  8:02 Xin Long
  2019-06-24 14:35 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Xin Long @ 2019-06-24  8:02 UTC (permalink / raw)
  To: network dev; +Cc: davem, Jon Maloy, Ying Xue, tipc-discussion

tipc_nl_compat_bearer_set() is only called by tipc_nl_compat_link_set()
which already does the check for msg->req check, so remove it from
tipc_nl_compat_bearer_set(), and do the same in tipc_nl_compat_media_set().

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/tipc/netlink_compat.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index cf15506..d86030e 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -691,7 +691,6 @@ static int tipc_nl_compat_media_set(struct sk_buff *skb,
 	struct nlattr *prop;
 	struct nlattr *media;
 	struct tipc_link_config *lc;
-	int len;
 
 	lc = (struct tipc_link_config *)TLV_DATA(msg->req);
 
@@ -699,10 +698,6 @@ static int tipc_nl_compat_media_set(struct sk_buff *skb,
 	if (!media)
 		return -EMSGSIZE;
 
-	len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_MEDIA_NAME);
-	if (!string_is_valid(lc->name, len))
-		return -EINVAL;
-
 	if (nla_put_string(skb, TIPC_NLA_MEDIA_NAME, lc->name))
 		return -EMSGSIZE;
 
@@ -723,7 +718,6 @@ static int tipc_nl_compat_bearer_set(struct sk_buff *skb,
 	struct nlattr *prop;
 	struct nlattr *bearer;
 	struct tipc_link_config *lc;
-	int len;
 
 	lc = (struct tipc_link_config *)TLV_DATA(msg->req);
 
@@ -731,10 +725,6 @@ static int tipc_nl_compat_bearer_set(struct sk_buff *skb,
 	if (!bearer)
 		return -EMSGSIZE;
 
-	len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_MEDIA_NAME);
-	if (!string_is_valid(lc->name, len))
-		return -EINVAL;
-
 	if (nla_put_string(skb, TIPC_NLA_BEARER_NAME, lc->name))
 		return -EMSGSIZE;
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] tipc: remove the unnecessary msg->req check from tipc_nl_compat_bearer_set
  2019-06-24  8:02 [PATCH net] tipc: remove the unnecessary msg->req check from tipc_nl_compat_bearer_set Xin Long
@ 2019-06-24 14:35 ` David Miller
  2019-06-24 15:54   ` Xin Long
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2019-06-24 14:35 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, jon.maloy, ying.xue, tipc-discussion

From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 24 Jun 2019 16:02:42 +0800

> tipc_nl_compat_bearer_set() is only called by tipc_nl_compat_link_set()
> which already does the check for msg->req check, so remove it from
> tipc_nl_compat_bearer_set(), and do the same in tipc_nl_compat_media_set().
> 
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Is this really appropriate as a fix for 'net'?  Seems more like net-next material
to me.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] tipc: remove the unnecessary msg->req check from tipc_nl_compat_bearer_set
  2019-06-24 14:35 ` David Miller
@ 2019-06-24 15:54   ` Xin Long
  2019-06-24 15:56     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Xin Long @ 2019-06-24 15:54 UTC (permalink / raw)
  To: David Miller; +Cc: network dev, Jon Maloy, Ying Xue, tipc-discussion

On Mon, Jun 24, 2019 at 10:35 PM David Miller <davem@davemloft.net> wrote:
>
> From: Xin Long <lucien.xin@gmail.com>
> Date: Mon, 24 Jun 2019 16:02:42 +0800
>
> > tipc_nl_compat_bearer_set() is only called by tipc_nl_compat_link_set()
> > which already does the check for msg->req check, so remove it from
> > tipc_nl_compat_bearer_set(), and do the same in tipc_nl_compat_media_set().
> >
> > Signed-off-by: Xin Long <lucien.xin@gmail.com>
>
> Is this really appropriate as a fix for 'net'?  Seems more like net-next material
> to me.
kind of code fix, sure, you can apply it to net-next, no conflict.
do you need me to repost?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] tipc: remove the unnecessary msg->req check from tipc_nl_compat_bearer_set
  2019-06-24 15:54   ` Xin Long
@ 2019-06-24 15:56     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-06-24 15:56 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, jon.maloy, ying.xue, tipc-discussion

From: Xin Long <lucien.xin@gmail.com>
Date: Mon, 24 Jun 2019 23:54:02 +0800

> On Mon, Jun 24, 2019 at 10:35 PM David Miller <davem@davemloft.net> wrote:
>>
>> From: Xin Long <lucien.xin@gmail.com>
>> Date: Mon, 24 Jun 2019 16:02:42 +0800
>>
>> > tipc_nl_compat_bearer_set() is only called by tipc_nl_compat_link_set()
>> > which already does the check for msg->req check, so remove it from
>> > tipc_nl_compat_bearer_set(), and do the same in tipc_nl_compat_media_set().
>> >
>> > Signed-off-by: Xin Long <lucien.xin@gmail.com>
>>
>> Is this really appropriate as a fix for 'net'?  Seems more like net-next material
>> to me.
> kind of code fix, sure, you can apply it to net-next, no conflict.
> do you need me to repost?

No need to resend, applied to net-next, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-24 15:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-24  8:02 [PATCH net] tipc: remove the unnecessary msg->req check from tipc_nl_compat_bearer_set Xin Long
2019-06-24 14:35 ` David Miller
2019-06-24 15:54   ` Xin Long
2019-06-24 15:56     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).