From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEEF33EC2D1 for ; Wed, 22 Jul 2026 03:47:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784692024; cv=none; b=VjsMM81iPtHk3keEUK1RGSQ2SBlRDbQ9dA/POMTjGQBGlD5EuuFCFIW0mswPtlYh4R9scjQS7ZYbLaZ4ueFdwA+Fr4qh6nX1ba831LENvR1lHlr3qle9qzW70+mYZ1toriYIxEOBv+60bgTh2zwpp05mji8J8E7gcqjN2BUcwos= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784692024; c=relaxed/simple; bh=BonxlASbrudEWQ9VqkFxYPYzf3PGM/pEI5og4/ogyA0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZexisUcMWou8uJRh2nulzuYQwH1x5ZW764OHXJDnpdiavG//kZ0ORRng3r382b5abU1MWqQlb/lFLgCDopkhKcrfRFV3iU9J+6zbbjFT/64IABtiTlNLZV0bTfs18CKlCeLWxs54IeQuLgXIgubEDYg+wtdlHdY45wYqlEcQryM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=EutCUDy+; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EutCUDy+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784692023; x=1816228023; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BonxlASbrudEWQ9VqkFxYPYzf3PGM/pEI5og4/ogyA0=; b=EutCUDy+GJsC/XyuhX5L1CS/+zhhrhpHbo+Hr+7oPrmGsCcyZTbsfkgW CLGjM363QWQHOYiJQy+k4Rx4Z+Oi/3ZjP40CQRaLbaFV8q8uRYO/oKm5x +AqpZEFypa6L9Z4VuK2yEjEq1F8TGd7Bj0mqyNxix6Cw2Irce6t9gtYNM hfJs+Wns8Cfsye09PMQ35UNTsgg54S7fYu91psnZTVCNljfaqxidwuAAT KeCzNE3xlVM++JaMeo68PJl7oDNaYZpleKzxN6C0CkEqdqI0gHpHmxPHG en1jVdJtyDq2kbgC7ylUWm7TSqgW/0h0qwuVqGET9oM26iedLxTL5s1iV A==; X-CSE-ConnectionGUID: IrGkqL/aS6Gurcoppiiqug== X-CSE-MsgGUID: LmloHiaHSYSlFw/L+ESclg== X-IronPort-AV: E=McAfee;i="6800,10657,11853"; a="85433995" X-IronPort-AV: E=Sophos;i="6.25,177,1779174000"; d="scan'208";a="85433995" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2026 20:47:02 -0700 X-CSE-ConnectionGUID: Ws1VjIgHQ8ap0bF/z0gV1w== X-CSE-MsgGUID: svxmImQPSnemAQn2YkJzHQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,177,1779174000"; d="scan'208";a="257421698" Received: from jraag-z790m-itx-wifi.iind.intel.com ([10.190.239.23]) by orviesa008.jf.intel.com with ESMTP; 21 Jul 2026 20:46:57 -0700 From: Raag Jadav To: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, netdev@vger.kernel.org Cc: simona.vetter@ffwll.ch, airlied@gmail.com, kuba@kernel.org, lijo.lazar@amd.com, Hawking.Zhang@amd.com, davem@davemloft.net, pabeni@redhat.com, edumazet@google.com, dev@lankhorst.se, zachary.mckevitt@oss.qualcomm.com, rodrigo.vivi@intel.com, riana.tauro@intel.com, michal.wajdeczko@intel.com, matthew.d.roper@intel.com, mallesh.koujalagi@intel.com, Raag Jadav Subject: [PATCH v5 1/5] drm/ras: Cancel and free message on get counter failure Date: Wed, 22 Jul 2026 09:11:11 +0530 Message-ID: <20260722034228.662746-2-raag.jadav@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260722034228.662746-1-raag.jadav@intel.com> References: <20260722034228.662746-1-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit doit_reply_value() directly returns on get counter failure, which results in stale sk_buff and genetlink header that aren't cleaned up. Fix it and while at it, consolidate error handling using goto. Fixes: c36218dc49f5 ("drm/ras: Introduce the DRM RAS infrastructure over generic netlink") Signed-off-by: Raag Jadav Reviewed-by: Riana Tauro --- v2: Use goto (Riana) --- drivers/gpu/drm/drm_ras.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_ras.c b/drivers/gpu/drm/drm_ras.c index d6eab29a1394..467a169026fc 100644 --- a/drivers/gpu/drm/drm_ras.c +++ b/drivers/gpu/drm/drm_ras.c @@ -201,25 +201,28 @@ static int doit_reply_value(struct genl_info *info, u32 node_id, hdr = genlmsg_iput(msg, info); if (!hdr) { - nlmsg_free(msg); - return -EMSGSIZE; + ret = -EMSGSIZE; + goto free_msg; } ret = get_node_error_counter(node_id, error_id, &error_name, &value); if (ret) - return ret; + goto cancel_msg; ret = msg_reply_value(msg, error_id, error_name, value); - if (ret) { - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); - return ret; - } + if (ret) + goto cancel_msg; genlmsg_end(msg, hdr); return genlmsg_reply(msg, info); + +cancel_msg: + genlmsg_cancel(msg, hdr); +free_msg: + nlmsg_free(msg); + return ret; } /** -- 2.43.0