From nobody Tue Dec 2 00:04:41 2025 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C4C71F0991 for ; Tue, 25 Nov 2025 21:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764104536; cv=none; b=N9/INAhyEKK40HqnGg/1VdOzgdR2WtbQicZeTGc2NI/v03kvJzZba2zp3GbRi8ayY72t8Y3TPgpHyeAFSxvRupzh5i2vt07ePFHASrwWhcML64dDh0NSmfZ8cVnca/MTSnFwM80GlUiMGPKnKuo7TJUEGqQu7ZkQxXd3MOq/wl4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764104536; c=relaxed/simple; bh=+X2NL/mQII+GwsSzlRCjIi8ay0Fc5THQSfbr7naxGpE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=EvngjWmTSM/JVSE0elvqkKDaf9fAc6z4yCo1SXBY4t8ign5I+FmDbT+Hn8oe7yhjnqbeZRS01WQ4iT10gx8aZksKN41tSjb3dZBGuY8t5szvom06YWSEn/6kyytTdoxRW1o9uZMT83ogKWYh8W67g3IPpjjcMDsgvFgL67BBOnU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ee.vjti.ac.in; spf=none smtp.mailfrom=ee.vjti.ac.in; dkim=pass (1024-bit key) header.d=vjti.ac.in header.i=@vjti.ac.in header.b=NheQOEAM; arc=none smtp.client-ip=209.85.210.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ee.vjti.ac.in Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ee.vjti.ac.in Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=vjti.ac.in header.i=@vjti.ac.in header.b="NheQOEAM" Received: by mail-pf1-f194.google.com with SMTP id d2e1a72fcca58-7a9cdf62d31so7197170b3a.3 for ; Tue, 25 Nov 2025 13:02:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vjti.ac.in; s=google; t=1764104533; x=1764709333; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=osXunqhAfL4H6EY3Us+4JhzQ2RBABGSGYhjkFwEvKR0=; b=NheQOEAMt2csDZrmQHXPMGiIiY4CP+ovscc8uhsyDMWbTdM3dTPT7hM3QYl8ECYg0z n5kCW3NH9n8/BblY0W6xYX4EkbvZ4gIkuNXV78QXFv8tu52xJSQNi8OJ0h/ShUi70HiJ HuD14Iy1Pw4VeBFxGi4BGxFhcymgXxjLeTtqg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764104533; x=1764709333; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=osXunqhAfL4H6EY3Us+4JhzQ2RBABGSGYhjkFwEvKR0=; b=rNigNCgRjooq9nkkEdr2cPIn78SlfGhZJ69OuLRMiek51qKygdN14Oprabvk2Jx3ir DrAcaOCMNqJUxSoPXs1hfAxlY8iA0ep7XSAVG3LH7RqxP7dZ+tFzxVKrHVD4JcmbNz3U Yp74TFGQ/LA9ubBVKQO6gBz/cLPyRkr4hWctIqYgbUvbauHyF3+F6jBBbhHy1Lv6cAvE J8H5VfJ/gs+y9LYEO0hiKkcNDxBXFoEiAYvt204M3n2lKapR74DfNQgUc+r4I2/3Mk7A r9qObeMnxD4VSLEt6282oIcMTpHsGqhkI6bw35eMt5ZpA/CHIpHlkH7jY9zxKF1034nx R1rQ== X-Forwarded-Encrypted: i=1; AJvYcCUVT9qbV8P5HE+AhsrF1cDB1WDPGF1gOPB514G9AVh67wVhPFjPQTP+7wxd0h9DTw9puAsTBiRBSo+VvKs=@vger.kernel.org X-Gm-Message-State: AOJu0YwniPk2JPTQt9Ow5TXeRRPT4Ro3fN8HvYYBahPWJl5Vwq07HCuD 2N6KHWpQHzVZcaLg5ICRKiurvzvZMGgZQvYpyq7gI/cCaAz9C/A3I64OMR4UctP026U= X-Gm-Gg: ASbGnctE7KAvJAgBfjt5BV52FS5IbK7Kyt0eWXzH8sZBK4GVey9pm/CosQobkSBmXtf d4lHU08rWhesupnxZP5JwRAyhBQ/JkhUETk/VZk3/7joEXUX3/G5QFVRICr9WVB/sa8HwWAfoGz g6OgyhzZQ7dpzoxJj7IjIVocDZ53pUysSq5Hc5kHMe9E8IrhtK2MSy6TZ5NcVmX3SKZvCbOdHS8 2Wi8o7ZGTlksthZ0qOl3tyuD9oaaBFae3+4shyeHcZ9GQEyt7BBdQjyV8QBVIPxQOzt3I6olypQ W2qzBtGnHk7XkJKYPMpnDbOSGyOQ9tB4qcLbWxX/AznihfcFUOmJD0leBADcUQkf7U2M4z4cYwj d12d9LsMF+FkrB8eFOYVQ+I88SlrbyZG8eRtlKMwOzVOg2/zRoDVHCC1lwfUSmthZjnBGzP7o7h CRYq1/e01RAoa9WEfDSqMGOpgy1/jiFOxm+0laJNx85LbGBuxnN01PD4AG X-Google-Smtp-Source: AGHT+IF8rHdGCk+hPhh11+D10Hl7dwICt6inpTxsalZAZAlVFcjaUhKIhxOQY9T2iFRuI0A5OjEuPQ== X-Received: by 2002:a05:6a20:a12a:b0:342:e2ef:332d with SMTP id adf61e73a8af0-3614edf0345mr18775051637.40.1764104532467; Tue, 25 Nov 2025 13:02:12 -0800 (PST) Received: from ranegod-HP-ENVY-x360-Convertible-13-bd0xxx.. ([2405:201:31:d869:2a74:b29f:f7bf:865c]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-bd75e4c9ff5sm16915596a12.9.2025.11.25.13.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 13:02:11 -0800 (PST) From: ssrane_b23@ee.vjti.ac.in X-Google-Original-From: ssranevjti@gmail.com To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Simon Horman , Felix Maurer , Jaakko Karrenpalo , Arvid Brodin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev, david.hunter.linux@gmail.com, khalid@kernel.org, Shaurya Rane , syzbot+2fa344348a579b779e05@syzkaller.appspotmail.com Subject: [PATCH] hsr: fix NULL pointer dereference in skb_clone with hw tag insertion Date: Wed, 26 Nov 2025 02:31:58 +0530 Message-Id: <20251125210158.224431-1-ssranevjti@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Shaurya Rane When hardware HSR tag insertion is enabled (NETIF_F_HW_HSR_TAG_INS) and frame->skb_std is NULL, both hsr_create_tagged_frame() and prp_create_tagged_frame() will call skb_clone() with a NULL skb pointer, causing a kernel crash. Fix this by adding NULL checks for frame->skb_std before calling skb_clone() in the functions. Reported-by: syzbot+2fa344348a579b779e05@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D2fa344348a579b779e05 Fixes: f266a683a480 ("net/hsr: Better frame dispatch") Signed-off-by: Shaurya Rane --- net/hsr/hsr_forward.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c index 339f0d220212..4c1a311b900f 100644 --- a/net/hsr/hsr_forward.c +++ b/net/hsr/hsr_forward.c @@ -211,6 +211,9 @@ struct sk_buff *prp_get_untagged_frame(struct hsr_frame= _info *frame, __FILE__, __LINE__, port->dev->name); return NULL; } + + if (!frame->skb_std) + return NULL; } =20 return skb_clone(frame->skb_std, GFP_ATOMIC); @@ -341,6 +344,8 @@ struct sk_buff *hsr_create_tagged_frame(struct hsr_fram= e_info *frame, hsr_set_path_id(frame, hsr_ethhdr, port); return skb_clone(frame->skb_hsr, GFP_ATOMIC); } else if (port->dev->features & NETIF_F_HW_HSR_TAG_INS) { + if (!frame->skb_std) + return NULL; return skb_clone(frame->skb_std, GFP_ATOMIC); } =20 @@ -385,6 +390,8 @@ struct sk_buff *prp_create_tagged_frame(struct hsr_fram= e_info *frame, } return skb_clone(frame->skb_prp, GFP_ATOMIC); } else if (port->dev->features & NETIF_F_HW_HSR_TAG_INS) { + if (!frame->skb_std) + return NULL; return skb_clone(frame->skb_std, GFP_ATOMIC); } =20 --=20 2.34.1