| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/10/12 05:19 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"KMSANReasoning": "",
"NeedsKMSAN": false,
"Reasoning": "The patch modifies the ibmveth driver (drivers/net/ethernet/ibm/ibmveth.c and ibmveth.h), which depends on CONFIG_PPC_PSERIES (PowerPC architecture). Because the target architecture is amd64, the modified code is structurally unreachable and cannot be compiled or executed on this target architecture.",
"WorthFuzzing": false
} |
| 1/1 | 2026/10/12 05:19 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit f9d2a14fecb02dee28e75a624ccc7d46804ee068\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Mon Oct 12 05:19:52 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c\nindex abebdb1fc2628..1c2ac88c28ca3 100644\n--- a/drivers/net/ethernet/ibm/ibmveth.c\n+++ b/drivers/net/ethernet/ibm/ibmveth.c\n@@ -135,6 +135,13 @@ static inline int ibmveth_rxq_frame_length(struct ibmveth_adapter *adapter)\n \treturn be32_to_cpu(adapter-\u003erx_queue.queue_addr[adapter-\u003erx_queue.index].length);\n }\n \n+static u64 ibmveth_rxq_correlator(struct ibmveth_adapter *adapter)\n+{\n+\tunsigned int idx = adapter-\u003erx_queue.index;\n+\n+\treturn READ_ONCE(adapter-\u003erx_queue.queue_addr[idx].correlator);\n+}\n+\n static inline int ibmveth_rxq_csum_good(struct ibmveth_adapter *adapter)\n {\n \treturn ibmveth_rxq_flags(adapter) \u0026 IBMVETH_RXQ_CSUM_GOOD;\n@@ -443,6 +450,37 @@ static void ibmveth_free_buffer_pool(struct ibmveth_adapter *adapter,\n \t}\n }\n \n+/* The correlator comes back from PHYP; a bad one schedules a reset. */\n+static bool ibmveth_rxq_correlator_valid(struct ibmveth_adapter *adapter,\n+\t\t\t\t\t u64 correlator)\n+{\n+\tunsigned int index = correlator \u0026 0xffffffffUL;\n+\tunsigned int pool = correlator \u003e\u003e 32;\n+\n+\t/* An inactive pool keeps its size but has no skbuff array. */\n+\tif (pool \u003c IBMVETH_NUM_BUFF_POOLS \u0026\u0026\n+\t index \u003c adapter-\u003erx_buff_pool[pool].size \u0026\u0026\n+\t adapter-\u003erx_buff_pool[pool].skbuff)\n+\t\treturn true;\n+\n+\tif (net_ratelimit())\n+\t\tnetdev_err(adapter-\u003enetdev,\n+\t\t\t \"invalid RX correlator %llx, resetting\\n\",\n+\t\t\t correlator);\n+\tschedule_work(\u0026adapter-\u003ework);\n+\treturn false;\n+}\n+\n+static void ibmveth_rxq_no_skb(struct ibmveth_adapter *adapter,\n+\t\t\t u64 correlator)\n+{\n+\tif (net_ratelimit())\n+\t\tnetdev_err(adapter-\u003enetdev,\n+\t\t\t \"no buffer for RX correlator %llx, resetting\\n\",\n+\t\t\t correlator);\n+\tschedule_work(\u0026adapter-\u003ework);\n+}\n+\n /**\n * ibmveth_remove_buffer_from_pool - remove a buffer from a pool\n * @adapter: adapter instance\n@@ -451,7 +489,8 @@ static void ibmveth_free_buffer_pool(struct ibmveth_adapter *adapter,\n *\n * Return:\n * * %0 - success\n- * * %-EINVAL - correlator maps to pool or index out of range\n+ * * %-EINVAL - correlator maps to pool or index out of range, or to an\n+ * inactive pool\n * * %-EFAULT - pool and index map to null skb\n */\n static int ibmveth_remove_buffer_from_pool(struct ibmveth_adapter *adapter,\n@@ -462,15 +501,12 @@ static int ibmveth_remove_buffer_from_pool(struct ibmveth_adapter *adapter,\n \tunsigned int free_index;\n \tstruct sk_buff *skb;\n \n-\tif (WARN_ON(pool \u003e= IBMVETH_NUM_BUFF_POOLS) ||\n-\t WARN_ON(index \u003e= adapter-\u003erx_buff_pool[pool].size)) {\n-\t\tschedule_work(\u0026adapter-\u003ework);\n+\tif (!ibmveth_rxq_correlator_valid(adapter, correlator))\n \t\treturn -EINVAL;\n-\t}\n \n \tskb = adapter-\u003erx_buff_pool[pool].skbuff[index];\n-\tif (WARN_ON(!skb)) {\n-\t\tschedule_work(\u0026adapter-\u003ework);\n+\tif (!skb) {\n+\t\tibmveth_rxq_no_skb(adapter, correlator);\n \t\treturn -EFAULT;\n \t}\n \n@@ -504,51 +540,56 @@ static int ibmveth_remove_buffer_from_pool(struct ibmveth_adapter *adapter,\n \treturn 0;\n }\n \n-/* get the current buffer on the rx queue */\n-static inline struct sk_buff *ibmveth_rxq_get_buffer(struct ibmveth_adapter *adapter)\n+/* get the buffer for @correlator, read once from the current rx queue entry */\n+static struct sk_buff *ibmveth_rxq_get_buffer(struct ibmveth_adapter *adapter,\n+\t\t\t\t\t u64 correlator)\n {\n-\tu64 correlator = adapter-\u003erx_queue.queue_addr[adapter-\u003erx_queue.index].correlator;\n \tunsigned int pool = correlator \u003e\u003e 32;\n \tunsigned int index = correlator \u0026 0xffffffffUL;\n+\tstruct sk_buff *skb;\n \n-\tif (WARN_ON(pool \u003e= IBMVETH_NUM_BUFF_POOLS) ||\n-\t WARN_ON(index \u003e= adapter-\u003erx_buff_pool[pool].size)) {\n-\t\tschedule_work(\u0026adapter-\u003ework);\n+\tif (!ibmveth_rxq_correlator_valid(adapter, correlator))\n \t\treturn NULL;\n-\t}\n \n-\treturn adapter-\u003erx_buff_pool[pool].skbuff[index];\n+\tskb = adapter-\u003erx_buff_pool[pool].skbuff[index];\n+\tif (!skb)\n+\t\tibmveth_rxq_no_skb(adapter, correlator);\n+\treturn skb;\n+}\n+\n+static void ibmveth_rxq_advance(struct ibmveth_adapter *adapter)\n+{\n+\tif (++adapter-\u003erx_queue.index == adapter-\u003erx_queue.num_slots) {\n+\t\tadapter-\u003erx_queue.index = 0;\n+\t\tadapter-\u003erx_queue.toggle = !adapter-\u003erx_queue.toggle;\n+\t}\n }\n \n /**\n * ibmveth_rxq_harvest_buffer - Harvest buffer from pool\n *\n- * @adapter: pointer to adapter\n- * @reuse: whether to reuse buffer\n+ * @adapter: pointer to adapter\n+ * @correlator: correlator of the current rx queue entry, as read by poll\n+ * @reuse: whether to reuse buffer\n *\n * Context: called from ibmveth_poll\n *\n+ * The ring advances even on error, so poll does not return to a bad\n+ * slot before the scheduled reset can run.\n+ *\n * Return:\n * * %0 - success\n * * other - non-zero return from ibmveth_remove_buffer_from_pool\n */\n static int ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter,\n-\t\t\t\t bool reuse)\n+\t\t\t\t u64 correlator, bool reuse)\n {\n-\tu64 cor;\n \tint rc;\n \n-\tcor = adapter-\u003erx_queue.queue_addr[adapter-\u003erx_queue.index].correlator;\n-\trc = ibmveth_remove_buffer_from_pool(adapter, cor, reuse);\n-\tif (unlikely(rc))\n-\t\treturn rc;\n-\n-\tif (++adapter-\u003erx_queue.index == adapter-\u003erx_queue.num_slots) {\n-\t\tadapter-\u003erx_queue.index = 0;\n-\t\tadapter-\u003erx_queue.toggle = !adapter-\u003erx_queue.toggle;\n-\t}\n+\trc = ibmveth_remove_buffer_from_pool(adapter, correlator, reuse);\n+\tibmveth_rxq_advance(adapter);\n \n-\treturn 0;\n+\treturn rc;\n }\n \n static void ibmveth_free_tx_ltb(struct ibmveth_adapter *adapter, int idx)\n@@ -628,8 +669,6 @@ static int ibmveth_open(struct net_device *netdev)\n \n \tnetdev_dbg(netdev, \"open starting\\n\");\n \n-\tnapi_enable(\u0026adapter-\u003enapi);\n-\n \tfor(i = 0; i \u003c IBMVETH_NUM_BUFF_POOLS; i++)\n \t\trxq_entries += adapter-\u003erx_buff_pool[i].size;\n \n@@ -717,10 +756,19 @@ static int ibmveth_open(struct net_device *netdev)\n \t\t}\n \t}\n \n+\t/* NAPI can run as soon as it is enabled, from netpoll during the\n+\t * direct close()/open() pairs or from a direct ibmveth_interrupt()\n+\t * call, so enable it only once everything ibmveth_poll() touches\n+\t * exists.\n+\t */\n+\tnapi_enable(\u0026adapter-\u003enapi);\n+\n \tnetdev_dbg(netdev, \"registering irq 0x%x\\n\", netdev-\u003eirq);\n \trc = request_irq(netdev-\u003eirq, ibmveth_interrupt, 0, netdev-\u003ename,\n \t\t\t netdev);\n \tif (rc != 0) {\n+\t\tnapi_disable(\u0026adapter-\u003enapi);\n+\t\tsynchronize_net();\n \t\tnetdev_err(netdev, \"unable to request irq 0x%x, rc %d\\n\",\n \t\t\t netdev-\u003eirq, rc);\n \t\tgoto out_free_buffer_pools;\n@@ -733,6 +781,7 @@ static int ibmveth_open(struct net_device *netdev)\n \n \tnetif_tx_start_all_queues(netdev);\n \n+\tadapter-\u003eopened = true;\n \tnetdev_dbg(netdev, \"open complete\\n\");\n \n \treturn 0;\n@@ -765,7 +814,6 @@ static int ibmveth_open(struct net_device *netdev)\n out_free_buffer_list:\n \tfree_page((unsigned long)adapter-\u003ebuffer_list_addr);\n out:\n-\tnapi_disable(\u0026adapter-\u003enapi);\n \treturn rc;\n }\n \n@@ -776,11 +824,24 @@ static int ibmveth_close(struct net_device *netdev)\n \tlong lpar_rc;\n \tint i;\n \n+\t/* change_mtu, pool sysfs, set_csum and set_tso call close() and\n+\t * open() directly. If that open() fails, IFF_UP stays set and\n+\t * NAPI is disabled; a second close() would hang in napi_disable().\n+\t */\n+\tif (!adapter-\u003eopened)\n+\t\treturn 0;\n+\tadapter-\u003eopened = false;\n+\n \tnetdev_dbg(netdev, \"close starting\\n\");\n \n \tnapi_disable(\u0026adapter-\u003enapi);\n+\t/* napi_disable() returns once ibmveth_poll() has called\n+\t * napi_complete_done(), but the poll still re-enables the\n+\t * interrupt and reads the RX queue after that.\n+\t */\n+\tsynchronize_net();\n \n-\tnetif_tx_stop_all_queues(netdev);\n+\tnetif_tx_disable(netdev);\n \n \th_vio_signal(adapter-\u003evdev-\u003eunit_address, VIO_IRQ_DISABLE);\n \n@@ -827,10 +888,10 @@ static int ibmveth_close(struct net_device *netdev)\n *\n * @w: pointer to work_struct embedded in adapter structure\n *\n- * Context: This routine acquires rtnl_mutex and disables its NAPI through\n- * ibmveth_close. It can't be called directly in a context that has\n- * already acquired rtnl_mutex or disabled its NAPI, or directly from\n- * a poll routine.\n+ * Context: This routine acquires rtnl_mutex and, if the device is open,\n+ * disables its NAPI through ibmveth_close. It can't be called\n+ * directly in a context that has already acquired rtnl_mutex or\n+ * disabled its NAPI, or directly from a poll routine.\n *\n * Return: void\n */\n@@ -1122,12 +1183,13 @@ static int ibmveth_set_channels(struct net_device *netdev,\n \tstruct ibmveth_adapter *adapter = netdev_priv(netdev);\n \tunsigned int old = netdev-\u003ereal_num_tx_queues,\n \t\t goal = channels-\u003etx_count;\n-\tint rc, i;\n+\tint rc, i, alloc_rc = 0;\n \n-\t/* If ndo_open has not been called yet then don't allocate, just set\n-\t * desired netdev_queue's and return\n+\t/* If the device is not open (including a failed close/open with\n+\t * IFF_UP still set) then don't allocate, just set desired\n+\t * netdev_queue's and return\n \t */\n-\tif (!(netdev-\u003eflags \u0026 IFF_UP))\n+\tif (!adapter-\u003eopened)\n \t\treturn netif_set_real_num_tx_queues(netdev, goal);\n \n \t/* We have IBMVETH_MAX_QUEUES netdev_queue's allocated\n@@ -1147,6 +1209,7 @@ static int ibmveth_set_channels(struct net_device *netdev,\n \t\t/* if something goes wrong, free everything we just allocated */\n \t\tnetdev_err(netdev, \"Failed to allocate more tx queues, returning to %d queues\\n\",\n \t\t\t old);\n+\t\talloc_rc = rc;\n \t\tgoal = old;\n \t\told = i;\n \t\tbreak;\n@@ -1157,6 +1220,8 @@ static int ibmveth_set_channels(struct net_device *netdev,\n \t\t\t old);\n \t\tgoal = old;\n \t\told = i;\n+\t} else if (alloc_rc) {\n+\t\trc = alloc_rc;\n \t}\n \t/* Free any that are no longer needed */\n \tfor (i = old; i \u003e goal; i--) {\n@@ -1331,8 +1396,12 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,\n \n }\n \n-static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)\n+/* Returns false when the IP or TCP headers fail the checks; the frame is\n+ * then left unchanged for the stack to check.\n+ */\n+static bool ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)\n {\n+\tunsigned int gso_type, ip_len;\n \tstruct tcphdr *tcph;\n \tint offset = 0;\n \tint hdr_len;\n@@ -1341,28 +1410,41 @@ static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)\n \tif (skb-\u003eprotocol == htons(ETH_P_IP)) {\n \t\tstruct iphdr *iph = (struct iphdr *)skb-\u003edata;\n \n+\t\tif (skb_headlen(skb) \u003c sizeof(*iph) || iph-\u003eihl \u003c 5)\n+\t\t\treturn false;\n \t\tif (iph-\u003eprotocol == IPPROTO_TCP) {\n+\t\t\t/* only a whole datagram has a TCP header to segment */\n+\t\t\tif (ip_is_fragment(iph))\n+\t\t\t\treturn false;\n \t\t\toffset = iph-\u003eihl * 4;\n-\t\t\tskb_shinfo(skb)-\u003egso_type = SKB_GSO_TCPV4;\n+\t\t\tip_len = ntohs(iph-\u003etot_len);\n+\t\t\tgso_type = SKB_GSO_TCPV4;\n \t\t} else {\n-\t\t\treturn;\n+\t\t\treturn true;\n \t\t}\n \t} else if (skb-\u003eprotocol == htons(ETH_P_IPV6)) {\n \t\tstruct ipv6hdr *iph6 = (struct ipv6hdr *)skb-\u003edata;\n \n+\t\tif (skb_headlen(skb) \u003c sizeof(*iph6))\n+\t\t\treturn false;\n \t\tif (iph6-\u003enexthdr == IPPROTO_TCP) {\n \t\t\toffset = sizeof(struct ipv6hdr);\n-\t\t\tskb_shinfo(skb)-\u003egso_type = SKB_GSO_TCPV6;\n+\t\t\tip_len = offset + ntohs(iph6-\u003epayload_len);\n+\t\t\tgso_type = SKB_GSO_TCPV6;\n \t\t} else {\n-\t\t\treturn;\n+\t\t\treturn true;\n \t\t}\n \t} else {\n-\t\treturn;\n+\t\treturn true;\n \t}\n \t/* if mss is not set through Large Packet bit/mss in rx buffer,\n \t * expect that the mss will be written to the tcp header checksum.\n \t */\n \ttcph = (struct tcphdr *)(skb-\u003edata + offset);\n+\tif (skb_headlen(skb) \u003c offset + sizeof(*tcph) || tcph-\u003edoff \u003c 5 ||\n+\t ip_len \u003e skb_headlen(skb) || ip_len \u003c= offset + tcph-\u003edoff * 4)\n+\t\treturn false;\n+\tskb_shinfo(skb)-\u003egso_type = gso_type;\n \tif (lrg_pkt) {\n \t\tskb_shinfo(skb)-\u003egso_size = mss;\n \t} else if (offset) {\n@@ -1371,11 +1453,18 @@ static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)\n \t}\n \n \tif (skb_shinfo(skb)-\u003egso_size) {\n+\t\t/* chosen by the sending partition: at least the floor\n+\t\t * virtio_net_hdr_to_skb() uses, and never GSO_BY_FRAGS\n+\t\t */\n+\t\tskb_shinfo(skb)-\u003egso_size =\n+\t\t\tclamp_t(u16, skb_shinfo(skb)-\u003egso_size,\n+\t\t\t\tTCP_MIN_GSO_SIZE, GSO_BY_FRAGS - 1);\n \t\thdr_len = offset + tcph-\u003edoff * 4;\n \t\tskb_shinfo(skb)-\u003egso_segs =\n-\t\t\t\tDIV_ROUND_UP(skb-\u003elen - hdr_len,\n+\t\t\t\tDIV_ROUND_UP(ip_len - hdr_len,\n \t\t\t\t\t skb_shinfo(skb)-\u003egso_size);\n \t}\n+\treturn true;\n }\n \n static void ibmveth_rx_csum_helper(struct sk_buff *skb,\n@@ -1392,6 +1481,10 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb,\n \n \tif (skb_proto == ETH_P_IP) {\n \t\tiph = (struct iphdr *)skb-\u003edata;\n+\t\tif (skb_headlen(skb) \u003c sizeof(*iph) || iph-\u003eihl \u003c 5 ||\n+\t\t skb_headlen(skb) \u003c iph-\u003eihl * 4 ||\n+\t\t (iph-\u003eprotocol == IPPROTO_TCP \u0026\u0026 ip_is_fragment(iph)))\n+\t\t\tgoto bad_hdr;\n \n \t\t/* If the IP checksum is not offloaded and if the packet\n \t\t * is large send, the checksum must be rebuilt.\n@@ -1406,6 +1499,8 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb,\n \t\tiph_proto = iph-\u003eprotocol;\n \t} else if (skb_proto == ETH_P_IPV6) {\n \t\tiph6 = (struct ipv6hdr *)skb-\u003edata;\n+\t\tif (skb_headlen(skb) \u003c sizeof(*iph6))\n+\t\t\tgoto bad_hdr;\n \t\tiphlen = sizeof(struct ipv6hdr);\n \t\tiph_proto = iph6-\u003enexthdr;\n \t}\n@@ -1428,6 +1523,8 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb,\n \tif (iph_proto == IPPROTO_TCP) {\n \t\tstruct tcphdr *tcph = (struct tcphdr *)(skb-\u003edata + iphlen);\n \n+\t\tif (skb_headlen(skb) \u003c iphlen + sizeof(*tcph))\n+\t\t\tgoto bad_hdr;\n \t\tif (tcph-\u003echeck == 0x0000) {\n \t\t\t/* Recompute TCP pseudo header checksum */\n \t\t\ttcphdrlen = skb-\u003elen - iphlen;\n@@ -1445,6 +1542,13 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb,\n \t\t\tskb_reset_network_header(skb);\n \t\t}\n \t}\n+\treturn;\n+\n+bad_hdr:\n+\t/* headers do not fit the frame, or a fragment has no whole TCP\n+\t * segment; let the stack check it\n+\t */\n+\tskb-\u003eip_summed = CHECKSUM_NONE;\n }\n \n static int ibmveth_poll(struct napi_struct *napi, int budget)\n@@ -1454,31 +1558,60 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)\n \tstruct net_device *netdev = adapter-\u003enetdev;\n \tint frames_processed = 0;\n \tunsigned long lpar_rc;\n+\tu64 correlator;\n \tu16 mss = 0;\n+\tint rc;\n \n-restart_poll:\n \twhile (frames_processed \u003c budget) {\n \t\tif (!ibmveth_rxq_pending_buffer(adapter))\n \t\t\tbreak;\n \n \t\tsmp_rmb();\n+\t\tcorrelator = ibmveth_rxq_correlator(adapter);\n \t\tif (!ibmveth_rxq_buffer_valid(adapter)) {\n \t\t\twmb(); /* suggested by larson1 */\n \t\t\tadapter-\u003erx_invalid_buffer++;\n \t\t\tnetdev_dbg(netdev, \"recycling invalid buffer\\n\");\n-\t\t\tif (unlikely(ibmveth_rxq_harvest_buffer(adapter, true)))\n-\t\t\t\tbreak;\n+\t\t\trc = ibmveth_rxq_harvest_buffer(adapter, correlator, true);\n+\t\t\tif (unlikely(rc)) {\n+\t\t\t\tnetdev-\u003estats.rx_dropped++;\n+\t\t\t\tframes_processed++;\n+\t\t\t\tcontinue;\n+\t\t\t}\n \t\t} else {\n \t\t\tstruct sk_buff *skb, *new_skb;\n \t\t\tint length = ibmveth_rxq_frame_length(adapter);\n \t\t\tint offset = ibmveth_rxq_frame_offset(adapter);\n \t\t\tint csum_good = ibmveth_rxq_csum_good(adapter);\n \t\t\tint lrg_pkt = ibmveth_rxq_large_packet(adapter);\n+\t\t\tunsigned int pool, room, off, len;\n \t\t\t__sum16 iph_check = 0;\n \n-\t\t\tskb = ibmveth_rxq_get_buffer(adapter);\n-\t\t\tif (unlikely(!skb))\n-\t\t\t\tbreak;\n+\t\t\tskb = ibmveth_rxq_get_buffer(adapter, correlator);\n+\t\t\tif (unlikely(!skb)) {\n+\t\t\t\tibmveth_rxq_advance(adapter);\n+\t\t\t\tnetdev-\u003estats.rx_dropped++;\n+\t\t\t\tframes_processed++;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\tpool = correlator \u003e\u003e 32;\n+\t\t\troom = min_t(unsigned int, skb_tailroom(skb),\n+\t\t\t\t adapter-\u003erx_buff_pool[pool].buff_size);\n+\t\t\toff = offset;\n+\t\t\tlen = length;\n+\t\t\tif (unlikely(len \u003c ETH_HLEN || off \u003e= room ||\n+\t\t\t\t len \u003e room - off)) {\n+\t\t\t\tif (net_ratelimit())\n+\t\t\t\t\tnetdev_err(netdev,\n+\t\t\t\t\t\t \"bad RX frame offset %u length %u (buffer %u), dropping\\n\",\n+\t\t\t\t\t\t off, len, room);\n+\t\t\t\tibmveth_rxq_harvest_buffer(adapter, correlator,\n+\t\t\t\t\t\t\t true);\n+\t\t\t\tnetdev-\u003estats.rx_dropped++;\n+\t\t\t\tframes_processed++;\n+\t\t\t\tcontinue;\n+\t\t\t}\n \n \t\t\t/* if the large packet bit is set in the rx queue\n \t\t\t * descriptor, the mss will be written by PHYP eight\n@@ -1502,12 +1635,25 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)\n \t\t\t\tif (rx_flush)\n \t\t\t\t\tibmveth_flush_buffer(skb-\u003edata,\n \t\t\t\t\t\tlength + offset);\n-\t\t\t\tif (unlikely(ibmveth_rxq_harvest_buffer(adapter, true)))\n-\t\t\t\t\tbreak;\n+\t\t\t\trc = ibmveth_rxq_harvest_buffer(adapter,\n+\t\t\t\t\t\t\t\tcorrelator,\n+\t\t\t\t\t\t\t\ttrue);\n+\t\t\t\tif (unlikely(rc)) {\n+\t\t\t\t\tdev_kfree_skb_any(new_skb);\n+\t\t\t\t\tnetdev-\u003estats.rx_dropped++;\n+\t\t\t\t\tframes_processed++;\n+\t\t\t\t\tcontinue;\n+\t\t\t\t}\n \t\t\t\tskb = new_skb;\n \t\t\t} else {\n-\t\t\t\tif (unlikely(ibmveth_rxq_harvest_buffer(adapter, false)))\n-\t\t\t\t\tbreak;\n+\t\t\t\trc = ibmveth_rxq_harvest_buffer(adapter,\n+\t\t\t\t\t\t\t\tcorrelator,\n+\t\t\t\t\t\t\t\tfalse);\n+\t\t\t\tif (unlikely(rc)) {\n+\t\t\t\t\tnetdev-\u003estats.rx_dropped++;\n+\t\t\t\t\tframes_processed++;\n+\t\t\t\t\tcontinue;\n+\t\t\t\t}\n \t\t\t\tskb_reserve(skb, offset);\n \t\t\t}\n \n@@ -1517,7 +1663,8 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)\n \t\t\t/* PHYP without PLSO support places a -1 in the ip\n \t\t\t * checksum for large send frames.\n \t\t\t */\n-\t\t\tif (skb-\u003eprotocol == cpu_to_be16(ETH_P_IP)) {\n+\t\t\tif (skb-\u003eprotocol == cpu_to_be16(ETH_P_IP) \u0026\u0026\n+\t\t\t skb_headlen(skb) \u003e= sizeof(struct iphdr)) {\n \t\t\t\tstruct iphdr *iph = (struct iphdr *)skb-\u003edata;\n \n \t\t\t\tiph_check = iph-\u003echeck;\n@@ -1525,7 +1672,8 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)\n \n \t\t\tif ((length \u003e netdev-\u003emtu + ETH_HLEN) ||\n \t\t\t lrg_pkt || iph_check == 0xffff) {\n-\t\t\t\tibmveth_rx_mss_helper(skb, mss, lrg_pkt);\n+\t\t\t\tif (!ibmveth_rx_mss_helper(skb, mss, lrg_pkt))\n+\t\t\t\t\tcsum_good = 0;\n \t\t\t\tadapter-\u003erx_large_packets++;\n \t\t\t}\n \n@@ -1542,7 +1690,11 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)\n \t\t}\n \t}\n \n-\tibmveth_replenish_task(adapter);\n+\t/* netpoll polls with budget 0 for TX only, and is not serialized\n+\t * with a NAPI poll that was already running when it was set up\n+\t */\n+\tif (budget)\n+\t\tibmveth_replenish_task(adapter);\n \n \tif (frames_processed == budget)\n \t\tgoto out;\n@@ -1559,10 +1711,13 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)\n \t\tgoto out;\n \t}\n \n-\tif (ibmveth_rxq_pending_buffer(adapter) \u0026\u0026 napi_schedule(napi)) {\n+\t/* Mask before queueing, as ibmveth_interrupt() does: a threaded\n+\t * NAPI can start polling, and unmask, as soon as it is queued.\n+\t */\n+\tif (ibmveth_rxq_pending_buffer(adapter) \u0026\u0026 napi_schedule_prep(napi)) {\n \t\tlpar_rc = h_vio_signal(adapter-\u003evdev-\u003eunit_address,\n \t\t\t\t VIO_IRQ_DISABLE);\n-\t\tgoto restart_poll;\n+\t\t__napi_schedule(napi);\n \t}\n \n out:\n@@ -1682,14 +1837,6 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)\n \treturn -EINVAL;\n }\n \n-#ifdef CONFIG_NET_POLL_CONTROLLER\n-static void ibmveth_poll_controller(struct net_device *dev)\n-{\n-\tibmveth_replenish_task(netdev_priv(dev));\n-\tibmveth_interrupt(dev-\u003eirq, dev);\n-}\n-#endif\n-\n /**\n * ibmveth_get_desired_dma - Calculate IO memory desired by the driver\n *\n@@ -1791,11 +1938,42 @@ static const struct net_device_ops ibmveth_netdev_ops = {\n \t.ndo_validate_addr\t= eth_validate_addr,\n \t.ndo_set_mac_address = ibmveth_set_mac_addr,\n \t.ndo_features_check\t= ibmveth_features_check,\n-#ifdef CONFIG_NET_POLL_CONTROLLER\n-\t.ndo_poll_controller\t= ibmveth_poll_controller,\n-#endif\n };\n \n+/**\n+ * ibmveth_pool_kobj_release - Mark a pool kobject finished\n+ * @kobj: kobject embedded in the pool\n+ *\n+ * The pool kobjects live in netdev_priv(), so the last put must wait\n+ * for this before free_netdev().\n+ */\n+static void ibmveth_pool_kobj_release(struct kobject *kobj)\n+{\n+\tstruct ibmveth_buff_pool *pool = container_of(kobj,\n+\t\t\t\t\t\t struct ibmveth_buff_pool,\n+\t\t\t\t\t\t kobj);\n+\n+\tcomplete(\u0026pool-\u003ereleased);\n+}\n+\n+/**\n+ * ibmveth_put_pool_kobjs - Drop the pool kobjects and wait for release\n+ * @adapter: ibmveth adapter\n+ *\n+ * With CONFIG_DEBUG_KOBJECT_RELEASE the cleanup, including removing the\n+ * sysfs files, runs later from a work item in the kobject; wait for it\n+ * so free_netdev() cannot free the pools first.\n+ */\n+static void ibmveth_put_pool_kobjs(struct ibmveth_adapter *adapter)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i \u003c IBMVETH_NUM_BUFF_POOLS; i++)\n+\t\tkobject_put(\u0026adapter-\u003erx_buff_pool[i].kobj);\n+\tfor (i = 0; i \u003c IBMVETH_NUM_BUFF_POOLS; i++)\n+\t\twait_for_completion(\u0026adapter-\u003erx_buff_pool[i].released);\n+}\n+\n static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)\n {\n \tint rc, i, mac_len;\n@@ -1906,6 +2084,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)\n \t\tibmveth_init_buffer_pool(\u0026adapter-\u003erx_buff_pool[i], i,\n \t\t\t\t\t pool_count[i], pool_size[i],\n \t\t\t\t\t pool_active[i]);\n+\t\tinit_completion(\u0026adapter-\u003erx_buff_pool[i].released);\n \t\terror = kobject_init_and_add(kobj, \u0026ktype_veth_pool,\n \t\t\t\t\t \u0026dev-\u003edev.kobj, \"pool%d\", i);\n \t\tif (!error)\n@@ -1917,8 +2096,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)\n \tif (rc) {\n \t\tnetdev_dbg(netdev, \"failed to set number of tx queues rc=%d\\n\",\n \t\t\t rc);\n-\t\tfree_netdev(netdev);\n-\t\treturn rc;\n+\t\tgoto err_put_pools;\n \t}\n \tadapter-\u003etx_ltb_size = PAGE_ALIGN(IBMVETH_MAX_TX_BUF_SIZE);\n \tfor (i = 0; i \u003c IBMVETH_MAX_QUEUES; i++)\n@@ -1933,25 +2111,27 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)\n \n \tif (rc) {\n \t\tnetdev_dbg(netdev, \"failed to register netdev rc=%d\\n\", rc);\n-\t\tfree_netdev(netdev);\n-\t\treturn rc;\n+\t\tgoto err_put_pools;\n \t}\n \n \tnetdev_dbg(netdev, \"registered\\n\");\n \n \treturn 0;\n+\n+err_put_pools:\n+\tibmveth_put_pool_kobjs(adapter);\n+\tfree_netdev(netdev);\n+\treturn rc;\n }\n \n static void ibmveth_remove(struct vio_dev *dev)\n {\n \tstruct net_device *netdev = dev_get_drvdata(\u0026dev-\u003edev);\n \tstruct ibmveth_adapter *adapter = netdev_priv(netdev);\n-\tint i;\n \n-\tcancel_work_sync(\u0026adapter-\u003ework);\n+\tdisable_work_sync(\u0026adapter-\u003ework);\n \n-\tfor (i = 0; i \u003c IBMVETH_NUM_BUFF_POOLS; i++)\n-\t\tkobject_put(\u0026adapter-\u003erx_buff_pool[i].kobj);\n+\tibmveth_put_pool_kobjs(adapter);\n \n \tunregister_netdev(netdev);\n \n@@ -2127,7 +2307,7 @@ static const struct sysfs_ops veth_pool_ops = {\n };\n \n static struct kobj_type ktype_veth_pool = {\n-\t.release = NULL,\n+\t.release = ibmveth_pool_kobj_release,\n \t.sysfs_ops = \u0026veth_pool_ops,\n \t.default_groups = veth_pool_groups,\n };\n@@ -2198,8 +2378,7 @@ static void ibmveth_reset_kunit(struct work_struct *w)\n * @test: pointer to kunit structure\n *\n * Tests the error returns from ibmveth_remove_buffer_from_pool.\n- * ibmveth_remove_buffer_from_pool also calls WARN_ON, so dmesg should be\n- * checked to see that these warnings happened.\n+ * Each error also logs a ratelimited netdev_err.\n *\n * Return: void\n */\n@@ -2208,6 +2387,7 @@ static void ibmveth_remove_buffer_from_pool_test(struct kunit *test)\n \tstruct ibmveth_adapter *adapter = kunit_kzalloc(test, sizeof(*adapter), GFP_KERNEL);\n \tstruct ibmveth_buff_pool *pool;\n \tu64 correlator;\n+\tint ret;\n \n \tKUNIT_ASSERT_NOT_ERR_OR_NULL(test, adapter);\n \n@@ -2231,6 +2411,13 @@ static void ibmveth_remove_buffer_from_pool_test(struct kunit *test)\n \tKUNIT_EXPECT_EQ(test, -EINVAL, ibmveth_remove_buffer_from_pool(adapter, correlator, false));\n \tKUNIT_EXPECT_EQ(test, -EINVAL, ibmveth_remove_buffer_from_pool(adapter, correlator, true));\n \n+\t/* Pool 2 is in range but has no skbuff array, like an inactive pool. */\n+\tcorrelator = ((u64)2 \u003c\u003c 32) | 0;\n+\tret = ibmveth_remove_buffer_from_pool(adapter, correlator, false);\n+\tKUNIT_EXPECT_EQ(test, -EINVAL, ret);\n+\tret = ibmveth_remove_buffer_from_pool(adapter, correlator, true);\n+\tKUNIT_EXPECT_EQ(test, -EINVAL, ret);\n+\n \tcorrelator = (u64)0 | 0;\n \tpool-\u003eskbuff[0] = NULL;\n \tKUNIT_EXPECT_EQ(test, -EFAULT, ibmveth_remove_buffer_from_pool(adapter, correlator, false));\n@@ -2243,9 +2430,8 @@ static void ibmveth_remove_buffer_from_pool_test(struct kunit *test)\n * ibmveth_rxq_get_buffer_test - unit test for ibmveth_rxq_get_buffer\n * @test: pointer to kunit structure\n *\n- * Tests ibmveth_rxq_get_buffer. ibmveth_rxq_get_buffer also calls WARN_ON for\n- * the NULL returns, so dmesg should be checked to see that these warnings\n- * happened.\n+ * Tests ibmveth_rxq_get_buffer. Each NULL return also logs a ratelimited\n+ * netdev_err.\n *\n * Return: void\n */\n@@ -2254,6 +2440,7 @@ static void ibmveth_rxq_get_buffer_test(struct kunit *test)\n \tstruct ibmveth_adapter *adapter = kunit_kzalloc(test, sizeof(*adapter), GFP_KERNEL);\n \tstruct sk_buff *skb = kunit_kzalloc(test, sizeof(*skb), GFP_KERNEL);\n \tstruct ibmveth_buff_pool *pool;\n+\tu64 cor;\n \n \tKUNIT_ASSERT_NOT_ERR_OR_NULL(test, adapter);\n \tKUNIT_ASSERT_NOT_ERR_OR_NULL(test, skb);\n@@ -2277,21 +2464,299 @@ static void ibmveth_rxq_get_buffer_test(struct kunit *test)\n \tKUNIT_ASSERT_NOT_ERR_OR_NULL(test, pool-\u003eskbuff);\n \n \tadapter-\u003erx_queue.queue_addr[0].correlator = (u64)IBMVETH_NUM_BUFF_POOLS \u003c\u003c 32 | 0;\n-\tKUNIT_EXPECT_PTR_EQ(test, NULL, ibmveth_rxq_get_buffer(adapter));\n+\tcor = ibmveth_rxq_correlator(adapter);\n+\tKUNIT_EXPECT_PTR_EQ(test, NULL,\n+\t\t\t ibmveth_rxq_get_buffer(adapter, cor));\n \n \tadapter-\u003erx_queue.queue_addr[0].correlator = (u64)0 \u003c\u003c 32 | adapter-\u003erx_buff_pool[0].size;\n-\tKUNIT_EXPECT_PTR_EQ(test, NULL, ibmveth_rxq_get_buffer(adapter));\n+\tcor = ibmveth_rxq_correlator(adapter);\n+\tKUNIT_EXPECT_PTR_EQ(test, NULL,\n+\t\t\t ibmveth_rxq_get_buffer(adapter, cor));\n+\n+\t/* Pool 2 is in range but has no skbuff array, like an inactive pool. */\n+\tadapter-\u003erx_queue.queue_addr[0].correlator = (u64)2 \u003c\u003c 32 | 0;\n+\tcor = ibmveth_rxq_correlator(adapter);\n+\tKUNIT_EXPECT_PTR_EQ(test, NULL,\n+\t\t\t ibmveth_rxq_get_buffer(adapter, cor));\n \n \tpool-\u003eskbuff[0] = skb;\n \tadapter-\u003erx_queue.queue_addr[0].correlator = (u64)0 \u003c\u003c 32 | 0;\n-\tKUNIT_EXPECT_PTR_EQ(test, skb, ibmveth_rxq_get_buffer(adapter));\n+\tcor = ibmveth_rxq_correlator(adapter);\n+\tKUNIT_EXPECT_PTR_EQ(test, skb,\n+\t\t\t ibmveth_rxq_get_buffer(adapter, cor));\n \n \tflush_work(\u0026adapter-\u003ework);\n }\n \n+/**\n+ * ibmveth_rxq_harvest_buffer_test - unit test for ibmveth_rxq_harvest_buffer\n+ * @test: pointer to kunit structure\n+ *\n+ * A bad correlator must still advance the RX ring, wrapping and flipping\n+ * the toggle at the end. This covers the harvest path; the advance after\n+ * ibmveth_rxq_get_buffer() fails in ibmveth_poll() is not tested here.\n+ *\n+ * Return: void\n+ */\n+static void ibmveth_rxq_harvest_buffer_test(struct kunit *test)\n+{\n+\tstruct ibmveth_adapter *adapter;\n+\tstruct ibmveth_buff_pool *pool;\n+\tu64 cor;\n+\tint ret;\n+\n+\tadapter = kunit_kzalloc(test, sizeof(*adapter), GFP_KERNEL);\n+\tKUNIT_ASSERT_NOT_ERR_OR_NULL(test, adapter);\n+\n+\tINIT_WORK(\u0026adapter-\u003ework, ibmveth_reset_kunit);\n+\n+\tadapter-\u003erx_queue.num_slots = 2;\n+\tadapter-\u003erx_queue.index = 0;\n+\tadapter-\u003erx_queue.toggle = 1;\n+\tadapter-\u003erx_queue.queue_addr =\n+\t\tkunit_kcalloc(test, 2, sizeof(struct ibmveth_rx_q_entry),\n+\t\t\t GFP_KERNEL);\n+\tKUNIT_ASSERT_NOT_ERR_OR_NULL(test, adapter-\u003erx_queue.queue_addr);\n+\n+\t/* Set sane values for buffer pools */\n+\tfor (int i = 0; i \u003c IBMVETH_NUM_BUFF_POOLS; i++)\n+\t\tibmveth_init_buffer_pool(\u0026adapter-\u003erx_buff_pool[i], i,\n+\t\t\t\t\t pool_count[i], pool_size[i],\n+\t\t\t\t\t pool_active[i]);\n+\n+\tpool = \u0026adapter-\u003erx_buff_pool[0];\n+\tpool-\u003eskbuff = kunit_kcalloc(test, pool-\u003esize, sizeof(void *),\n+\t\t\t\t GFP_KERNEL);\n+\tKUNIT_ASSERT_NOT_ERR_OR_NULL(test, pool-\u003eskbuff);\n+\n+\t/* Slot 0: pool out of range. Slot 1: valid, but no skb. */\n+\tadapter-\u003erx_queue.queue_addr[0].correlator =\n+\t\t(u64)IBMVETH_NUM_BUFF_POOLS \u003c\u003c 32 | 0;\n+\tadapter-\u003erx_queue.queue_addr[1].correlator = (u64)0 \u003c\u003c 32 | 0;\n+\n+\tcor = ibmveth_rxq_correlator(adapter);\n+\tret = ibmveth_rxq_harvest_buffer(adapter, cor, true);\n+\tKUNIT_EXPECT_EQ(test, -EINVAL, ret);\n+\tKUNIT_EXPECT_EQ(test, 1ULL, adapter-\u003erx_queue.index);\n+\tKUNIT_EXPECT_EQ(test, 1ULL, adapter-\u003erx_queue.toggle);\n+\n+\tcor = ibmveth_rxq_correlator(adapter);\n+\tret = ibmveth_rxq_harvest_buffer(adapter, cor, true);\n+\tKUNIT_EXPECT_EQ(test, -EFAULT, ret);\n+\tKUNIT_EXPECT_EQ(test, 0ULL, adapter-\u003erx_queue.index);\n+\tKUNIT_EXPECT_EQ(test, 0ULL, adapter-\u003erx_queue.toggle);\n+\n+\tflush_work(\u0026adapter-\u003ework);\n+}\n+\n+KUNIT_DEFINE_ACTION_WRAPPER(ibmveth_kfree_skb, kfree_skb, struct sk_buff *);\n+\n+/* A TCP frame after eth_type_trans(): IP header, 20 byte TCP header and\n+ * payload bytes of data, with the IP length matching the frame.\n+ */\n+static struct sk_buff *ibmveth_test_tcp_skb(struct kunit *test, bool ipv6,\n+\t\t\t\t\t unsigned int payload)\n+{\n+\tunsigned int iplen = ipv6 ? sizeof(struct ipv6hdr) : sizeof(struct iphdr);\n+\tunsigned int len = iplen + sizeof(struct tcphdr) + payload;\n+\tstruct sk_buff *skb = alloc_skb(len, GFP_KERNEL);\n+\tstruct tcphdr *tcph;\n+\n+\tKUNIT_ASSERT_NOT_ERR_OR_NULL(test, skb);\n+\tKUNIT_ASSERT_EQ(test, 0, kunit_add_action_or_reset(test,\n+\t\t\t\t\t\t\t ibmveth_kfree_skb,\n+\t\t\t\t\t\t\t skb));\n+\tskb_put_zero(skb, len);\n+\tif (ipv6) {\n+\t\tstruct ipv6hdr *iph6 = (struct ipv6hdr *)skb-\u003edata;\n+\n+\t\tskb-\u003eprotocol = htons(ETH_P_IPV6);\n+\t\tiph6-\u003eversion = 6;\n+\t\tiph6-\u003enexthdr = IPPROTO_TCP;\n+\t\tiph6-\u003epayload_len = htons(len - iplen);\n+\t} else {\n+\t\tstruct iphdr *iph = (struct iphdr *)skb-\u003edata;\n+\n+\t\tskb-\u003eprotocol = htons(ETH_P_IP);\n+\t\tiph-\u003eversion = 4;\n+\t\tiph-\u003eihl = 5;\n+\t\tiph-\u003eprotocol = IPPROTO_TCP;\n+\t\tiph-\u003etot_len = htons(len);\n+\t}\n+\ttcph = (struct tcphdr *)(skb-\u003edata + iplen);\n+\ttcph-\u003edoff = 5;\n+\treturn skb;\n+}\n+\n+/**\n+ * ibmveth_rx_mss_helper_test - unit test for ibmveth_rx_mss_helper\n+ * @test: pointer to kunit structure\n+ *\n+ * Large send frames get gso_size from the descriptor or the TCP checksum\n+ * field, clamped, and gso_segs from the IP length. Frames whose headers\n+ * do not fit, with no TCP payload within the IP length, or that are\n+ * IPv4 fragments, are refused and left without GSO.\n+ *\n+ * Return: void\n+ */\n+static void ibmveth_rx_mss_helper_test(struct kunit *test)\n+{\n+\tstruct sk_buff *skb;\n+\tstruct tcphdr *tcph;\n+\tstruct iphdr *iph;\n+\n+\tskb = ibmveth_test_tcp_skb(test, false, 2896);\n+\ttcph = (struct tcphdr *)(skb-\u003edata + sizeof(*iph));\n+\ttcph-\u003echeck = (__force __sum16)htons(1448);\n+\tKUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, 0, 0));\n+\tKUNIT_EXPECT_EQ(test, SKB_GSO_TCPV4, skb_shinfo(skb)-\u003egso_type);\n+\tKUNIT_EXPECT_EQ(test, 1448, skb_shinfo(skb)-\u003egso_size);\n+\tKUNIT_EXPECT_EQ(test, 2, skb_shinfo(skb)-\u003egso_segs);\n+\tKUNIT_EXPECT_EQ(test, 0, (__force u16)tcph-\u003echeck);\n+\n+\tskb = ibmveth_test_tcp_skb(test, false, 2896);\n+\tKUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, 1000, 1));\n+\tKUNIT_EXPECT_EQ(test, 1000, skb_shinfo(skb)-\u003egso_size);\n+\tKUNIT_EXPECT_EQ(test, 3, skb_shinfo(skb)-\u003egso_segs);\n+\n+\tskb = ibmveth_test_tcp_skb(test, true, 2896);\n+\ttcph = (struct tcphdr *)(skb-\u003edata + sizeof(struct ipv6hdr));\n+\ttcph-\u003echeck = (__force __sum16)htons(1448);\n+\tKUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, 0, 0));\n+\tKUNIT_EXPECT_EQ(test, SKB_GSO_TCPV6, skb_shinfo(skb)-\u003egso_type);\n+\tKUNIT_EXPECT_EQ(test, 1448, skb_shinfo(skb)-\u003egso_size);\n+\tKUNIT_EXPECT_EQ(test, 2, skb_shinfo(skb)-\u003egso_segs);\n+\n+\tskb = ibmveth_test_tcp_skb(test, false, 2896);\n+\tKUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, 1, 1));\n+\tKUNIT_EXPECT_EQ(test, TCP_MIN_GSO_SIZE, skb_shinfo(skb)-\u003egso_size);\n+\n+\tskb = ibmveth_test_tcp_skb(test, false, 2896);\n+\tKUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, GSO_BY_FRAGS, 1));\n+\tKUNIT_EXPECT_EQ(test, GSO_BY_FRAGS - 1, skb_shinfo(skb)-\u003egso_size);\n+\n+\t/* refused: ihl 0, doff 4, IP length past the frame. With ihl 0 the\n+\t * TCP header would overlap the IP header; saddr makes its doff 5.\n+\t */\n+\tskb = ibmveth_test_tcp_skb(test, false, 2896);\n+\t((struct iphdr *)skb-\u003edata)-\u003eihl = 0;\n+\t((struct iphdr *)skb-\u003edata)-\u003esaddr = htonl(0x50000000);\n+\tKUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 1448, 1));\n+\tKUNIT_EXPECT_EQ(test, 0, skb_shinfo(skb)-\u003egso_size);\n+\n+\tskb = ibmveth_test_tcp_skb(test, false, 2896);\n+\t((struct tcphdr *)(skb-\u003edata + sizeof(*iph)))-\u003edoff = 4;\n+\tKUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 1448, 1));\n+\n+\tskb = ibmveth_test_tcp_skb(test, false, 2896);\n+\t((struct iphdr *)skb-\u003edata)-\u003etot_len = htons(skb-\u003elen + 1);\n+\tKUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 1448, 1));\n+\n+\t/* refused: a fragment past the first, its payload left alone */\n+\tskb = ibmveth_test_tcp_skb(test, false, 2896);\n+\t((struct iphdr *)skb-\u003edata)-\u003efrag_off = htons(185);\n+\ttcph = (struct tcphdr *)(skb-\u003edata + sizeof(*iph));\n+\ttcph-\u003echeck = (__force __sum16)htons(1448);\n+\tKUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 0, 0));\n+\tKUNIT_EXPECT_EQ(test, 0, skb_shinfo(skb)-\u003egso_size);\n+\tKUNIT_EXPECT_EQ(test, 1448, ntohs((__force __be16)tcph-\u003echeck));\n+\n+\t/* refused: only Ethernet padding past the TCP header */\n+\tskb = ibmveth_test_tcp_skb(test, false, 6);\n+\t((struct iphdr *)skb-\u003edata)-\u003etot_len = htons(40);\n+\tKUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 1448, 1));\n+\tKUNIT_EXPECT_EQ(test, 0, skb_shinfo(skb)-\u003egso_size);\n+\n+\tskb = ibmveth_test_tcp_skb(test, true, 2896);\n+\t((struct ipv6hdr *)skb-\u003edata)-\u003epayload_len = 0;\n+\tKUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 1448, 1));\n+\n+\t/* not TCP: accepted and left alone */\n+\tskb = ibmveth_test_tcp_skb(test, false, 2896);\n+\t((struct iphdr *)skb-\u003edata)-\u003eprotocol = IPPROTO_UDP;\n+\tKUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, 1448, 1));\n+\tKUNIT_EXPECT_EQ(test, 0, skb_shinfo(skb)-\u003egso_size);\n+}\n+\n+/**\n+ * ibmveth_rx_csum_helper_test - unit test for ibmveth_rx_csum_helper\n+ * @test: pointer to kunit structure\n+ *\n+ * A large send IPv4 header checksum of 0xffff is rebuilt. Headers that\n+ * do not fit the frame, an IPv4 ihl below 5, or a TCP fragment, clear\n+ * CHECKSUM_UNNECESSARY instead of being read.\n+ *\n+ * Return: void\n+ */\n+static void ibmveth_rx_csum_helper_test(struct kunit *test)\n+{\n+\tstruct sk_buff *skb;\n+\tstruct iphdr *iph;\n+\n+\tskb = ibmveth_test_tcp_skb(test, false, 100);\n+\tiph = (struct iphdr *)skb-\u003edata;\n+\tiph-\u003echeck = (__force __sum16)0xffff;\n+\t((struct tcphdr *)(skb-\u003edata + sizeof(*iph)))-\u003echeck = (__force __sum16)htons(1);\n+\tskb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n+\tibmveth_rx_csum_helper(skb, NULL);\n+\tKUNIT_EXPECT_EQ(test, 0,\n+\t\t\t(__force u16)ip_fast_csum((unsigned char *)iph, iph-\u003eihl));\n+\tKUNIT_EXPECT_EQ(test, CHECKSUM_UNNECESSARY, (int)skb-\u003eip_summed);\n+\n+\tskb = ibmveth_test_tcp_skb(test, false, 100);\n+\tiph = (struct iphdr *)skb-\u003edata;\n+\tiph-\u003eihl = 0;\n+\tiph-\u003echeck = (__force __sum16)0xffff;\n+\tskb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n+\tibmveth_rx_csum_helper(skb, NULL);\n+\tKUNIT_EXPECT_EQ(test, CHECKSUM_NONE, (int)skb-\u003eip_summed);\n+\tKUNIT_EXPECT_EQ(test, 0xffff, (__force u16)iph-\u003echeck);\n+\n+\t/* IPv4 options past the frame; UDP, so no TCP check follows */\n+\tskb = ibmveth_test_tcp_skb(test, false, 0);\n+\tiph = (struct iphdr *)skb-\u003edata;\n+\tiph-\u003eprotocol = IPPROTO_UDP;\n+\tiph-\u003eihl = 15;\n+\tiph-\u003echeck = (__force __sum16)0xffff;\n+\tskb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n+\tibmveth_rx_csum_helper(skb, NULL);\n+\tKUNIT_EXPECT_EQ(test, CHECKSUM_NONE, (int)skb-\u003eip_summed);\n+\n+\t/* a TCP fragment past the first: header and payload left alone */\n+\tskb = ibmveth_test_tcp_skb(test, false, 100);\n+\tiph = (struct iphdr *)skb-\u003edata;\n+\tiph-\u003efrag_off = htons(185);\n+\tiph-\u003echeck = (__force __sum16)0xffff;\n+\tskb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n+\tibmveth_rx_csum_helper(skb, NULL);\n+\tKUNIT_EXPECT_EQ(test, CHECKSUM_NONE, (int)skb-\u003eip_summed);\n+\tKUNIT_EXPECT_EQ(test, 0xffff, (__force u16)iph-\u003echeck);\n+\tKUNIT_EXPECT_EQ(test, 0,\n+\t\t\t(__force u16)((struct tcphdr *)(skb-\u003edata +\n+\t\t\t\t\t\t\tsizeof(*iph)))-\u003echeck);\n+\n+\t/* TCP header past the frame */\n+\tskb = ibmveth_test_tcp_skb(test, false, 0);\n+\tskb_trim(skb, sizeof(struct iphdr));\n+\tskb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n+\tibmveth_rx_csum_helper(skb, NULL);\n+\tKUNIT_EXPECT_EQ(test, CHECKSUM_NONE, (int)skb-\u003eip_summed);\n+\n+\t/* IPv6 header past the frame; UDP, so no TCP check follows */\n+\tskb = ibmveth_test_tcp_skb(test, true, 0);\n+\t((struct ipv6hdr *)skb-\u003edata)-\u003enexthdr = IPPROTO_UDP;\n+\tskb_trim(skb, sizeof(struct ipv6hdr) - 1);\n+\tskb-\u003eip_summed = CHECKSUM_UNNECESSARY;\n+\tibmveth_rx_csum_helper(skb, NULL);\n+\tKUNIT_EXPECT_EQ(test, CHECKSUM_NONE, (int)skb-\u003eip_summed);\n+}\n+\n static struct kunit_case ibmveth_test_cases[] = {\n \tKUNIT_CASE(ibmveth_remove_buffer_from_pool_test),\n \tKUNIT_CASE(ibmveth_rxq_get_buffer_test),\n+\tKUNIT_CASE(ibmveth_rxq_harvest_buffer_test),\n+\tKUNIT_CASE(ibmveth_rx_mss_helper_test),\n+\tKUNIT_CASE(ibmveth_rx_csum_helper_test),\n \t{}\n };\n \ndiff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h\nindex d87713668ed30..be0939caa328e 100644\n--- a/drivers/net/ethernet/ibm/ibmveth.h\n+++ b/drivers/net/ethernet/ibm/ibmveth.h\n@@ -14,6 +14,8 @@\n #ifndef _IBMVETH_H\n #define _IBMVETH_H\n \n+#include \u003clinux/completion.h\u003e\n+\n /* constants for H_MULTICAST_CTRL */\n #define IbmVethMcastReceptionModifyBit 0x80000UL\n #define IbmVethMcastReceptionEnableBit 0x20000UL\n@@ -143,6 +145,7 @@ struct ibmveth_buff_pool {\n struct sk_buff **skbuff;\n int active;\n struct kobject kobj;\n+\tstruct completion released;\n };\n \n struct ibmveth_rx_q {\n@@ -172,6 +175,8 @@ struct ibmveth_adapter {\n \tint rx_csum;\n \tint large_send;\n \tbool is_active_trunk;\n+\t/* Set by a successful ibmveth_open(), cleared by ibmveth_close(). */\n+\tbool opened;\n \tunsigned int rx_buffers_per_hcall;\n \n \tu64 fw_ipv6_csum_support;\n"
} |
| 2/1 | 2026/10/12 05:19 | agent | patch-evaluator |
0mModel:core Args: null Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch modifies the ibmveth driver (drivers/net/ethernet/ibm/ibmveth.c and ibmveth.h), which depends on CONFIG_PPC_PSERIES (PowerPC architecture). Because the target architecture is amd64, the modified code is structurally unreachable and cannot be compiled or executed on this target architecture.",
"WorthFuzzing": false
}Instruction: You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.
IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.
================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.
- REACHABILITY IS THE PRIMARY GATE:
Fuzzing can only discover bugs in code that can actually execute in standard virtualized
environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
regardless of whether it adds assertions or complex logic.
- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
Patch authors routinely label changes as "cleanups", "refactorings", or state
"No functional change intended". Do NOT take these claims at face value.
Code refactorings that rearrange logic, introduce helper functions, or alter state management
in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
If reachable executable code is modified or refactored, it MUST be fuzzed.
- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
Even if the author believes the invariant always holds, fuzzing is essential to verify whether
an unusual sequence of operations can violate it.
================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:
- Non-kernel and non-executable changes:
* Modifications to Documentation/, comments, or spelling fixes.
* User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
that do not affect the compiled kernel image (vmlinux) or kernel modules.
* Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
that do not alter control flow or data structures.
* Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
* Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
* Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
physical PCI hot-unplug or manual sysfs driver unbinding.
* Code paths exclusive to architectures other than the target architecture.
================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
* Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
* Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
* Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
* Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).
================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:
- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
Do NOT list generic, ubiquitous functions called by almost every program in the corpus
(including, but not limited to: general memory allocators and deallocators, page fault
and trap handlers, or core synchronization primitives; this is not an exhaustive list).
Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
which severely dilutes fuzzing effort away from the actual changes.
- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
List functions that specifically implement the logic being added or altered, or direct API entrypoints
for the subsystem feature under review.
- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).
================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Target architecture: amd64
For your convenience, here is the diff of the changes:
commit f9d2a14fecb02dee28e75a624ccc7d46804ee068
Author: syz-cluster <triage@syzkaller.com>
Date: Mon Oct 12 05:19:52 2026 +0000
syz-cluster: applied patch under review
diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
index abebdb1fc2628..1c2ac88c28ca3 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -135,6 +135,13 @@ static inline int ibmveth_rxq_frame_length(struct ibmveth_adapter *adapter)
return be32_to_cpu(adapter->rx_queue.queue_addr[adapter->rx_queue.index].length);
}
+static u64 ibmveth_rxq_correlator(struct ibmveth_adapter *adapter)
+{
+ unsigned int idx = adapter->rx_queue.index;
+
+ return READ_ONCE(adapter->rx_queue.queue_addr[idx].correlator);
+}
+
static inline int ibmveth_rxq_csum_good(struct ibmveth_adapter *adapter)
{
return ibmveth_rxq_flags(adapter) & IBMVETH_RXQ_CSUM_GOOD;
@@ -443,6 +450,37 @@ static void ibmveth_free_buffer_pool(struct ibmveth_adapter *adapter,
}
}
+/* The correlator comes back from PHYP; a bad one schedules a reset. */
+static bool ibmveth_rxq_correlator_valid(struct ibmveth_adapter *adapter,
+ u64 correlator)
+{
+ unsigned int index = correlator & 0xffffffffUL;
+ unsigned int pool = correlator >> 32;
+
+ /* An inactive pool keeps its size but has no skbuff array. */
+ if (pool < IBMVETH_NUM_BUFF_POOLS &&
+ index < adapter->rx_buff_pool[pool].size &&
+ adapter->rx_buff_pool[pool].skbuff)
+ return true;
+
+ if (net_ratelimit())
+ netdev_err(adapter->netdev,
+ "invalid RX correlator %llx, resetting\n",
+ correlator);
+ schedule_work(&adapter->work);
+ return false;
+}
+
+static void ibmveth_rxq_no_skb(struct ibmveth_adapter *adapter,
+ u64 correlator)
+{
+ if (net_ratelimit())
+ netdev_err(adapter->netdev,
+ "no buffer for RX correlator %llx, resetting\n",
+ correlator);
+ schedule_work(&adapter->work);
+}
+
/**
* ibmveth_remove_buffer_from_pool - remove a buffer from a pool
* @adapter: adapter instance
@@ -451,7 +489,8 @@ static void ibmveth_free_buffer_pool(struct ibmveth_adapter *adapter,
*
* Return:
* * %0 - success
- * * %-EINVAL - correlator maps to pool or index out of range
+ * * %-EINVAL - correlator maps to pool or index out of range, or to an
+ * inactive pool
* * %-EFAULT - pool and index map to null skb
*/
static int ibmveth_remove_buffer_from_pool(struct ibmveth_adapter *adapter,
@@ -462,15 +501,12 @@ static int ibmveth_remove_buffer_from_pool(struct ibmveth_adapter *adapter,
unsigned int free_index;
struct sk_buff *skb;
- if (WARN_ON(pool >= IBMVETH_NUM_BUFF_POOLS) ||
- WARN_ON(index >= adapter->rx_buff_pool[pool].size)) {
- schedule_work(&adapter->work);
+ if (!ibmveth_rxq_correlator_valid(adapter, correlator))
return -EINVAL;
- }
skb = adapter->rx_buff_pool[pool].skbuff[index];
- if (WARN_ON(!skb)) {
- schedule_work(&adapter->work);
+ if (!skb) {
+ ibmveth_rxq_no_skb(adapter, correlator);
return -EFAULT;
}
@@ -504,51 +540,56 @@ static int ibmveth_remove_buffer_from_pool(struct ibmveth_adapter *adapter,
return 0;
}
-/* get the current buffer on the rx queue */
-static inline struct sk_buff *ibmveth_rxq_get_buffer(struct ibmveth_adapter *adapter)
+/* get the buffer for @correlator, read once from the current rx queue entry */
+static struct sk_buff *ibmveth_rxq_get_buffer(struct ibmveth_adapter *adapter,
+ u64 correlator)
{
- u64 correlator = adapter->rx_queue.queue_addr[adapter->rx_queue.index].correlator;
unsigned int pool = correlator >> 32;
unsigned int index = correlator & 0xffffffffUL;
+ struct sk_buff *skb;
- if (WARN_ON(pool >= IBMVETH_NUM_BUFF_POOLS) ||
- WARN_ON(index >= adapter->rx_buff_pool[pool].size)) {
- schedule_work(&adapter->work);
+ if (!ibmveth_rxq_correlator_valid(adapter, correlator))
return NULL;
- }
- return adapter->rx_buff_pool[pool].skbuff[index];
+ skb = adapter->rx_buff_pool[pool].skbuff[index];
+ if (!skb)
+ ibmveth_rxq_no_skb(adapter, correlator);
+ return skb;
+}
+
+static void ibmveth_rxq_advance(struct ibmveth_adapter *adapter)
+{
+ if (++adapter->rx_queue.index == adapter->rx_queue.num_slots) {
+ adapter->rx_queue.index = 0;
+ adapter->rx_queue.toggle = !adapter->rx_queue.toggle;
+ }
}
/**
* ibmveth_rxq_harvest_buffer - Harvest buffer from pool
*
- * @adapter: pointer to adapter
- * @reuse: whether to reuse buffer
+ * @adapter: pointer to adapter
+ * @correlator: correlator of the current rx queue entry, as read by poll
+ * @reuse: whether to reuse buffer
*
* Context: called from ibmveth_poll
*
+ * The ring advances even on error, so poll does not return to a bad
+ * slot before the scheduled reset can run.
+ *
* Return:
* * %0 - success
* * other - non-zero return from ibmveth_remove_buffer_from_pool
*/
static int ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter,
- bool reuse)
+ u64 correlator, bool reuse)
{
- u64 cor;
int rc;
- cor = adapter->rx_queue.queue_addr[adapter->rx_queue.index].correlator;
- rc = ibmveth_remove_buffer_from_pool(adapter, cor, reuse);
- if (unlikely(rc))
- return rc;
-
- if (++adapter->rx_queue.index == adapter->rx_queue.num_slots) {
- adapter->rx_queue.index = 0;
- adapter->rx_queue.toggle = !adapter->rx_queue.toggle;
- }
+ rc = ibmveth_remove_buffer_from_pool(adapter, correlator, reuse);
+ ibmveth_rxq_advance(adapter);
- return 0;
+ return rc;
}
static void ibmveth_free_tx_ltb(struct ibmveth_adapter *adapter, int idx)
@@ -628,8 +669,6 @@ static int ibmveth_open(struct net_device *netdev)
netdev_dbg(netdev, "open starting\n");
- napi_enable(&adapter->napi);
-
for(i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
rxq_entries += adapter->rx_buff_pool[i].size;
@@ -717,10 +756,19 @@ static int ibmveth_open(struct net_device *netdev)
}
}
+ /* NAPI can run as soon as it is enabled, from netpoll during the
+ * direct close()/open() pairs or from a direct ibmveth_interrupt()
+ * call, so enable it only once everything ibmveth_poll() touches
+ * exists.
+ */
+ napi_enable(&adapter->napi);
+
netdev_dbg(netdev, "registering irq 0x%x\n", netdev->irq);
rc = request_irq(netdev->irq, ibmveth_interrupt, 0, netdev->name,
netdev);
if (rc != 0) {
+ napi_disable(&adapter->napi);
+ synchronize_net();
netdev_err(netdev, "unable to request irq 0x%x, rc %d\n",
netdev->irq, rc);
goto out_free_buffer_pools;
@@ -733,6 +781,7 @@ static int ibmveth_open(struct net_device *netdev)
netif_tx_start_all_queues(netdev);
+ adapter->opened = true;
netdev_dbg(netdev, "open complete\n");
return 0;
@@ -765,7 +814,6 @@ static int ibmveth_open(struct net_device *netdev)
out_free_buffer_list:
free_page((unsigned long)adapter->buffer_list_addr);
out:
- napi_disable(&adapter->napi);
return rc;
}
@@ -776,11 +824,24 @@ static int ibmveth_close(struct net_device *netdev)
long lpar_rc;
int i;
+ /* change_mtu, pool sysfs, set_csum and set_tso call close() and
+ * open() directly. If that open() fails, IFF_UP stays set and
+ * NAPI is disabled; a second close() would hang in napi_disable().
+ */
+ if (!adapter->opened)
+ return 0;
+ adapter->opened = false;
+
netdev_dbg(netdev, "close starting\n");
napi_disable(&adapter->napi);
+ /* napi_disable() returns once ibmveth_poll() has called
+ * napi_complete_done(), but the poll still re-enables the
+ * interrupt and reads the RX queue after that.
+ */
+ synchronize_net();
- netif_tx_stop_all_queues(netdev);
+ netif_tx_disable(netdev);
h_vio_signal(adapter->vdev->unit_address, VIO_IRQ_DISABLE);
@@ -827,10 +888,10 @@ static int ibmveth_close(struct net_device *netdev)
*
* @w: pointer to work_struct embedded in adapter structure
*
- * Context: This routine acquires rtnl_mutex and disables its NAPI through
- * ibmveth_close. It can't be called directly in a context that has
- * already acquired rtnl_mutex or disabled its NAPI, or directly from
- * a poll routine.
+ * Context: This routine acquires rtnl_mutex and, if the device is open,
+ * disables its NAPI through ibmveth_close. It can't be called
+ * directly in a context that has already acquired rtnl_mutex or
+ * disabled its NAPI, or directly from a poll routine.
*
* Return: void
*/
@@ -1122,12 +1183,13 @@ static int ibmveth_set_channels(struct net_device *netdev,
struct ibmveth_adapter *adapter = netdev_priv(netdev);
unsigned int old = netdev->real_num_tx_queues,
goal = channels->tx_count;
- int rc, i;
+ int rc, i, alloc_rc = 0;
- /* If ndo_open has not been called yet then don't allocate, just set
- * desired netdev_queue's and return
+ /* If the device is not open (including a failed close/open with
+ * IFF_UP still set) then don't allocate, just set desired
+ * netdev_queue's and return
*/
- if (!(netdev->flags & IFF_UP))
+ if (!adapter->opened)
return netif_set_real_num_tx_queues(netdev, goal);
/* We have IBMVETH_MAX_QUEUES netdev_queue's allocated
@@ -1147,6 +1209,7 @@ static int ibmveth_set_channels(struct net_device *netdev,
/* if something goes wrong, free everything we just allocated */
netdev_err(netdev, "Failed to allocate more tx queues, returning to %d queues\n",
old);
+ alloc_rc = rc;
goal = old;
old = i;
break;
@@ -1157,6 +1220,8 @@ static int ibmveth_set_channels(struct net_device *netdev,
old);
goal = old;
old = i;
+ } else if (alloc_rc) {
+ rc = alloc_rc;
}
/* Free any that are no longer needed */
for (i = old; i > goal; i--) {
@@ -1331,8 +1396,12 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
}
-static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
+/* Returns false when the IP or TCP headers fail the checks; the frame is
+ * then left unchanged for the stack to check.
+ */
+static bool ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
{
+ unsigned int gso_type, ip_len;
struct tcphdr *tcph;
int offset = 0;
int hdr_len;
@@ -1341,28 +1410,41 @@ static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
if (skb->protocol == htons(ETH_P_IP)) {
struct iphdr *iph = (struct iphdr *)skb->data;
+ if (skb_headlen(skb) < sizeof(*iph) || iph->ihl < 5)
+ return false;
if (iph->protocol == IPPROTO_TCP) {
+ /* only a whole datagram has a TCP header to segment */
+ if (ip_is_fragment(iph))
+ return false;
offset = iph->ihl * 4;
- skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
+ ip_len = ntohs(iph->tot_len);
+ gso_type = SKB_GSO_TCPV4;
} else {
- return;
+ return true;
}
} else if (skb->protocol == htons(ETH_P_IPV6)) {
struct ipv6hdr *iph6 = (struct ipv6hdr *)skb->data;
+ if (skb_headlen(skb) < sizeof(*iph6))
+ return false;
if (iph6->nexthdr == IPPROTO_TCP) {
offset = sizeof(struct ipv6hdr);
- skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6;
+ ip_len = offset + ntohs(iph6->payload_len);
+ gso_type = SKB_GSO_TCPV6;
} else {
- return;
+ return true;
}
} else {
- return;
+ return true;
}
/* if mss is not set through Large Packet bit/mss in rx buffer,
* expect that the mss will be written to the tcp header checksum.
*/
tcph = (struct tcphdr *)(skb->data + offset);
+ if (skb_headlen(skb) < offset + sizeof(*tcph) || tcph->doff < 5 ||
+ ip_len > skb_headlen(skb) || ip_len <= offset + tcph->doff * 4)
+ return false;
+ skb_shinfo(skb)->gso_type = gso_type;
if (lrg_pkt) {
skb_shinfo(skb)->gso_size = mss;
} else if (offset) {
@@ -1371,11 +1453,18 @@ static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
}
if (skb_shinfo(skb)->gso_size) {
+ /* chosen by the sending partition: at least the floor
+ * virtio_net_hdr_to_skb() uses, and never GSO_BY_FRAGS
+ */
+ skb_shinfo(skb)->gso_size =
+ clamp_t(u16, skb_shinfo(skb)->gso_size,
+ TCP_MIN_GSO_SIZE, GSO_BY_FRAGS - 1);
hdr_len = offset + tcph->doff * 4;
skb_shinfo(skb)->gso_segs =
- DIV_ROUND_UP(skb->len - hdr_len,
+ DIV_ROUND_UP(ip_len - hdr_len,
skb_shinfo(skb)->gso_size);
}
+ return true;
}
static void ibmveth_rx_csum_helper(struct sk_buff *skb,
@@ -1392,6 +1481,10 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb,
if (skb_proto == ETH_P_IP) {
iph = (struct iphdr *)skb->data;
+ if (skb_headlen(skb) < sizeof(*iph) || iph->ihl < 5 ||
+ skb_headlen(skb) < iph->ihl * 4 ||
+ (iph->protocol == IPPROTO_TCP && ip_is_fragment(iph)))
+ goto bad_hdr;
/* If the IP checksum is not offloaded and if the packet
* is large send, the checksum must be rebuilt.
@@ -1406,6 +1499,8 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb,
iph_proto = iph->protocol;
} else if (skb_proto == ETH_P_IPV6) {
iph6 = (struct ipv6hdr *)skb->data;
+ if (skb_headlen(skb) < sizeof(*iph6))
+ goto bad_hdr;
iphlen = sizeof(struct ipv6hdr);
iph_proto = iph6->nexthdr;
}
@@ -1428,6 +1523,8 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb,
if (iph_proto == IPPROTO_TCP) {
struct tcphdr *tcph = (struct tcphdr *)(skb->data + iphlen);
+ if (skb_headlen(skb) < iphlen + sizeof(*tcph))
+ goto bad_hdr;
if (tcph->check == 0x0000) {
/* Recompute TCP pseudo header checksum */
tcphdrlen = skb->len - iphlen;
@@ -1445,6 +1542,13 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb,
skb_reset_network_header(skb);
}
}
+ return;
+
+bad_hdr:
+ /* headers do not fit the frame, or a fragment has no whole TCP
+ * segment; let the stack check it
+ */
+ skb->ip_summed = CHECKSUM_NONE;
}
static int ibmveth_poll(struct napi_struct *napi, int budget)
@@ -1454,31 +1558,60 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
struct net_device *netdev = adapter->netdev;
int frames_processed = 0;
unsigned long lpar_rc;
+ u64 correlator;
u16 mss = 0;
+ int rc;
-restart_poll:
while (frames_processed < budget) {
if (!ibmveth_rxq_pending_buffer(adapter))
break;
smp_rmb();
+ correlator = ibmveth_rxq_correlator(adapter);
if (!ibmveth_rxq_buffer_valid(adapter)) {
wmb(); /* suggested by larson1 */
adapter->rx_invalid_buffer++;
netdev_dbg(netdev, "recycling invalid buffer\n");
- if (unlikely(ibmveth_rxq_harvest_buffer(adapter, true)))
- break;
+ rc = ibmveth_rxq_harvest_buffer(adapter, correlator, true);
+ if (unlikely(rc)) {
+ netdev->stats.rx_dropped++;
+ frames_processed++;
+ continue;
+ }
} else {
struct sk_buff *skb, *new_skb;
int length = ibmveth_rxq_frame_length(adapter);
int offset = ibmveth_rxq_frame_offset(adapter);
int csum_good = ibmveth_rxq_csum_good(adapter);
int lrg_pkt = ibmveth_rxq_large_packet(adapter);
+ unsigned int pool, room, off, len;
__sum16 iph_check = 0;
- skb = ibmveth_rxq_get_buffer(adapter);
- if (unlikely(!skb))
- break;
+ skb = ibmveth_rxq_get_buffer(adapter, correlator);
+ if (unlikely(!skb)) {
+ ibmveth_rxq_advance(adapter);
+ netdev->stats.rx_dropped++;
+ frames_processed++;
+ continue;
+ }
+
+ pool = correlator >> 32;
+ room = min_t(unsigned int, skb_tailroom(skb),
+ adapter->rx_buff_pool[pool].buff_size);
+ off = offset;
+ len = length;
+ if (unlikely(len < ETH_HLEN || off >= room ||
+ len > room - off)) {
+ if (net_ratelimit())
+ netdev_err(netdev,
+ "bad RX frame offset %u length %u (buffer %u), dropping\n",
+ off, len, room);
+ ibmveth_rxq_harvest_buffer(adapter, correlator,
+ true);
+ netdev->stats.rx_dropped++;
+ frames_processed++;
+ continue;
+ }
/* if the large packet bit is set in the rx queue
* descriptor, the mss will be written by PHYP eight
@@ -1502,12 +1635,25 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
if (rx_flush)
ibmveth_flush_buffer(skb->data,
length + offset);
- if (unlikely(ibmveth_rxq_harvest_buffer(adapter, true)))
- break;
+ rc = ibmveth_rxq_harvest_buffer(adapter,
+ correlator,
+ true);
+ if (unlikely(rc)) {
+ dev_kfree_skb_any(new_skb);
+ netdev->stats.rx_dropped++;
+ frames_processed++;
+ continue;
+ }
skb = new_skb;
} else {
- if (unlikely(ibmveth_rxq_harvest_buffer(adapter, false)))
- break;
+ rc = ibmveth_rxq_harvest_buffer(adapter,
+ correlator,
+ false);
+ if (unlikely(rc)) {
+ netdev->stats.rx_dropped++;
+ frames_processed++;
+ continue;
+ }
skb_reserve(skb, offset);
}
@@ -1517,7 +1663,8 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
/* PHYP without PLSO support places a -1 in the ip
* checksum for large send frames.
*/
- if (skb->protocol == cpu_to_be16(ETH_P_IP)) {
+ if (skb->protocol == cpu_to_be16(ETH_P_IP) &&
+ skb_headlen(skb) >= sizeof(struct iphdr)) {
struct iphdr *iph = (struct iphdr *)skb->data;
iph_check = iph->check;
@@ -1525,7 +1672,8 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
if ((length > netdev->mtu + ETH_HLEN) ||
lrg_pkt || iph_check == 0xffff) {
- ibmveth_rx_mss_helper(skb, mss, lrg_pkt);
+ if (!ibmveth_rx_mss_helper(skb, mss, lrg_pkt))
+ csum_good = 0;
adapter->rx_large_packets++;
}
@@ -1542,7 +1690,11 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
}
}
- ibmveth_replenish_task(adapter);
+ /* netpoll polls with budget 0 for TX only, and is not serialized
+ * with a NAPI poll that was already running when it was set up
+ */
+ if (budget)
+ ibmveth_replenish_task(adapter);
if (frames_processed == budget)
goto out;
@@ -1559,10 +1711,13 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
goto out;
}
- if (ibmveth_rxq_pending_buffer(adapter) && napi_schedule(napi)) {
+ /* Mask before queueing, as ibmveth_interrupt() does: a threaded
+ * NAPI can start polling, and unmask, as soon as it is queued.
+ */
+ if (ibmveth_rxq_pending_buffer(adapter) && napi_schedule_prep(napi)) {
lpar_rc = h_vio_signal(adapter->vdev->unit_address,
VIO_IRQ_DISABLE);
- goto restart_poll;
+ __napi_schedule(napi);
}
out:
@@ -1682,14 +1837,6 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
return -EINVAL;
}
-#ifdef CONFIG_NET_POLL_CONTROLLER
-static void ibmveth_poll_controller(struct net_device *dev)
-{
- ibmveth_replenish_task(netdev_priv(dev));
- ibmveth_interrupt(dev->irq, dev);
-}
-#endif
-
/**
* ibmveth_get_desired_dma - Calculate IO memory desired by the driver
*
@@ -1791,11 +1938,42 @@ static const struct net_device_ops ibmveth_netdev_ops = {
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = ibmveth_set_mac_addr,
.ndo_features_check = ibmveth_features_check,
-#ifdef CONFIG_NET_POLL_CONTROLLER
- .ndo_poll_controller = ibmveth_poll_controller,
-#endif
};
+/**
+ * ibmveth_pool_kobj_release - Mark a pool kobject finished
+ * @kobj: kobject embedded in the pool
+ *
+ * The pool kobjects live in netdev_priv(), so the last put must wait
+ * for this before free_netdev().
+ */
+static void ibmveth_pool_kobj_release(struct kobject *kobj)
+{
+ struct ibmveth_buff_pool *pool = container_of(kobj,
+ struct ibmveth_buff_pool,
+ kobj);
+
+ complete(&pool->released);
+}
+
+/**
+ * ibmveth_put_pool_kobjs - Drop the pool kobjects and wait for release
+ * @adapter: ibmveth adapter
+ *
+ * With CONFIG_DEBUG_KOBJECT_RELEASE the cleanup, including removing the
+ * sysfs files, runs later from a work item in the kobject; wait for it
+ * so free_netdev() cannot free the pools first.
+ */
+static void ibmveth_put_pool_kobjs(struct ibmveth_adapter *adapter)
+{
+ int i;
+
+ for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
+ kobject_put(&adapter->rx_buff_pool[i].kobj);
+ for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
+ wait_for_completion(&adapter->rx_buff_pool[i].released);
+}
+
static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
{
int rc, i, mac_len;
@@ -1906,6 +2084,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
ibmveth_init_buffer_pool(&adapter->rx_buff_pool[i], i,
pool_count[i], pool_size[i],
pool_active[i]);
+ init_completion(&adapter->rx_buff_pool[i].released);
error = kobject_init_and_add(kobj, &ktype_veth_pool,
&dev->dev.kobj, "pool%d", i);
if (!error)
@@ -1917,8 +2096,7 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
if (rc) {
netdev_dbg(netdev, "failed to set number of tx queues rc=%d\n",
rc);
- free_netdev(netdev);
- return rc;
+ goto err_put_pools;
}
adapter->tx_ltb_size = PAGE_ALIGN(IBMVETH_MAX_TX_BUF_SIZE);
for (i = 0; i < IBMVETH_MAX_QUEUES; i++)
@@ -1933,25 +2111,27 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
if (rc) {
netdev_dbg(netdev, "failed to register netdev rc=%d\n", rc);
- free_netdev(netdev);
- return rc;
+ goto err_put_pools;
}
netdev_dbg(netdev, "registered\n");
return 0;
+
+err_put_pools:
+ ibmveth_put_pool_kobjs(adapter);
+ free_netdev(netdev);
+ return rc;
}
static void ibmveth_remove(struct vio_dev *dev)
{
struct net_device *netdev = dev_get_drvdata(&dev->dev);
struct ibmveth_adapter *adapter = netdev_priv(netdev);
- int i;
- cancel_work_sync(&adapter->work);
+ disable_work_sync(&adapter->work);
- for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
- kobject_put(&adapter->rx_buff_pool[i].kobj);
+ ibmveth_put_pool_kobjs(adapter);
unregister_netdev(netdev);
@@ -2127,7 +2307,7 @@ static const struct sysfs_ops veth_pool_ops = {
};
static struct kobj_type ktype_veth_pool = {
- .release = NULL,
+ .release = ibmveth_pool_kobj_release,
.sysfs_ops = &veth_pool_ops,
.default_groups = veth_pool_groups,
};
@@ -2198,8 +2378,7 @@ static void ibmveth_reset_kunit(struct work_struct *w)
* @test: pointer to kunit structure
*
* Tests the error returns from ibmveth_remove_buffer_from_pool.
- * ibmveth_remove_buffer_from_pool also calls WARN_ON, so dmesg should be
- * checked to see that these warnings happened.
+ * Each error also logs a ratelimited netdev_err.
*
* Return: void
*/
@@ -2208,6 +2387,7 @@ static void ibmveth_remove_buffer_from_pool_test(struct kunit *test)
struct ibmveth_adapter *adapter = kunit_kzalloc(test, sizeof(*adapter), GFP_KERNEL);
struct ibmveth_buff_pool *pool;
u64 correlator;
+ int ret;
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adapter);
@@ -2231,6 +2411,13 @@ static void ibmveth_remove_buffer_from_pool_test(struct kunit *test)
KUNIT_EXPECT_EQ(test, -EINVAL, ibmveth_remove_buffer_from_pool(adapter, correlator, false));
KUNIT_EXPECT_EQ(test, -EINVAL, ibmveth_remove_buffer_from_pool(adapter, correlator, true));
+ /* Pool 2 is in range but has no skbuff array, like an inactive pool. */
+ correlator = ((u64)2 << 32) | 0;
+ ret = ibmveth_remove_buffer_from_pool(adapter, correlator, false);
+ KUNIT_EXPECT_EQ(test, -EINVAL, ret);
+ ret = ibmveth_remove_buffer_from_pool(adapter, correlator, true);
+ KUNIT_EXPECT_EQ(test, -EINVAL, ret);
+
correlator = (u64)0 | 0;
pool->skbuff[0] = NULL;
KUNIT_EXPECT_EQ(test, -EFAULT, ibmveth_remove_buffer_from_pool(adapter, correlator, false));
@@ -2243,9 +2430,8 @@ static void ibmveth_remove_buffer_from_pool_test(struct kunit *test)
* ibmveth_rxq_get_buffer_test - unit test for ibmveth_rxq_get_buffer
* @test: pointer to kunit structure
*
- * Tests ibmveth_rxq_get_buffer. ibmveth_rxq_get_buffer also calls WARN_ON for
- * the NULL returns, so dmesg should be checked to see that these warnings
- * happened.
+ * Tests ibmveth_rxq_get_buffer. Each NULL return also logs a ratelimited
+ * netdev_err.
*
* Return: void
*/
@@ -2254,6 +2440,7 @@ static void ibmveth_rxq_get_buffer_test(struct kunit *test)
struct ibmveth_adapter *adapter = kunit_kzalloc(test, sizeof(*adapter), GFP_KERNEL);
struct sk_buff *skb = kunit_kzalloc(test, sizeof(*skb), GFP_KERNEL);
struct ibmveth_buff_pool *pool;
+ u64 cor;
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adapter);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, skb);
@@ -2277,21 +2464,299 @@ static void ibmveth_rxq_get_buffer_test(struct kunit *test)
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pool->skbuff);
adapter->rx_queue.queue_addr[0].correlator = (u64)IBMVETH_NUM_BUFF_POOLS << 32 | 0;
- KUNIT_EXPECT_PTR_EQ(test, NULL, ibmveth_rxq_get_buffer(adapter));
+ cor = ibmveth_rxq_correlator(adapter);
+ KUNIT_EXPECT_PTR_EQ(test, NULL,
+ ibmveth_rxq_get_buffer(adapter, cor));
adapter->rx_queue.queue_addr[0].correlator = (u64)0 << 32 | adapter->rx_buff_pool[0].size;
- KUNIT_EXPECT_PTR_EQ(test, NULL, ibmveth_rxq_get_buffer(adapter));
+ cor = ibmveth_rxq_correlator(adapter);
+ KUNIT_EXPECT_PTR_EQ(test, NULL,
+ ibmveth_rxq_get_buffer(adapter, cor));
+
+ /* Pool 2 is in range but has no skbuff array, like an inactive pool. */
+ adapter->rx_queue.queue_addr[0].correlator = (u64)2 << 32 | 0;
+ cor = ibmveth_rxq_correlator(adapter);
+ KUNIT_EXPECT_PTR_EQ(test, NULL,
+ ibmveth_rxq_get_buffer(adapter, cor));
pool->skbuff[0] = skb;
adapter->rx_queue.queue_addr[0].correlator = (u64)0 << 32 | 0;
- KUNIT_EXPECT_PTR_EQ(test, skb, ibmveth_rxq_get_buffer(adapter));
+ cor = ibmveth_rxq_correlator(adapter);
+ KUNIT_EXPECT_PTR_EQ(test, skb,
+ ibmveth_rxq_get_buffer(adapter, cor));
flush_work(&adapter->work);
}
+/**
+ * ibmveth_rxq_harvest_buffer_test - unit test for ibmveth_rxq_harvest_buffer
+ * @test: pointer to kunit structure
+ *
+ * A bad correlator must still advance the RX ring, wrapping and flipping
+ * the toggle at the end. This covers the harvest path; the advance after
+ * ibmveth_rxq_get_buffer() fails in ibmveth_poll() is not tested here.
+ *
+ * Return: void
+ */
+static void ibmveth_rxq_harvest_buffer_test(struct kunit *test)
+{
+ struct ibmveth_adapter *adapter;
+ struct ibmveth_buff_pool *pool;
+ u64 cor;
+ int ret;
+
+ adapter = kunit_kzalloc(test, sizeof(*adapter), GFP_KERNEL);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adapter);
+
+ INIT_WORK(&adapter->work, ibmveth_reset_kunit);
+
+ adapter->rx_queue.num_slots = 2;
+ adapter->rx_queue.index = 0;
+ adapter->rx_queue.toggle = 1;
+ adapter->rx_queue.queue_addr =
+ kunit_kcalloc(test, 2, sizeof(struct ibmveth_rx_q_entry),
+ GFP_KERNEL);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adapter->rx_queue.queue_addr);
+
+ /* Set sane values for buffer pools */
+ for (int i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
+ ibmveth_init_buffer_pool(&adapter->rx_buff_pool[i], i,
+ pool_count[i], pool_size[i],
+ pool_active[i]);
+
+ pool = &adapter->rx_buff_pool[0];
+ pool->skbuff = kunit_kcalloc(test, pool->size, sizeof(void *),
+ GFP_KERNEL);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pool->skbuff);
+
+ /* Slot 0: pool out of range. Slot 1: valid, but no skb. */
+ adapter->rx_queue.queue_addr[0].correlator =
+ (u64)IBMVETH_NUM_BUFF_POOLS << 32 | 0;
+ adapter->rx_queue.queue_addr[1].correlator = (u64)0 << 32 | 0;
+
+ cor = ibmveth_rxq_correlator(adapter);
+ ret = ibmveth_rxq_harvest_buffer(adapter, cor, true);
+ KUNIT_EXPECT_EQ(test, -EINVAL, ret);
+ KUNIT_EXPECT_EQ(test, 1ULL, adapter->rx_queue.index);
+ KUNIT_EXPECT_EQ(test, 1ULL, adapter->rx_queue.toggle);
+
+ cor = ibmveth_rxq_correlator(adapter);
+ ret = ibmveth_rxq_harvest_buffer(adapter, cor, true);
+ KUNIT_EXPECT_EQ(test, -EFAULT, ret);
+ KUNIT_EXPECT_EQ(test, 0ULL, adapter->rx_queue.index);
+ KUNIT_EXPECT_EQ(test, 0ULL, adapter->rx_queue.toggle);
+
+ flush_work(&adapter->work);
+}
+
+KUNIT_DEFINE_ACTION_WRAPPER(ibmveth_kfree_skb, kfree_skb, struct sk_buff *);
+
+/* A TCP frame after eth_type_trans(): IP header, 20 byte TCP header and
+ * payload bytes of data, with the IP length matching the frame.
+ */
+static struct sk_buff *ibmveth_test_tcp_skb(struct kunit *test, bool ipv6,
+ unsigned int payload)
+{
+ unsigned int iplen = ipv6 ? sizeof(struct ipv6hdr) : sizeof(struct iphdr);
+ unsigned int len = iplen + sizeof(struct tcphdr) + payload;
+ struct sk_buff *skb = alloc_skb(len, GFP_KERNEL);
+ struct tcphdr *tcph;
+
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, skb);
+ KUNIT_ASSERT_EQ(test, 0, kunit_add_action_or_reset(test,
+ ibmveth_kfree_skb,
+ skb));
+ skb_put_zero(skb, len);
+ if (ipv6) {
+ struct ipv6hdr *iph6 = (struct ipv6hdr *)skb->data;
+
+ skb->protocol = htons(ETH_P_IPV6);
+ iph6->version = 6;
+ iph6->nexthdr = IPPROTO_TCP;
+ iph6->payload_len = htons(len - iplen);
+ } else {
+ struct iphdr *iph = (struct iphdr *)skb->data;
+
+ skb->protocol = htons(ETH_P_IP);
+ iph->version = 4;
+ iph->ihl = 5;
+ iph->protocol = IPPROTO_TCP;
+ iph->tot_len = htons(len);
+ }
+ tcph = (struct tcphdr *)(skb->data + iplen);
+ tcph->doff = 5;
+ return skb;
+}
+
+/**
+ * ibmveth_rx_mss_helper_test - unit test for ibmveth_rx_mss_helper
+ * @test: pointer to kunit structure
+ *
+ * Large send frames get gso_size from the descriptor or the TCP checksum
+ * field, clamped, and gso_segs from the IP length. Frames whose headers
+ * do not fit, with no TCP payload within the IP length, or that are
+ * IPv4 fragments, are refused and left without GSO.
+ *
+ * Return: void
+ */
+static void ibmveth_rx_mss_helper_test(struct kunit *test)
+{
+ struct sk_buff *skb;
+ struct tcphdr *tcph;
+ struct iphdr *iph;
+
+ skb = ibmveth_test_tcp_skb(test, false, 2896);
+ tcph = (struct tcphdr *)(skb->data + sizeof(*iph));
+ tcph->check = (__force __sum16)htons(1448);
+ KUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, 0, 0));
+ KUNIT_EXPECT_EQ(test, SKB_GSO_TCPV4, skb_shinfo(skb)->gso_type);
+ KUNIT_EXPECT_EQ(test, 1448, skb_shinfo(skb)->gso_size);
+ KUNIT_EXPECT_EQ(test, 2, skb_shinfo(skb)->gso_segs);
+ KUNIT_EXPECT_EQ(test, 0, (__force u16)tcph->check);
+
+ skb = ibmveth_test_tcp_skb(test, false, 2896);
+ KUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, 1000, 1));
+ KUNIT_EXPECT_EQ(test, 1000, skb_shinfo(skb)->gso_size);
+ KUNIT_EXPECT_EQ(test, 3, skb_shinfo(skb)->gso_segs);
+
+ skb = ibmveth_test_tcp_skb(test, true, 2896);
+ tcph = (struct tcphdr *)(skb->data + sizeof(struct ipv6hdr));
+ tcph->check = (__force __sum16)htons(1448);
+ KUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, 0, 0));
+ KUNIT_EXPECT_EQ(test, SKB_GSO_TCPV6, skb_shinfo(skb)->gso_type);
+ KUNIT_EXPECT_EQ(test, 1448, skb_shinfo(skb)->gso_size);
+ KUNIT_EXPECT_EQ(test, 2, skb_shinfo(skb)->gso_segs);
+
+ skb = ibmveth_test_tcp_skb(test, false, 2896);
+ KUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, 1, 1));
+ KUNIT_EXPECT_EQ(test, TCP_MIN_GSO_SIZE, skb_shinfo(skb)->gso_size);
+
+ skb = ibmveth_test_tcp_skb(test, false, 2896);
+ KUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, GSO_BY_FRAGS, 1));
+ KUNIT_EXPECT_EQ(test, GSO_BY_FRAGS - 1, skb_shinfo(skb)->gso_size);
+
+ /* refused: ihl 0, doff 4, IP length past the frame. With ihl 0 the
+ * TCP header would overlap the IP header; saddr makes its doff 5.
+ */
+ skb = ibmveth_test_tcp_skb(test, false, 2896);
+ ((struct iphdr *)skb->data)->ihl = 0;
+ ((struct iphdr *)skb->data)->saddr = htonl(0x50000000);
+ KUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 1448, 1));
+ KUNIT_EXPECT_EQ(test, 0, skb_shinfo(skb)->gso_size);
+
+ skb = ibmveth_test_tcp_skb(test, false, 2896);
+ ((struct tcphdr *)(skb->data + sizeof(*iph)))->doff = 4;
+ KUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 1448, 1));
+
+ skb = ibmveth_test_tcp_skb(test, false, 2896);
+ ((struct iphdr *)skb->data)->tot_len = htons(skb->len + 1);
+ KUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 1448, 1));
+
+ /* refused: a fragment past the first, its payload left alone */
+ skb = ibmveth_test_tcp_skb(test, false, 2896);
+ ((struct iphdr *)skb->data)->frag_off = htons(185);
+ tcph = (struct tcphdr *)(skb->data + sizeof(*iph));
+ tcph->check = (__force __sum16)htons(1448);
+ KUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 0, 0));
+ KUNIT_EXPECT_EQ(test, 0, skb_shinfo(skb)->gso_size);
+ KUNIT_EXPECT_EQ(test, 1448, ntohs((__force __be16)tcph->check));
+
+ /* refused: only Ethernet padding past the TCP header */
+ skb = ibmveth_test_tcp_skb(test, false, 6);
+ ((struct iphdr *)skb->data)->tot_len = htons(40);
+ KUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 1448, 1));
+ KUNIT_EXPECT_EQ(test, 0, skb_shinfo(skb)->gso_size);
+
+ skb = ibmveth_test_tcp_skb(test, true, 2896);
+ ((struct ipv6hdr *)skb->data)->payload_len = 0;
+ KUNIT_EXPECT_FALSE(test, ibmveth_rx_mss_helper(skb, 1448, 1));
+
+ /* not TCP: accepted and left alone */
+ skb = ibmveth_test_tcp_skb(test, false, 2896);
+ ((struct iphdr *)skb->data)->protocol = IPPROTO_UDP;
+ KUNIT_EXPECT_TRUE(test, ibmveth_rx_mss_helper(skb, 1448, 1));
+ KUNIT_EXPECT_EQ(test, 0, skb_shinfo(skb)->gso_size);
+}
+
+/**
+ * ibmveth_rx_csum_helper_test - unit test for ibmveth_rx_csum_helper
+ * @test: pointer to kunit structure
+ *
+ * A large send IPv4 header checksum of 0xffff is rebuilt. Headers that
+ * do not fit the frame, an IPv4 ihl below 5, or a TCP fragment, clear
+ * CHECKSUM_UNNECESSARY instead of being read.
+ *
+ * Return: void
+ */
+static void ibmveth_rx_csum_helper_test(struct kunit *test)
+{
+ struct sk_buff *skb;
+ struct iphdr *iph;
+
+ skb = ibmveth_test_tcp_skb(test, false, 100);
+ iph = (struct iphdr *)skb->data;
+ iph->check = (__force __sum16)0xffff;
+ ((struct tcphdr *)(skb->data + sizeof(*iph)))->check = (__force __sum16)htons(1);
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+ ibmveth_rx_csum_helper(skb, NULL);
+ KUNIT_EXPECT_EQ(test, 0,
+ (__force u16)ip_fast_csum((unsigned char *)iph, iph->ihl));
+ KUNIT_EXPECT_EQ(test, CHECKSUM_UNNECESSARY, (int)skb->ip_summed);
+
+ skb = ibmveth_test_tcp_skb(test, false, 100);
+ iph = (struct iphdr *)skb->data;
+ iph->ihl = 0;
+ iph->check = (__force __sum16)0xffff;
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+ ibmveth_rx_csum_helper(skb, NULL);
+ KUNIT_EXPECT_EQ(test, CHECKSUM_NONE, (int)skb->ip_summed);
+ KUNIT_EXPECT_EQ(test, 0xffff, (__force u16)iph->check);
+
+ /* IPv4 options past the frame; UDP, so no TCP check follows */
+ skb = ibmveth_test_tcp_skb(test, false, 0);
+ iph = (struct iphdr *)skb->data;
+ iph->protocol = IPPROTO_UDP;
+ iph->ihl = 15;
+ iph->check = (__force __sum16)0xffff;
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+ ibmveth_rx_csum_helper(skb, NULL);
+ KUNIT_EXPECT_EQ(test, CHECKSUM_NONE, (int)skb->ip_summed);
+
+ /* a TCP fragment past the first: header and payload left alone */
+ skb = ibmveth_test_tcp_skb(test, false, 100);
+ iph = (struct iphdr *)skb->data;
+ iph->frag_off = htons(185);
+ iph->check = (__force __sum16)0xffff;
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+ ibmveth_rx_csum_helper(skb, NULL);
+ KUNIT_EXPECT_EQ(test, CHECKSUM_NONE, (int)skb->ip_summed);
+ KUNIT_EXPECT_EQ(test, 0xffff, (__force u16)iph->check);
+ KUNIT_EXPECT_EQ(test, 0,
+ (__force u16)((struct tcphdr *)(skb->data +
+ sizeof(*iph)))->check);
+
+ /* TCP header past the frame */
+ skb = ibmveth_test_tcp_skb(test, false, 0);
+ skb_trim(skb, sizeof(struct iphdr));
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+ ibmveth_rx_csum_helper(skb, NULL);
+ KUNIT_EXPECT_EQ(test, CHECKSUM_NONE, (int)skb->ip_summed);
+
+ /* IPv6 header past the frame; UDP, so no TCP check follows */
+ skb = ibmveth_test_tcp_skb(test, true, 0);
+ ((struct ipv6hdr *)skb->data)->nexthdr = IPPROTO_UDP;
+ skb_trim(skb, sizeof(struct ipv6hdr) - 1);
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+ ibmveth_rx_csum_helper(skb, NULL);
+ KUNIT_EXPECT_EQ(test, CHECKSUM_NONE, (int)skb->ip_summed);
+}
+
static struct kunit_case ibmveth_test_cases[] = {
KUNIT_CASE(ibmveth_remove_buffer_from_pool_test),
KUNIT_CASE(ibmveth_rxq_get_buffer_test),
+ KUNIT_CASE(ibmveth_rxq_harvest_buffer_test),
+ KUNIT_CASE(ibmveth_rx_mss_helper_test),
+ KUNIT_CASE(ibmveth_rx_csum_helper_test),
{}
};
diff --git a/drivers/net/ethernet/ibm/ibmveth.h b/drivers/net/ethernet/ibm/ibmveth.h
index d87713668ed30..be0939caa328e 100644
--- a/drivers/net/ethernet/ibm/ibmveth.h
+++ b/drivers/net/ethernet/ibm/ibmveth.h
@@ -14,6 +14,8 @@
#ifndef _IBMVETH_H
#define _IBMVETH_H
+#include <linux/completion.h>
+
/* constants for H_MULTICAST_CTRL */
#define IbmVethMcastReceptionModifyBit 0x80000UL
#define IbmVethMcastReceptionEnableBit 0x20000UL
@@ -143,6 +145,7 @@ struct ibmveth_buff_pool {
struct sk_buff **skbuff;
int active;
struct kobject kobj;
+ struct completion released;
};
struct ibmveth_rx_q {
@@ -172,6 +175,8 @@ struct ibmveth_adapter {
int rx_csum;
int large_send;
bool is_active_trunk;
+ /* Set by a successful ibmveth_open(), cleared by ibmveth_close(). */
+ bool opened;
unsigned int rx_buffers_per_hcall;
u64 fw_ipv6_csum_support;
|
| 3/2 | 2026/10/12 05:19 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 17974 output: 34 thoughts: 127 Thoughts: **Analyzing this Linux Kernel Patch** Okay, so the user wants me to evaluate this patch series for the Linux kernel. First things first, I need to understand exactly what this code is doing and what it's impacting. I'll get the lay of the land, the what and the where. Alright, the diff shows changes to `drivers/net/ethernet/ibm/ibmveth.c` and `drivers/net/ethernet/ibm/ibmveth.h`. The target architecture seems to be amd64. Hold on a second... what exactly *is* `ibmveth`? Ah, right, IBM Virtual Ethernet! Specifically, it's the adapter for IBM pSeries / PowerPC LPARs (PHYP). Need to refresh my memory on the configuration options for that, so let me take a quick look at the relevant Kconfig file. |
| 4/2 | 2026/10/12 05:20 | tool | grepper |
0mArgs:{
"Expression": "config IBMVETH",
"PathPrefixes": [
"drivers/net/ethernet/ibm/"
]
}Results: {
"Output": "drivers/net/ethernet/ibm/Kconfig=18=if NET_VENDOR_IBM\ndrivers/net/ethernet/ibm/Kconfig-19-\ndrivers/net/ethernet/ibm/Kconfig:20:config IBMVETH\ndrivers/net/ethernet/ibm/Kconfig-21-\ttristate \"IBM LAN Virtual Ethernet support\"\n--\ndrivers/net/ethernet/ibm/Kconfig-29-\ndrivers/net/ethernet/ibm/Kconfig:30:config IBMVETH_KUNIT_TEST\ndrivers/net/ethernet/ibm/Kconfig-31-\tbool \"KUnit test for IBM LAN Virtual Ethernet support\" if !KUNIT_ALL_TESTS\n"
} |
| 5/2 | 2026/10/12 05:20 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 18498 output: 38 thoughts: 26 Thoughts: Here's a summary of my thought process, as requested: **Kconfig Inspection for IBM Ethernet Drivers** Okay, let's dive into this. My initial thought is to examine the `drivers/net/ethernet/ibm/Kconfig` file. I need to understand what's configured, specifically around line 20. My experience tells me that Kconfig files often define the configuration options related to a specific driver or subsystem within the Linux kernel. I'm assuming that line 20 likely holds a crucial piece of the puzzle regarding the IBM Ethernet driver, maybe the introduction of a new option, the conditional inclusion of code, or a description of its dependencies. This is where the core logic usually sits, the heart of how this driver is controlled and built. I'm going in with that expectation. I'm curious to see what it's defining. |
| 6/2 | 2026/10/12 05:20 | tool | read-file |
0mArgs:{
"File": "drivers/net/ethernet/ibm/Kconfig",
"FirstLine": 15,
"LineCount": 35
}Results: {
"Contents": " 15:\t\t the questions about IBM devices. If you say Y, you will be asked for\n 16:\t\t your specific card in the following questions.\n 17:\t\n 18:\tif NET_VENDOR_IBM\n 19:\t\n 20:\tconfig IBMVETH\n 21:\t\ttristate \"IBM LAN Virtual Ethernet support\"\n 22:\t\tdepends on PPC_PSERIES\n 23:\t\thelp\n 24:\t\t This driver supports virtual ethernet adapters on newer IBM iSeries\n 25:\t\t and pSeries systems.\n 26:\t\n 27:\t\t To compile this driver as a module, choose M here. The module will\n 28:\t\t be called ibmveth.\n 29:\t\n 30:\tconfig IBMVETH_KUNIT_TEST\n 31:\t\tbool \"KUnit test for IBM LAN Virtual Ethernet support\" if !KUNIT_ALL_TESTS\n 32:\t\tdepends on KUNIT\n 33:\t\tdepends on KUNIT=y \u0026\u0026 IBMVETH=y\n 34:\t\tdefault KUNIT_ALL_TESTS\n 35:\t\thelp\n 36:\t\t This builds unit tests for the IBM LAN Virtual Ethernet driver.\n 37:\t\n 38:\t\t For more information on KUnit and unit tests in general, please refer\n 39:\t\t to the KUnit documentation in Documentation/dev-tools/kunit/.\n 40:\t\n 41:\t\t If unsure, say N.\n 42:\t\n 43:\tsource \"drivers/net/ethernet/ibm/emac/Kconfig\"\n 44:\t\n 45:\tconfig IBMVNIC\n 46:\t\ttristate \"IBM Virtual NIC support\"\n 47:\t\tdepends on PPC_PSERIES\n 48:\t\thelp\n 49:\t\t This driver supports Virtual NIC adapters on IBM i and IBM System p\n"
} |
| 7/2 | 2026/10/12 05:20 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19220 output: 20 thoughts: 79 Thoughts: Here's my analysis: **Investigating IBMVETH Compatibility** Okay, I'm looking at this `config IBMVETH` option and the `depends on PPC_PSERIES` line. Immediately, my mind jumps to a question: is this IBM LAN Virtual Ethernet support strictly for PowerPC pSeries systems, or is there a possibility of compiling it on amd64 as well? The dependency condition here raises a red flag; I need to confirm its limitations. My gut feeling is that it's probably *only* for PowerPC systems, but I have to be thorough. My next step is to examine the `PPC_PSERIES` configuration option, likely found in `arch/powerpc/Kconfig`, to understand its precise meaning and influence on the `IBMVETH` compilation. That dependency will tell me if I need to look for an alternative or if this is the only way to enable the feature. This investigation will clarify the scope of `IBMVETH`'s platform support. |
| 8/2 | 2026/10/12 05:20 | tool | grepper |
0mArgs:{
"Expression": "config PPC_PSERIES"
}Results: {
"Output": "arch/powerpc/platforms/pseries/Kconfig-1-# SPDX-License-Identifier: GPL-2.0\narch/powerpc/platforms/pseries/Kconfig:2:config PPC_PSERIES\narch/powerpc/platforms/pseries/Kconfig-3-\tdepends on PPC64 \u0026\u0026 PPC_BOOK3S\n--\narch/powerpc/platforms/pseries/Kconfig=92=config LPARCFG\n--\narch/powerpc/platforms/pseries/Kconfig-98-\narch/powerpc/platforms/pseries/Kconfig:99:config PPC_PSERIES_DEBUG\narch/powerpc/platforms/pseries/Kconfig-100-\tdepends on PPC_PSERIES \u0026\u0026 PPC_EARLY_DEBUG\n"
} |
| 9/2 | 2026/10/12 05:20 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 19721 output: 34 thoughts: 119 Thoughts: **Investigating PPC_PSERIES Dependency Concerns** Okay, so `PPC_PSERIES` is contingent on `PPC64 && PPC_BOOK3S`. That's straightforward; it's explicitly not for amd64, which is expected. But, I need to consider all angles. What about `COMPILE_TEST`? Could there be any indirect linkage? Let's quickly check how `IBMVETH` is set up. Does it rely solely on `PPC_PSERIES`, or does it offer a fallback through `COMPILE_TEST`? Scanning the `IBMVETH` code⦠line 22, ah-ha, confirms `depends on PPC_PSERIES` *only*. So, no `COMPILE_TEST` dependency there, which is what I suspected. Just to be absolutely sure, it's worth cross-referencing with the `drivers/net/ethernet/ibm/Makefile` and quickly double check if there is an override. |
| 10/2 | 2026/10/12 05:20 | tool | grepper |
0mArgs:{
"Expression": "IBMVETH",
"PathPrefixes": [
"drivers/net/ethernet/ibm/Makefile"
]
}Results: {
"Output": "drivers/net/ethernet/ibm/Makefile-5-\ndrivers/net/ethernet/ibm/Makefile:6:obj-$(CONFIG_IBMVETH) += ibmveth.o\ndrivers/net/ethernet/ibm/Makefile-7-obj-$(CONFIG_IBMVNIC) += ibmvnic.o\n"
} |
| 11/2 | 2026/10/12 05:20 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20169 output: 19 thoughts: 122 Thoughts: **Investigating IBMVETH on amd64** Alright, let's dive into this `IBMVETH` situation. My initial thought is to confirm whether or not this feature can even be enabled on an amd64 architecture. I'll start by checking the relevant `Kconfig` file. Ah, here it is: ``` config IBMVETH tristate "IBM LAN Virtual Ethernet support" depends on PPC_PSERIES ``` Okay, so `IBMVETH` is tristate and *depends* on `PPC_PSERIES`. That's the key. Now the question is, can `PPC_PSERIES` be enabled on amd64? I'll need to figure out the architectural dependencies for `PPC_PSERIES`. Let's see... looking at the code, it seems the `arch/powerpc/platforms/pseries/Kconfig` file is *only* sourced from `arch/powerpc/Kconfig`. That implies that `PPC_PSERIES` is exclusively tied to the PowerPC architecture, not amd64. Therefore, `IBMVETH` is not likely available on amd64, since `PPC_PSERIES` is its dependency. |
| 12/2 | 2026/10/12 05:20 | tool | grepper |
0mArgs:{
"Expression": "pseries/Kconfig"
}Results: {
"Output": "arch/powerpc/platforms/Kconfig=4=source \"arch/powerpc/platforms/powernv/Kconfig\"\narch/powerpc/platforms/Kconfig:5:source \"arch/powerpc/platforms/pseries/Kconfig\"\narch/powerpc/platforms/Kconfig-6-source \"arch/powerpc/platforms/chrp/Kconfig\"\n"
} |
| 13/2 | 2026/10/12 05:20 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 20674 output: 32 thoughts: 347 Thoughts: **Analyzing the Potential for WorthFuzzing on ibmveth Driver** Okay, so the configuration file `arch/powerpc/platforms/Kconfig` is only relevant within the `arch/powerpc` directory, which is already a red flag. Specifically, `PPC_PSERIES` is *impossible* to enable on amd64, which is the target architecture based on the prompt. Now, let's consider the negative criteria for `WorthFuzzing`. The rule that's catching my attention is "Code paths exclusive to architectures other than the target architecture." Bingo. The `ibmveth` driver fundamentally relies on `PPC_PSERIES`, a PowerPC-specific config, whereas the target is amd64. Even if it *could* be compiled, the driver leverages hypervisor calls to IBM PHYP, like `h_vio_signal`, and relies on the IBM VIO bus with a `struct vio_dev`. The question becomes: do either of those exist or function meaningfully on an amd64 system? I doubt it, but I need to confirm the definitions. Time to check the `vio_dev` definition. Based on this, I'm leaning heavily towards returning `WorthFuzzing=false`. |
| 14/2 | 2026/10/12 05:20 | tool | grepper |
0mArgs:{
"Expression": "struct vio_dev",
"PathPrefixes": [
"arch/",
"include/"
]
}Results: {
"Output": "\nFull output is too long, showing 200 out of 416 lines.\nUse more precise expression or PathPrefixes if possible.\n\nNumber of matching lines per file (7 files in total):\narch/powerpc/include/asm/vio.h:16\narch/powerpc/platforms/pseries/vio.c:52\narch/sparc/include/asm/vio.h:9\narch/sparc/kernel/ds.c:2\narch/sparc/kernel/vio.c:19\narch/sparc/kernel/viohs.c:1\ninclude/linux/device-id/vio.h:1\n\narch/powerpc/include/asm/vio.h=83=enum vio_dev_family {\n--\narch/powerpc/include/asm/vio.h-95- */\narch/powerpc/include/asm/vio.h:96:struct vio_dev {\narch/powerpc/include/asm/vio.h-97-\tconst char *name;\n--\narch/powerpc/include/asm/vio.h=112=struct vio_driver {\narch/powerpc/include/asm/vio.h-113-\tconst char *name;\narch/powerpc/include/asm/vio.h:114:\tconst struct vio_device_id *id_table;\narch/powerpc/include/asm/vio.h:115:\tint (*probe)(struct vio_dev *dev, const struct vio_device_id *id);\narch/powerpc/include/asm/vio.h:116:\tvoid (*remove)(struct vio_dev *dev);\narch/powerpc/include/asm/vio.h:117:\tvoid (*shutdown)(struct vio_dev *dev);\narch/powerpc/include/asm/vio.h-118-\t/* A driver must have a get_desired_dma() function to\n--\narch/powerpc/include/asm/vio.h-120-\t */\narch/powerpc/include/asm/vio.h:121:\tunsigned long (*get_desired_dma)(struct vio_dev *dev);\narch/powerpc/include/asm/vio.h-122-\tconst struct dev_pm_ops *pm;\n--\narch/powerpc/include/asm/vio.h=135=extern int vio_cmo_entitlement_update(size_t);\narch/powerpc/include/asm/vio.h:136:extern void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired);\narch/powerpc/include/asm/vio.h-137-\narch/powerpc/include/asm/vio.h:138:extern void vio_unregister_device(struct vio_dev *dev);\narch/powerpc/include/asm/vio.h-139-\narch/powerpc/include/asm/vio.h:140:extern int vio_h_cop_sync(struct vio_dev *vdev, struct vio_pfo_op *op);\narch/powerpc/include/asm/vio.h-141-\narch/powerpc/include/asm/vio.h=142=struct device_node;\narch/powerpc/include/asm/vio.h-143-\narch/powerpc/include/asm/vio.h:144:extern struct vio_dev *vio_register_device_node(\narch/powerpc/include/asm/vio.h-145-\t\tstruct device_node *node_vdev);\narch/powerpc/include/asm/vio.h:146:extern const void *vio_get_attribute(struct vio_dev *vdev, char *which,\narch/powerpc/include/asm/vio.h-147-\t\tint *length);\narch/powerpc/include/asm/vio.h-148-#ifdef CONFIG_PPC_PSERIES\narch/powerpc/include/asm/vio.h:149:extern struct vio_dev *vio_find_node(struct device_node *vnode);\narch/powerpc/include/asm/vio.h:150:extern int vio_enable_interrupts(struct vio_dev *dev);\narch/powerpc/include/asm/vio.h:151:extern int vio_disable_interrupts(struct vio_dev *dev);\narch/powerpc/include/asm/vio.h-152-#else\narch/powerpc/include/asm/vio.h:153:static inline int vio_enable_interrupts(struct vio_dev *dev)\narch/powerpc/include/asm/vio.h-154-{\n--\narch/powerpc/include/asm/vio.h-159-#define to_vio_driver(__drv)\tcontainer_of_const(__drv, struct vio_driver, driver)\narch/powerpc/include/asm/vio.h:160:#define to_vio_dev(__dev)\tcontainer_of_const(__dev, struct vio_dev, dev)\narch/powerpc/include/asm/vio.h-161-\n--\narch/powerpc/platforms/pseries/vio.c-38-\narch/powerpc/platforms/pseries/vio.c:39:static struct vio_dev vio_bus_device = { /* fake \"parent\" device */\narch/powerpc/platforms/pseries/vio.c-40-\t.name = \"vio\",\n--\narch/powerpc/platforms/pseries/vio.c=53=struct vio_cmo_pool {\n--\narch/powerpc/platforms/pseries/vio.c-66- *\narch/powerpc/platforms/pseries/vio.c:67: * @vio_dev: struct vio_dev pointer\narch/powerpc/platforms/pseries/vio.c-68- * @list: pointer to other devices on bus that are being tracked\n--\narch/powerpc/platforms/pseries/vio.c=70=struct vio_cmo_dev_entry {\narch/powerpc/platforms/pseries/vio.c:71:\tstruct vio_dev *viodev;\narch/powerpc/platforms/pseries/vio.c-72-\tstruct list_head list;\n--\narch/powerpc/platforms/pseries/vio.c=107=static int vio_cmo_num_OF_devs(void)\n--\narch/powerpc/platforms/pseries/vio.c-145- */\narch/powerpc/platforms/pseries/vio.c:146:static inline int vio_cmo_alloc(struct vio_dev *viodev, size_t size)\narch/powerpc/platforms/pseries/vio.c-147-{\n--\narch/powerpc/platforms/pseries/vio.c-189- */\narch/powerpc/platforms/pseries/vio.c:190:static inline void vio_cmo_dealloc(struct vio_dev *viodev, size_t size)\narch/powerpc/platforms/pseries/vio.c-191-{\n--\narch/powerpc/platforms/pseries/vio.c=279=int vio_cmo_entitlement_update(size_t new_entitlement)\narch/powerpc/platforms/pseries/vio.c-280-{\narch/powerpc/platforms/pseries/vio.c:281:\tstruct vio_dev *viodev;\narch/powerpc/platforms/pseries/vio.c-282-\tstruct vio_cmo_dev_entry *dev_ent;\n--\narch/powerpc/platforms/pseries/vio.c=387=static void vio_cmo_balance(struct work_struct *work)\n--\narch/powerpc/platforms/pseries/vio.c-389-\tstruct vio_cmo *cmo;\narch/powerpc/platforms/pseries/vio.c:390:\tstruct vio_dev *viodev;\narch/powerpc/platforms/pseries/vio.c-391-\tstruct vio_cmo_dev_entry *dev_ent;\n--\narch/powerpc/platforms/pseries/vio.c=483=static void *vio_dma_iommu_alloc_coherent(struct device *dev, size_t size,\n--\narch/powerpc/platforms/pseries/vio.c-486-{\narch/powerpc/platforms/pseries/vio.c:487:\tstruct vio_dev *viodev = to_vio_dev(dev);\narch/powerpc/platforms/pseries/vio.c-488-\tvoid *ret;\n--\narch/powerpc/platforms/pseries/vio.c=506=static void vio_dma_iommu_free_coherent(struct device *dev, size_t size,\n--\narch/powerpc/platforms/pseries/vio.c-509-{\narch/powerpc/platforms/pseries/vio.c:510:\tstruct vio_dev *viodev = to_vio_dev(dev);\narch/powerpc/platforms/pseries/vio.c-511-\n--\narch/powerpc/platforms/pseries/vio.c=516=static dma_addr_t vio_dma_iommu_map_phys(struct device *dev, phys_addr_t phys,\n--\narch/powerpc/platforms/pseries/vio.c-520-{\narch/powerpc/platforms/pseries/vio.c:521:\tstruct vio_dev *viodev = to_vio_dev(dev);\narch/powerpc/platforms/pseries/vio.c-522-\tstruct iommu_table *tbl = get_iommu_table_base(dev);\n--\narch/powerpc/platforms/pseries/vio.c=543=static void vio_dma_iommu_unmap_phys(struct device *dev, dma_addr_t dma_handle,\n--\narch/powerpc/platforms/pseries/vio.c-547-{\narch/powerpc/platforms/pseries/vio.c:548:\tstruct vio_dev *viodev = to_vio_dev(dev);\narch/powerpc/platforms/pseries/vio.c-549-\tstruct iommu_table *tbl = get_iommu_table_base(dev);\n--\narch/powerpc/platforms/pseries/vio.c=555=static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,\n--\narch/powerpc/platforms/pseries/vio.c-558-{\narch/powerpc/platforms/pseries/vio.c:559:\tstruct vio_dev *viodev = to_vio_dev(dev);\narch/powerpc/platforms/pseries/vio.c-560-\tstruct iommu_table *tbl = get_iommu_table_base(dev);\n--\narch/powerpc/platforms/pseries/vio.c=589=static void vio_dma_iommu_unmap_sg(struct device *dev,\n--\narch/powerpc/platforms/pseries/vio.c-593-{\narch/powerpc/platforms/pseries/vio.c:594:\tstruct vio_dev *viodev = to_vio_dev(dev);\narch/powerpc/platforms/pseries/vio.c-595-\tstruct iommu_table *tbl = get_iommu_table_base(dev);\n--\narch/powerpc/platforms/pseries/vio.c=607=static const struct dma_map_ops vio_dma_mapping_ops = {\n--\narch/powerpc/platforms/pseries/vio.c-624- *\narch/powerpc/platforms/pseries/vio.c:625: * @viodev: struct vio_dev for device to alter\narch/powerpc/platforms/pseries/vio.c-626- * @desired: new desired entitlement level in bytes\n--\narch/powerpc/platforms/pseries/vio.c-631- */\narch/powerpc/platforms/pseries/vio.c:632:void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired)\narch/powerpc/platforms/pseries/vio.c-633-{\n--\narch/powerpc/platforms/pseries/vio.c-693- *\narch/powerpc/platforms/pseries/vio.c:694: * @viodev - Pointer to struct vio_dev for device\narch/powerpc/platforms/pseries/vio.c-695- *\n--\narch/powerpc/platforms/pseries/vio.c-704- */\narch/powerpc/platforms/pseries/vio.c:705:static int vio_cmo_bus_probe(struct vio_dev *viodev)\narch/powerpc/platforms/pseries/vio.c-706-{\n--\narch/powerpc/platforms/pseries/vio.c-805- *\narch/powerpc/platforms/pseries/vio.c:806: * @viodev - Pointer to struct vio_dev for device\narch/powerpc/platforms/pseries/vio.c-807- *\n--\narch/powerpc/platforms/pseries/vio.c-812- */\narch/powerpc/platforms/pseries/vio.c:813:static void vio_cmo_bus_remove(struct vio_dev *viodev)\narch/powerpc/platforms/pseries/vio.c-814-{\n--\narch/powerpc/platforms/pseries/vio.c-883-\narch/powerpc/platforms/pseries/vio.c:884:static void vio_cmo_set_dma_ops(struct vio_dev *viodev)\narch/powerpc/platforms/pseries/vio.c-885-{\n--\narch/powerpc/platforms/pseries/vio.c=949=static ssize_t cmo_allocs_failed_show(struct device *dev,\n--\narch/powerpc/platforms/pseries/vio.c-951-{\narch/powerpc/platforms/pseries/vio.c:952:\tstruct vio_dev *viodev = to_vio_dev(dev);\narch/powerpc/platforms/pseries/vio.c-953-\treturn sysfs_emit(buf, \"%d\\n\", atomic_read(\u0026viodev-\u003ecmo.allocs_failed));\n--\narch/powerpc/platforms/pseries/vio.c=956=static ssize_t cmo_allocs_failed_store(struct device *dev,\n--\narch/powerpc/platforms/pseries/vio.c-958-{\narch/powerpc/platforms/pseries/vio.c:959:\tstruct vio_dev *viodev = to_vio_dev(dev);\narch/powerpc/platforms/pseries/vio.c-960-\tatomic_set(\u0026viodev-\u003ecmo.allocs_failed, 0);\n--\narch/powerpc/platforms/pseries/vio.c=964=static ssize_t cmo_desired_store(struct device *dev,\n--\narch/powerpc/platforms/pseries/vio.c-966-{\narch/powerpc/platforms/pseries/vio.c:967:\tstruct vio_dev *viodev = to_vio_dev(dev);\narch/powerpc/platforms/pseries/vio.c-968-\tsize_t new_desired;\n--\narch/powerpc/platforms/pseries/vio.c=1058=int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }\narch/powerpc/platforms/pseries/vio.c:1059:void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired) {}\narch/powerpc/platforms/pseries/vio.c:1060:static int vio_cmo_bus_probe(struct vio_dev *viodev) { return 0; }\narch/powerpc/platforms/pseries/vio.c:1061:static void vio_cmo_bus_remove(struct vio_dev *viodev) {}\narch/powerpc/platforms/pseries/vio.c:1062:static void vio_cmo_set_dma_ops(struct vio_dev *viodev) {}\narch/powerpc/platforms/pseries/vio.c-1063-static void vio_cmo_bus_init(void) {}\n--\narch/powerpc/platforms/pseries/vio.c=1067=EXPORT_SYMBOL(vio_cmo_set_dev_desired);\n--\narch/powerpc/platforms/pseries/vio.c-1076- *\narch/powerpc/platforms/pseries/vio.c:1077: * @vdev - Pointer to a struct vio_dev for device\narch/powerpc/platforms/pseries/vio.c-1078- * @op - Pointer to a struct vio_pfo_op for the operation parameters\n--\narch/powerpc/platforms/pseries/vio.c-1098- */\narch/powerpc/platforms/pseries/vio.c:1099:int vio_h_cop_sync(struct vio_dev *vdev, struct vio_pfo_op *op)\narch/powerpc/platforms/pseries/vio.c-1100-{\n--\narch/powerpc/platforms/pseries/vio.c=1155=EXPORT_SYMBOL(vio_h_cop_sync);\narch/powerpc/platforms/pseries/vio.c-1156-\narch/powerpc/platforms/pseries/vio.c:1157:static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev)\narch/powerpc/platforms/pseries/vio.c-1158-{\n--\narch/powerpc/platforms/pseries/vio.c-1203- */\narch/powerpc/platforms/pseries/vio.c:1204:static const struct vio_device_id *vio_match_device(\narch/powerpc/platforms/pseries/vio.c:1205:\t\tconst struct vio_device_id *ids, const struct vio_dev *dev)\narch/powerpc/platforms/pseries/vio.c-1206-{\n--\narch/powerpc/platforms/pseries/vio.c-1217-/*\narch/powerpc/platforms/pseries/vio.c:1218: * Convert from struct device to struct vio_dev and pass to driver.\narch/powerpc/platforms/pseries/vio.c-1219- * dev-\u003edriver has already been set by generic code because vio_bus_match\n--\narch/powerpc/platforms/pseries/vio.c=1222=static int vio_bus_probe(struct device *dev)\narch/powerpc/platforms/pseries/vio.c-1223-{\narch/powerpc/platforms/pseries/vio.c:1224:\tstruct vio_dev *viodev = to_vio_dev(dev);\narch/powerpc/platforms/pseries/vio.c-1225-\tstruct vio_driver *viodrv = to_vio_driver(dev-\u003edriver);\narch/powerpc/platforms/pseries/vio.c:1226:\tconst struct vio_device_id *id;\narch/powerpc/platforms/pseries/vio.c-1227-\tint error = -ENODEV;\n--\n\n"
} |
| 15/2 | 2026/10/12 05:20 | llm | patch-evaluator |
0mModel:gemini-3.8-flash Args: null Results: null Tokens: input: 26151 output: 103 thoughts: 716 Thoughts: **Analysis of Unreachable Code on amd64** Okay, so the `struct vio_dev` structure we're looking at is defined solely within `arch/powerpc/include/asm/vio.h`. This immediately points to a PowerPC context. Furthermore, `CONFIG_IBMVETH` is contingent on `CONFIG_PPC_PSERIES`, which is also a PowerPC specific configuration option. Let's make sure this isn't sneakily compiled or reachable on an amd64 system - and no, it isn't. It's chained to `PPC_PSERIES`, which in turn is only available on powerpc, specifically `PPC64 && PPC_BOOK3S`. Alright, a quick sanity check for `IBMVETH_KUNIT_TEST`. Let's dig into that: ``` config IBMVETH_KUNIT_TEST bool "KUnit test for IBM LAN Virtual Ethernet support" if !KUNIT_ALL_TESTS depends on KUNIT depends on KUNIT=y && IBMVETH=y ``` Aha! It's dependent on `IBMVETH`, which itself depends on `PPC_PSERIES`. So `IBMVETH_KUNIT_TEST` is *also* unreachable on amd64. Therefore, neither `IBMVETH` nor `IBMVETH_KUNIT_TEST` can be built on amd64. Now, let's reference those instructions again. The relevant section addresses negative criteria for `WorthFuzzing`, specifically: "Unreachable execution paths: * Code paths exclusive to architectures other than the target architecture." The modifications are in `drivers/net/ethernet/ibm/ibmveth.c` and `drivers/net/ethernet/ibm/ibmveth.h`, meaning the entire driver is exclusive to `PPC_PSERIES` (PowerPC). The target architecture, as stipulated, is `amd64`. Consequently, these code paths are exclusive to architectures other than the target. They are, from a practical perspective, structurally unreachable and won't even compile on amd64. To double check, I'll confirm only those two files were modified, and the result is the same: the whole set of modifications fall under `CONFIG_IBMVETH`, which depends on `CONFIG_PPC_PSERIES`. On amd64, we can't enable `CONFIG_PPC_PSERIES`. Therefore, the verdict is `WorthFuzzing=false`. The modified code is exclusively tied to PowerPC and can't be built or executed on amd64. The arguments to set-results will be: * `WorthFuzzing: false` * `Reasoning: Code is unreachable on amd64 due to PowerPC architecture-specific dependencies (CONFIG_IBMVETH, CONFIG_PPC_PSERIES).` * `FocusSymbols: []` * `EnableConfigs: []` All checks and verifications are complete. |
| 16/2 | 2026/10/12 05:20 | tool | set-results |
0mArgs:{
"EnableConfigs": [],
"FocusSymbols": [],
"Reasoning": "The patch modifies the ibmveth driver (drivers/net/ethernet/ibm/ibmveth.c and ibmveth.h), which depends on CONFIG_PPC_PSERIES (PowerPC architecture). Because the target architecture is amd64, the modified code is structurally unreachable and cannot be compiled or executed on this target architecture.",
"WorthFuzzing": false
}Results: {
"EnableConfigs": null,
"FocusSymbols": [],
"Reasoning": "The patch modifies the ibmveth driver (drivers/net/ethernet/ibm/ibmveth.c and ibmveth.h), which depends on CONFIG_PPC_PSERIES (PowerPC architecture). Because the target architecture is amd64, the modified code is structurally unreachable and cannot be compiled or executed on this target architecture.",
"WorthFuzzing": false
} |
| 17/1 | 2026/10/12 05:20 | action | If |
0mArgs:{
"WorthFuzzing": false
}Results: null |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|