Message ID | 20220314112731.968884655@linuxfoundation.org |
---|---|
State | New |
Headers | show
Return-Path: <stable-owner@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F238CC433F5 for <stable@archiver.kernel.org>; Mon, 14 Mar 2022 11:40:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239508AbiCNLmD (ORCPT <rfc822;stable@archiver.kernel.org>); Mon, 14 Mar 2022 07:42:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239478AbiCNLln (ORCPT <rfc822;stable@vger.kernel.org>); Mon, 14 Mar 2022 07:41:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1B8249C83; Mon, 14 Mar 2022 04:39:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C7332611D4; Mon, 14 Mar 2022 11:39:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D361C340E9; Mon, 14 Mar 2022 11:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647257948; bh=T6jigpNq982/j1TJfmd+kEQNRNF3TWIqUBan2G1ihXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dB45wU/8CGGRHBYffB1Is4SpjY7ARpSzaHkewp0xwtXx1F6uH0xrpsHaH+sNHyL6U PuDEghmIG0rka9paTLtVWd6T3Dx0OJv/vvgIUAOCIuR1QiezEQiE00gC0uR8a9smZ2 wI4HZ2qlK5qmDPgpMcM25hXI7ialjcggDHZMvpvk= From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Thomas Osterried <thomas@osterried.de>, Duoming Zhou <duoming@zju.edu.cn>, "David S. Miller" <davem@davemloft.net>, Sasha Levin <sashal@kernel.org> Subject: [PATCH 4.19 06/30] ax25: Fix NULL pointer dereference in ax25_kill_by_device Date: Mon, 14 Mar 2022 12:34:24 +0100 Message-Id: <20220314112731.968884655@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112731.785042288@linuxfoundation.org> References: <20220314112731.785042288@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <stable.vger.kernel.org> X-Mailing-List: stable@vger.kernel.org |
Series |
None
|
expand
|
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index a2bf5e4e9fbe..3170b43b9f89 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -90,6 +90,13 @@ static void ax25_kill_by_device(struct net_device *dev) ax25_for_each(s, &ax25_list) { if (s->ax25_dev == ax25_dev) { sk = s->sk; + if (!sk) { + spin_unlock_bh(&ax25_list_lock); + s->ax25_dev = NULL; + ax25_disconnect(s, ENETUNREACH); + spin_lock_bh(&ax25_list_lock); + goto again; + } sock_hold(sk); spin_unlock_bh(&ax25_list_lock); lock_sock(sk);