From patchwork Wed Aug 2 14:59:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffrey Hugo X-Patchwork-Id: 129890 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp537932vqx; Wed, 2 Aug 2023 08:28:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlE2ny3KMpCM4yc5quNfYT56cWEVMGXYyh5wnnb394y8sCDWEFcMMzMN3xjvpU+prIz184lH X-Received: by 2002:a17:902:a518:b0:1b5:fb8:a821 with SMTP id s24-20020a170902a51800b001b50fb8a821mr13721393plq.13.1690990120920; Wed, 02 Aug 2023 08:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690990120; cv=none; d=google.com; s=arc-20160816; b=HirJDKAvf/rycJJ4+zoYgeR8fNV7oWO36DOPSdazDsQJ102Qo2EPykiW2wG/yxXdlO yVYSgCKE4RzfNO32P3yXmQJ2PwHLT92DbM1Nf+vmozcXBsOGbQ01s6DFlqml2FEuKgLb SG7JF3oBM4J9IJXZ3OVxC3MUUeK9A3lCBMR/l1T5OCqc8M7nQNafuPWfl/tyQ3qqM9A8 JqiG2hjmWnt4ti7espAPniGcPr19cBQn1xfpA9AeK2PN8CD/qITw8/P2O23grReBCGdj tkvNxf+I4j0Wc4fs+h/2C0Xcq89zAVSPrVoNL1+KhqO2RKrEpwUhT6rzf05NdG/XCl9R B4uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nqKKN7meQbdRNJo9KlOngNjsLMfb0nu5TkjgpFuhl4o=; fh=zRiXqXaSG0E2139Ls3i70v3G6P4xrSBQND6CucXPJPw=; b=iI7vwRsshIPkbZZKAJAmWJFMnGMtjaq+ZFMzJFsYi/0d/2Fxkd2Dp8mREJBkNnj6J+ qcOjYSzt2ucpD8eMctn9aJKrjrzQkgCvLvtsFqFWDxTZJau9VhXje/PjpCVtSDYgAqOh 8ddyDyZH0hCiufUYPKLjT+iYDsDacmayPGiCu240JYocH2jYLSNRwlpCk+Dp8CyBpupN lUk7wthf957nq6Nqq1eK03zzw3st1LwaouV/6xK0ZTyibT/9kOELm05Djm41Vrx9wt6p 5RncJrdcn7tNkqRONCS1XfDnq6VeUo05vw3R3nycqp+BWTivTs6ad53av+/RQe5sUQQy Cmlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MzbueZdP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t5-20020a1709027fc500b001bbccdceb50si2232717plb.288.2023.08.02.08.28.26; Wed, 02 Aug 2023 08:28:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MzbueZdP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234475AbjHBPAK (ORCPT + 99 others); Wed, 2 Aug 2023 11:00:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233762AbjHBPAI (ORCPT ); Wed, 2 Aug 2023 11:00:08 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 891C92103; Wed, 2 Aug 2023 08:00:05 -0700 (PDT) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 372DnRW6025456; Wed, 2 Aug 2023 14:59:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=nqKKN7meQbdRNJo9KlOngNjsLMfb0nu5TkjgpFuhl4o=; b=MzbueZdP+ltGTq63fOi0dvI5wWkJvJEqIYHICaoVv88EoqfSINXKW2COYNou7Sh/3Oiw c3luWqCI2P3Kt/oIRnlMxZjsveu4NY6D0AfPO9DZ4yF8SnrEaKbm2Puv+dOWncPy/9sv IVQtPqLjbvGeV3GOV869qdV9IiBCIRrnqvRdeN/Z6I3qIn5TQq9T98Gg17VaVLK6p6Fc Bse2pz9y7AcPnporLAzpmxjH1pQurljRGsjA4V5FkVdMkd+U5KIItr+p+PC5Vd52gQ1v Z/b0aSVcD9xmbdDcc+s3MyVv7Kf0pGfFjTj/KAkEUilS9MOTVsFBazUPfuo4+MQmRul+ QA== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3s760c2n8g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Aug 2023 14:59:58 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 372ExuPZ018039 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 2 Aug 2023 14:59:56 GMT Received: from jhugo-lnx.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Wed, 2 Aug 2023 07:59:55 -0700 From: Jeffrey Hugo To: CC: , , , , , , , , "Pranjal Ramajor Asha Kanojiya" , Jeffrey Hugo Subject: [PATCH v2] accel/qaic: Fix slicing memory leak Date: Wed, 2 Aug 2023 08:59:37 -0600 Message-ID: <20230802145937.14827-1-quic_jhugo@quicinc.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: vGiXcTrgX75lrD_nxlkN8ZH58tXCyAzw X-Proofpoint-ORIG-GUID: vGiXcTrgX75lrD_nxlkN8ZH58tXCyAzw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-02_10,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 impostorscore=0 mlxscore=0 phishscore=0 clxscore=1011 bulkscore=0 priorityscore=1501 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308020132 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773131656638443511 X-GMAIL-MSGID: 1773131656638443511 From: Pranjal Ramajor Asha Kanojiya The temporary buffer storing slicing configuration data from user is only freed on error. This is a memory leak. Free the buffer unconditionally. Fixes: ff13be830333 ("accel/qaic: Add datapath") Signed-off-by: Pranjal Ramajor Asha Kanojiya Reviewed-by: Carl Vanderlip Reviewed-by: Jeffrey Hugo Signed-off-by: Jeffrey Hugo --- v2: reword commit text drivers/accel/qaic/qaic_data.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c index e9a1cb779b30..6b6d981a71be 100644 --- a/drivers/accel/qaic/qaic_data.c +++ b/drivers/accel/qaic/qaic_data.c @@ -1021,6 +1021,7 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi bo->dbc = dbc; srcu_read_unlock(&dbc->ch_lock, rcu_id); drm_gem_object_put(obj); + kfree(slice_ent); srcu_read_unlock(&qdev->dev_lock, qdev_rcu_id); srcu_read_unlock(&usr->qddev_lock, usr_rcu_id);