From 5080da6767350d9e0141c1d16727c1a352cb79c5 Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Wed, 9 Oct 2019 17:51:15 -0700 Subject: [PATCH] net: qrtr: Handle error from skb_put_padto skb_put_padto() will free the skb if it fails to add the requested padding to the skb. Drop the packet if we are unable to allocate a new skb with the requested padding. Change-Id: I5503c99679c7e6ecf767d3f632d72da5315988f1 Signed-off-by: Chris Lew --- net/qrtr/qrtr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index 641a1cf9c164..39dc70fdc6ee 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -606,8 +606,13 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb, hdr->size = cpu_to_le32(len); hdr->confirm_rx = !!confirm_rx; - skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr)); qrtr_log_tx_msg(node, hdr, skb); + rc = skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr)); + if (rc) { + pr_err("%s: failed to pad size %lu to %lu rc:%d\n", __func__, + len, ALIGN(len, 4) + sizeof(*hdr), rc); + return rc; + } mutex_lock(&node->ep_lock); if (node->ep)