From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 53B307E for ; Wed, 2 Nov 2022 03:11:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FE51C433D6; Wed, 2 Nov 2022 03:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667358690; bh=46JCP7KOjFIz6FGBsSpPrxIOv01lrZlj9sSeTPItX3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qo1oXHrqSNJlnjH3d9mlk07oW4qMoqXNN8SBA2+1L/pz4ssx9zkorBzU1rfK7C3lX wjRbcvZVV68Z8lk9oVNrhuhHEbA4JwVxPfLGvKNiZJX8fh3ugg8FIV6e+N4gpPkFrU 1/42uHmmixeecRX1Sql8UCXAlovDFEWFLGRNfMzs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yang Yingliang , Oleksij Rempel , Marc Kleine-Budde Subject: [PATCH 5.10 01/91] can: j1939: transport: j1939_session_skb_drop_old(): spin_unlock_irqrestore() before kfree_skb() Date: Wed, 2 Nov 2022 03:32:44 +0100 Message-Id: <20221102022055.082946510@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221102022055.039689234@linuxfoundation.org> References: <20221102022055.039689234@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Yang Yingliang commit c3c06c61890da80494bb196f75d89b791adda87f upstream. It is not allowed to call kfree_skb() from hardware interrupt context or with interrupts being disabled. The skb is unlinked from the queue, so it can be freed after spin_unlock_irqrestore(). Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") Signed-off-by: Yang Yingliang Acked-by: Oleksij Rempel Link: https://lore.kernel.org/all/20221027091237.2290111-1-yangyingliang@huawei.com Cc: stable@vger.kernel.org [mkl: adjust subject] Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- net/can/j1939/transport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/can/j1939/transport.c +++ b/net/can/j1939/transport.c @@ -338,10 +338,12 @@ static void j1939_session_skb_drop_old(s __skb_unlink(do_skb, &session->skb_queue); /* drop ref taken in j1939_session_skb_queue() */ skb_unref(do_skb); + spin_unlock_irqrestore(&session->skb_queue.lock, flags); kfree_skb(do_skb); + } else { + spin_unlock_irqrestore(&session->skb_queue.lock, flags); } - spin_unlock_irqrestore(&session->skb_queue.lock, flags); } void j1939_session_skb_queue(struct j1939_session *session,