From: Dan Carpenter Date: Thu, 20 Apr 2017 10:21:30 +0000 (+0300) Subject: net: qrtr: potential use after free in qrtr_sendmsg() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6f60f438108c66988c944894e5f673ab5d04fbc1;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git net: qrtr: potential use after free in qrtr_sendmsg() If skb_pad() fails then it frees the skb so we should check for errors. Fixes: bdabad3e363d ("net: Add Qualcomm IPC router") Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller --- diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index ae5ac175b2be..9da7368b0140 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -658,7 +658,9 @@ static int qrtr_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) } if (plen != len) { - skb_pad(skb, plen - len); + rc = skb_pad(skb, plen - len); + if (rc) + goto out_node; skb_put(skb, plen - len); }