Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1388555

[PATCH 3.2 017/115] xfs: fix two memory leaks in xfs_attr_list.c error paths

From Ben Hutchings <ben@decadent.org.uk>
Newsgroups linux.kernel
Subject [PATCH 3.2 017/115] xfs: fix two memory leaks in xfs_attr_list.c error paths
Date 2016-04-27 02:50 +0200
Message-ID <rslPZ-pf-41@gated-at.bofh.it> (permalink)
References <rskqS-7Qj-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


3.2.80-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Mateusz Guzik <mguzik@redhat.com>

commit 2e83b79b2d6c78bf1b4aa227938a214dcbddc83f upstream.

This plugs 2 trivial leaks in xfs_attr_shortform_list and
xfs_attr3_leaf_list_int.

Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/xfs/xfs_attr_leaf.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

--- a/fs/xfs/xfs_attr_leaf.c
+++ b/fs/xfs/xfs_attr_leaf.c
@@ -721,8 +721,10 @@ xfs_attr_shortform_list(xfs_attr_list_co
 					sbp->namelen,
 					sbp->valuelen,
 					&sbp->name[sbp->namelen]);
-		if (error)
+		if (error) {
+			kmem_free(sbuf);
 			return error;
+		}
 		if (context->seen_enough)
 			break;
 		cursor->offset++;
@@ -2404,14 +2406,13 @@ xfs_attr_leaf_list_int(xfs_dabuf_t *bp,
 				args.rmtblkno = be32_to_cpu(name_rmt->valueblk);
 				args.rmtblkcnt = XFS_B_TO_FSB(args.dp->i_mount, valuelen);
 				retval = xfs_attr_rmtval_get(&args);
-				if (retval)
-					return retval;
-				retval = context->put_listent(context,
-						entry->flags,
-						name_rmt->name,
-						(int)name_rmt->namelen,
-						valuelen,
-						args.value);
+				if (!retval)
+					retval = context->put_listent(context,
+							entry->flags,
+							name_rmt->name,
+							(int)name_rmt->namelen,
+							valuelen,
+							args.value);
 				kmem_free(args.value);
 			} else {
 				retval = context->put_listent(context,

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.2 000/115] 3.2.80-rc1 review Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 006/115] [media] saa7134: Fix bytesperline not being  set correctly for planar formats Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 014/115] [media] bttv: Width must be a multiple of 16  when capturing planar formats Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 114/115] jme: Fix device PM wakeup API usage Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 018/115] drivers/misc/ad525x_dpot: AD5274 fix RDAC  read back errors Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 008/115] Bluetooth: Add new AR3012 ID 0489:e095 Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 019/115] usb: hub: fix a typo in hub_port_init()  leading to wrong logic Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 007/115] Bluetooth: btusb: Add new AR3012 ID 13d3:3395 Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 115/115] netfilter: x_tables: fix unconditional helper Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 003/115] 8250: use callbacks to access UART_DLL/UART_DLM Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 013/115] Bluetooth: btusb: Add a new AR3012 ID 04ca:3014 Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 005/115] usb: retry reset if a device times out Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 010/115] mac80211: avoid excessive stack usage in sta_info Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 017/115] xfs: fix two memory leaks in xfs_attr_list.c  error paths Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 001/115] EDAC, amd64_edac: Shift wrapping issue in  f1x_get_norm_dct_addr() Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 011/115] mac80211: fix memory leak Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 002/115] [media] pwc: Add USB id for Philips Spc880nc  webcam Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 012/115] PCI: Disable IO/MEM decoding for devices with  non-compliant BARs Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 113/115] jme: Do not enable NIC WoL functions on S0 Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 009/115] aacraid: Fix memory leak in aac_fib_map_free Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  [PATCH 3.2 015/115] watchdog: rc32434_wdt: fix ioctl error handling Ben Hutchings <ben@decadent.org.uk> - 2016-04-27 02:50 +0200
  Re: [PATCH 3.2 000/115] 3.2.80-rc1 review Guenter Roeck <linux@roeck-us.net> - 2016-04-27 05:40 +0200

csiph-web