From: Devid Antonio Filoni <devid.filoni@egluetechnologies.com>
To: Robin van der Gracht <robin@protonic.nl>,
Oleksij Rempel <o.rempel@pengutronix.de>
Cc: kernel@pengutronix.de, linux-can@vger.kernel.org,
Oleksij Rempel <linux@rempel-privat.de>,
Oliver Hartkopp <socketcan@hartkopp.net>,
Marc Kleine-Budde <mkl@pengutronix.de>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Jayat <maxime.jayat@mobile-devices.fr>,
kbuild test robot <lkp@intel.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Devid Antonio Filoni <devid.filoni@egluetechnologies.com>
Subject: [PATCH RESEND 1/2] can: j1939: make sure that sent DAT frames are marked as TX
Date: Mon, 9 May 2022 19:07:45 +0200 [thread overview]
Message-ID: <20220509170746.29893-2-devid.filoni@egluetechnologies.com> (raw)
In-Reply-To: <20220509170746.29893-1-devid.filoni@egluetechnologies.com>
Fixes: 9d71dd0 ("can: add support of SAE J1939 protocol")
Signed-off-by: Devid Antonio Filoni <devid.filoni@egluetechnologies.com>
---
net/can/j1939/transport.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index 307ee1174a6e..030f5fe901e1 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -621,18 +621,30 @@ static int j1939_tp_tx_dat(struct j1939_session *session,
const u8 *dat, int len)
{
struct j1939_priv *priv = session->priv;
+ struct sk_buff *se_skb;
struct sk_buff *skb;
+ int ret;
skb = j1939_tp_tx_dat_new(priv, &session->skcb,
false, false);
if (IS_ERR(skb))
return PTR_ERR(skb);
+ se_skb = j1939_session_skb_get(session);
+ if (se_skb)
+ can_skb_set_owner(skb, se_skb->sk);
+
skb_put_data(skb, dat, len);
if (j1939_tp_padding && len < 8)
memset(skb_put(skb, 8 - len), 0xff, 8 - len);
- return j1939_send_one(priv, skb);
+ ret = j1939_send_one(priv, skb);
+
+ if (ret)
+ kfree_skb(se_skb);
+ else
+ consume_skb(se_skb);
+ return ret;
}
static int j1939_xtp_do_tx_ctl(struct j1939_priv *priv,
--
2.25.1
next prev parent reply other threads:[~2022-05-09 17:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-09 17:07 [PATCH RESEND 0/2] j1939: make sure that sent DAT/CTL frames are marked as TX Devid Antonio Filoni
2022-05-09 17:07 ` Devid Antonio Filoni [this message]
2022-05-09 17:07 ` [PATCH RESEND 2/2] can: j1939: make sure that sent CTL " Devid Antonio Filoni
2022-05-10 4:34 ` [PATCH RESEND 0/2] j1939: make sure that sent DAT/CTL " Oleksij Rempel
2022-05-10 18:12 ` Devid Antonio Filoni
2022-05-11 11:48 ` Oleksij Rempel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220509170746.29893-2-devid.filoni@egluetechnologies.com \
--to=devid.filoni@egluetechnologies.com \
--cc=davem@davemloft.net \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rempel-privat.de \
--cc=lkp@intel.com \
--cc=maxime.jayat@mobile-devices.fr \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=robin@protonic.nl \
--cc=socketcan@hartkopp.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).