From 4ed377ec2926a3008cbdb257dd96b5db7824752b Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Thu, 27 Oct 2022 11:09:03 -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: Jay Jayanna Signed-off-by: Chris Lew --- net/qrtr/af_qrtr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c index dcfeddcd6eee..e12833add098 100644 --- a/net/qrtr/af_qrtr.c +++ b/net/qrtr/af_qrtr.c @@ -461,6 +461,9 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb, hdr->confirm_rx = !!confirm_rx; 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); if (!rc) { mutex_lock(&node->ep_lock);