lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202308260733.G7tU8UHx-lkp@intel.com>
Date: Sat, 26 Aug 2023 07:44:14 +0800
From: kernel test robot <lkp@...el.com>
To: Lukasz Majewski <lukma@...x.de>, Tristram.Ha@...rochip.com,
	Eric Dumazet <edumazet@...gle.com>, davem@...emloft.net
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
	Andrew Lunn <andrew@...n.ch>,
	Florian Fainelli <f.fainelli@...il.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Paolo Abeni <pabeni@...hat.com>,
	Kristian Overskeid <koverskeid@...il.com>,
	Matthieu Baerts <matthieu.baerts@...sares.net>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	Lukasz Majewski <lukma@...x.de>
Subject: Re: [PATCH] net: hsr : Provide fix for HSRv1 supervisor frames
 decoding

Hi Lukasz,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]
[also build test ERROR on net/main linus/master v6.5-rc7 next-20230825]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lukasz-Majewski/net-hsr-Provide-fix-for-HSRv1-supervisor-frames-decoding/20230825-233423
base:   net-next/main
patch link:    https://lore.kernel.org/r/20230825153111.228768-1-lukma%40denx.de
patch subject: [PATCH] net: hsr : Provide fix for HSRv1 supervisor frames decoding
config: powerpc64-randconfig-r022-20230826 (https://download.01.org/0day-ci/archive/20230826/202308260733.G7tU8UHx-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20230826/202308260733.G7tU8UHx-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308260733.G7tU8UHx-lkp@intel.com/

All errors (new ones prefixed by >>):

>> net/hsr/hsr_framereg.c:289:8: error: expected ';' after expression
     289 |          * And leave the HSR tag.
         |               ^
         |               ;
>> net/hsr/hsr_framereg.c:289:5: error: use of undeclared identifier 'And'
     289 |          * And leave the HSR tag.
         |            ^
>> net/hsr/hsr_framereg.c:289:9: error: use of undeclared identifier 'leave'
     289 |          * And leave the HSR tag.
         |                ^
   3 errors generated.


vim +289 net/hsr/hsr_framereg.c

   249	
   250	/* Use the Supervision frame's info about an eventual macaddress_B for merging
   251	 * nodes that has previously had their macaddress_B registered as a separate
   252	 * node.
   253	 */
   254	void hsr_handle_sup_frame(struct hsr_frame_info *frame)
   255	{
   256		struct hsr_node *node_curr = frame->node_src;
   257		struct hsr_port *port_rcv = frame->port_rcv;
   258		struct hsr_priv *hsr = port_rcv->hsr;
   259		struct hsr_sup_payload *hsr_sp;
   260		struct hsr_sup_tlv *hsr_sup_tlv;
   261		struct hsr_node *node_real;
   262		struct sk_buff *skb = NULL;
   263		struct list_head *node_db;
   264		struct ethhdr *ethhdr;
   265		int i;
   266		unsigned int pull_size = 0;
   267		unsigned int total_pull_size = 0;
   268	
   269		/* Here either frame->skb_hsr or frame->skb_prp should be
   270		 * valid as supervision frame always will have protocol
   271		 * header info.
   272		 */
   273		if (frame->skb_hsr)
   274			skb = frame->skb_hsr;
   275		else if (frame->skb_prp)
   276			skb = frame->skb_prp;
   277		else if (frame->skb_std)
   278			skb = frame->skb_std;
   279		if (!skb)
   280			return;
   281	
   282		/* Leave the ethernet header. */
   283		pull_size = sizeof(struct ethhdr);
   284		skb_pull(skb, pull_size);
   285		total_pull_size += pull_size;
   286	
   287		ethhdr = (struct ethhdr *)skb_mac_header(skb);
   288	
 > 289		 * And leave the HSR tag.
   290		 *
   291		 * The HSRv1 supervisory frame encapsulates the v0 frame
   292		 * with EtherType of 0x88FB
   293		 */
   294		if (ethhdr->h_proto == htons(ETH_P_HSR)) {
   295			if (hsr->prot_version == HSR_V1)
   296				/* In the above step the DA, SA and EtherType
   297				 * (0x892F - HSRv1) bytes has been removed.
   298				 *
   299				 * As the HSRv1 has the HSR header added, one need
   300				 * to remove path_and_LSDU_size and sequence_nr fields.
   301				 *
   302				 */
   303				pull_size = 4;
   304			else
   305				pull_size = sizeof(struct hsr_tag);
   306	
   307			skb_pull(skb, pull_size);
   308			total_pull_size += pull_size;
   309		}
   310	
   311		/* And leave the HSR sup tag. */
   312		pull_size = sizeof(struct hsr_tag);
   313		skb_pull(skb, pull_size);
   314		total_pull_size += pull_size;
   315	
   316		/* get HSR sup payload */
   317		if (hsr->prot_version == HSR_V1) {
   318			/* In the HSRv1 supervisor frame, when
   319			 * one with EtherType = 0x88FB is extracted, the Node A
   320			 * MAC address is preceded with type and length elements of TLV
   321			 * data field.
   322			 *
   323			 * It needs to be removed to get the remote peer MAC address.
   324			 */
   325			pull_size = sizeof(struct hsr_sup_tlv);
   326			skb_pull(skb, pull_size);
   327			total_pull_size += pull_size;
   328		}
   329	
   330		hsr_sp = (struct hsr_sup_payload *)skb->data;
   331	
   332		/* Merge node_curr (registered on macaddress_B) into node_real */
   333		node_db = &port_rcv->hsr->node_db;
   334		node_real = find_node_by_addr_A(node_db, hsr_sp->macaddress_A);
   335		if (!node_real)
   336			/* No frame received from AddrA of this node yet */
   337			node_real = hsr_add_node(hsr, node_db, hsr_sp->macaddress_A,
   338						 HSR_SEQNR_START - 1, true,
   339						 port_rcv->type);
   340		if (!node_real)
   341			goto done; /* No mem */
   342		if (node_real == node_curr)
   343			/* Node has already been merged */
   344			goto done;
   345	
   346		/* Leave the first HSR sup payload. */
   347		pull_size = sizeof(struct hsr_sup_payload);
   348		skb_pull(skb, pull_size);
   349		total_pull_size += pull_size;
   350	
   351		/* Get second supervision tlv */
   352		hsr_sup_tlv = (struct hsr_sup_tlv *)skb->data;
   353		/* And check if it is a redbox mac TLV */
   354		if (hsr_sup_tlv->HSR_TLV_type == PRP_TLV_REDBOX_MAC) {
   355			/* We could stop here after pushing hsr_sup_payload,
   356			 * or proceed and allow macaddress_B and for redboxes.
   357			 */
   358			/* Sanity check length */
   359			if (hsr_sup_tlv->HSR_TLV_length != 6)
   360				goto done;
   361	
   362			/* Leave the second HSR sup tlv. */
   363			pull_size = sizeof(struct hsr_sup_tlv);
   364			skb_pull(skb, pull_size);
   365			total_pull_size += pull_size;
   366	
   367			/* Get redbox mac address. */
   368			hsr_sp = (struct hsr_sup_payload *)skb->data;
   369	
   370			/* Check if redbox mac and node mac are equal. */
   371			if (!ether_addr_equal(node_real->macaddress_A, hsr_sp->macaddress_A)) {
   372				/* This is a redbox supervision frame for a VDAN! */
   373				goto done;
   374			}
   375		}
   376	
   377		ether_addr_copy(node_real->macaddress_B, ethhdr->h_source);
   378		spin_lock_bh(&node_real->seq_out_lock);
   379		for (i = 0; i < HSR_PT_PORTS; i++) {
   380			if (!node_curr->time_in_stale[i] &&
   381			    time_after(node_curr->time_in[i], node_real->time_in[i])) {
   382				node_real->time_in[i] = node_curr->time_in[i];
   383				node_real->time_in_stale[i] =
   384							node_curr->time_in_stale[i];
   385			}
   386			if (seq_nr_after(node_curr->seq_out[i], node_real->seq_out[i]))
   387				node_real->seq_out[i] = node_curr->seq_out[i];
   388		}
   389		spin_unlock_bh(&node_real->seq_out_lock);
   390		node_real->addr_B_port = port_rcv->type;
   391	
   392		spin_lock_bh(&hsr->list_lock);
   393		if (!node_curr->removed) {
   394			list_del_rcu(&node_curr->mac_list);
   395			node_curr->removed = true;
   396			kfree_rcu(node_curr, rcu_head);
   397		}
   398		spin_unlock_bh(&hsr->list_lock);
   399	
   400	done:
   401		/* Push back here */
   402		skb_push(skb, total_pull_size);
   403	}
   404	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ