Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1713550lql; Wed, 13 Mar 2024 06:24:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXlAvk8ClyXHCsu6Is15C4gj3klQgz+gfWHlnPWN5CyIGEQtkC/782QzOuEgIY3gXkoyq3jWCjdCSjYKDnw6998iBcsiinCt1m5osU9NQ== X-Google-Smtp-Source: AGHT+IH5VuNW+S/3QapN04mhGG6jq8y7g/eSyjQaiXXaWJU4CnAU0oTcZnAXM7j3A2OuPaSpMcZN X-Received: by 2002:a05:6358:7f90:b0:17c:2648:154b with SMTP id c16-20020a0563587f9000b0017c2648154bmr13081769rwo.32.1710336252171; Wed, 13 Mar 2024 06:24:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710336252; cv=pass; d=google.com; s=arc-20160816; b=T63v3k5XcfCD9N0E/xjlG62Gpci9rky2UzqBGxqL31vY98VVixqgjYzmLHZhdp2wuR gOENQ3w7vJQuESssxM7EjfTlIhJWhJLP9C2N7GvmyLwJA2JZst2/LYuLCX6jhluzJW0K fU7VCgeMPvlUFF/TqYOkl9QZUE2EvpNZQ7W4xlAkqXqLOHJpqzt8EVYOS/NrqTg4OOmM pxmzrg0HuPsdyi77LlyrymeKe0DqXPuW9RZpDCx842zwUgk+8ZNmud7sONy8y844p8mW SfMcOj1JeH+83ucc1y8f6afxraApx0oNDEs54ciYRVmIfkDzjYb8w/snUkbVV7Y/1Hnc KmgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature:dkim-filter; bh=Q3mlrkprHQSqqe7ZzbpkZFoFX1OW7QRMBkhOjb+6+wk=; fh=y5uG/7tUhOD7hb1FXQLxYjDVtK3aAl7tAb1sAvSNXu8=; b=RBZNBVYAL+C8bNapv2Iy4TQFCdmSficsSzXzq9s/VTcUkqdrdEH4k0OjYrDl/aks5a eEpRcofuC7fSh91rmHogbzfJb2NtCM8g4uDxtL2QjRn4TFjalggqzFfGaH6buMuPNzsp B26NxYcpVrrOcSyAA03E54BYFujzxgP194fYem2R4qOwGqfzQQ9X0RMCQVgc1ECcEtHH OftN3V0ZAhT4tQLjn5CAEqWhWo4raUlZgsohxBIRrC6BY61AG5PEuO5hnv4DWncPioi/ qp+HEezTrCru11glHZ4WGTwOtSrRPzX8huPBhIk5Ya+ZCD8/NKxwWCj/2vfQcadQt+sb c8xQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rosalinux.ru header.s=1D4BB666-A0F1-11EB-A1A2-F53579C7F503 header.b=WSrCbeXk; arc=pass (i=1 spf=pass spfdomain=rosalinux.ru dkim=pass dkdomain=rosalinux.ru dmarc=pass fromdomain=rosalinux.ru); spf=pass (google.com: domain of linux-kernel+bounces-101519-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101519-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=rosalinux.ru Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k18-20020a6568d2000000b005e47afd5c60si9129659pgt.646.2024.03.13.06.24.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 06:24:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101519-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@rosalinux.ru header.s=1D4BB666-A0F1-11EB-A1A2-F53579C7F503 header.b=WSrCbeXk; arc=pass (i=1 spf=pass spfdomain=rosalinux.ru dkim=pass dkdomain=rosalinux.ru dmarc=pass fromdomain=rosalinux.ru); spf=pass (google.com: domain of linux-kernel+bounces-101519-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101519-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=rosalinux.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 79D742857F8 for ; Wed, 13 Mar 2024 13:24:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 66A2440872; Wed, 13 Mar 2024 13:24:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rosalinux.ru header.i=@rosalinux.ru header.b="WSrCbeXk" Received: from mail.rosalinux.ru (mail.rosalinux.ru [195.19.76.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7ABE83C39; Wed, 13 Mar 2024 13:23:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.19.76.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710336245; cv=none; b=dtkrxqVBAhPU3+po+xtngVY9K/u/9YOPE1WukB6hfzlNEmLsJq5qBgjpPVO6ADxRvusfsZuPLpqKZTUiTBiJe1U6iwcueThvd4lneJooEcqZztMDNsxfmiR6nZqJp8DQy2AUU49PAdpYaN3N6X94K+EojJvrlPO2gXMIpj0CY/Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710336245; c=relaxed/simple; bh=yPqAe7ClhayYRrLN2CJq+cfkSc0n2HvZp2xKEfV+UR4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=D5KAQkHTKo0sI4LmCgzaR5SMSonPF/du4c6JtoJrfBTN/pfzZSKekRGVqq1UWjM7QP5d3b2bnPmOlfmjuTwHXQEZMd3lIbARtFwOvQOT7VlIEm9glMVCSGw13fCPj++xiOoU+Z106eT39izyhVLFsKfGrAM/M9A7zhTP7VjvE0Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rosalinux.ru; spf=pass smtp.mailfrom=rosalinux.ru; dkim=pass (2048-bit key) header.d=rosalinux.ru header.i=@rosalinux.ru header.b=WSrCbeXk; arc=none smtp.client-ip=195.19.76.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rosalinux.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rosalinux.ru Received: from localhost (localhost [127.0.0.1]) by mail.rosalinux.ru (Postfix) with ESMTP id 3E84FDFACF8A1; Wed, 13 Mar 2024 16:23:45 +0300 (MSK) Received: from mail.rosalinux.ru ([127.0.0.1]) by localhost (mail.rosalinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id H1TS0Fis9ARg; Wed, 13 Mar 2024 16:23:45 +0300 (MSK) Received: from localhost (localhost [127.0.0.1]) by mail.rosalinux.ru (Postfix) with ESMTP id E9292DFACF89F; Wed, 13 Mar 2024 16:23:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.rosalinux.ru E9292DFACF89F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rosalinux.ru; s=1D4BB666-A0F1-11EB-A1A2-F53579C7F503; t=1710336225; bh=Q3mlrkprHQSqqe7ZzbpkZFoFX1OW7QRMBkhOjb+6+wk=; h=From:To:Date:Message-ID:MIME-Version; b=WSrCbeXkAvXISeJK+KzWxdWYqFbr7juu33ozGTbEQ/MiuyQvMpNu9n2suLoizodtj 19BROhwGoadIkh3xPdQBcVmiMtmkM+VzIgo8yaG3bJIg9jObsF0pBHqQEajmwVx6rq /H5yVc5YlMtP9aFqL+z3IsehxMWZrWXySKamnSlceKrRWHQSP6w4KwXhFRaFI7qimT UXigrPTQ/BuKkJWlA+z3aZCN7ZlWXI6egbEhS8q0q8PSOO2fKafpBUlmUZMdJS9agS CQ1xKsNuOM0lh9O74vhe8t1XjZ1xtiahR+Jq9WlV1NPYjgG4veybjLNNekvkfUyEM4 f8lQ4cUN45a/A== X-Virus-Scanned: amavisd-new at rosalinux.ru Received: from mail.rosalinux.ru ([127.0.0.1]) by localhost (mail.rosalinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id E4DEAnA0C_be; Wed, 13 Mar 2024 16:23:44 +0300 (MSK) Received: from localhost.localdomain (unknown [62.217.186.174]) by mail.rosalinux.ru (Postfix) with ESMTPSA id A8892DFACF8A1; Wed, 13 Mar 2024 16:23:44 +0300 (MSK) From: Mikhail Lobanov To: Martin Schiller Cc: Mikhail Lobanov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-x25@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] x_25: Adding a null pointer dereference check to the x25_accept() function Date: Wed, 13 Mar 2024 09:22:08 -0400 Message-ID: <20240313132214.48716-1-m.lobanov@rosalinux.ru> X-Mailer: git-send-email 2.43.0 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 To avoid the problem of dereferencing the null pointer in the x25_accept(= ) function, you need to add an additional check that the pointer skb is not equal to NULL. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Mikhail Lobanov --- net/x25/af_x25.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index f7a7c7798c3b..91bc5994cef6 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -896,7 +896,7 @@ static int x25_accept(struct socket *sock, struct soc= ket *newsock, int flags, goto out2; skb =3D skb_dequeue(&sk->sk_receive_queue); rc =3D -EINVAL; - if (!skb->sk) + if (!skb || !skb->sk) goto out2; newsk =3D skb->sk; sock_graft(newsk, newsock); --=20 2.43.0